Repository navigation
Weapon Cloning
New to smashline is the ability to "clone" weapons from one fighter to another. Mod creators can use this feature to give characters brand-new weapons that can do whatever you desire.
When cloning a weapon, there are many aspects to consider, such as:
- What should I base my new weapon on?
- Do I need to reimplement ACMD/Statuses for this weapon?
- Will this do my taxes for me?
The last one I can't help you with, but mod creators should take care in what they base their new weapon off of.
There are a few things needed at minimum to successfully clone a weapon:
- A plugin to run the weapon cloning functions, and to spawn the cloned weapon.
- A modified vl.prc for your recipient fighter, so that the cloned weapon's params can be loaded.
- The relevant model/motion files in your recipient fighter's directory.
- Said model/motion files added to a
config.jsonso ARCropolis can read them.
Cloning can be performed by calling smashline::clone_weapon. Call the clone as so:
pub static mut FIGHTER_SONIC_GENERATE_ARTICLE_FIREBALL : i32 = 0;
pub static mut WEAPON_KIND_SONIC_FIREBALL : i32 = 0;
pub fn install() {
let fireball = smashline::clone_weapon(
"sonic", // Fighter Name
"fireball", // Cloned Article Name
*WEAPON_KIND_MARIO_FIREBALL, // Base Article Kind
true // Use Original Code
);
unsafe {
FIGHTER_SONIC_GENERATE_ARTICLE_FIREBALL = fireball.generate_id;
WEAPON_KIND_SONIC_FIREBALL = fireball.weapon_id;
}
}You'll need to store the generate_id and weapon_id into a static mutable so that you can access it elsewhere.
The rest of this guide will use Sonic's new fireball as an example.
// UNDER CONSTRUCTION // PARAMS, FILES, CONFIG.JSON DOCUMENTATION HERE
Attempting to clone weapons with these types of collisions will more than likely crash your game when attempting to spawn them. Mod creators will need to replace / rewrite functions in that weapon's vtable, as these are called from FighterParamAccessor2, which cannot be slotted.
You cannot clone a weapon if the weapon's name is the same as a vanilla article that your recipient fighter already has. If this happens, Smashline will panic.
Ex. Attempting to clone WEAPON_KIND_LUIGI_FIREBALL onto Mario will panic.
Similarly, if you try to clone the same weapon onto one fighter with different names, smashline will panic.
Ex. Cloning WEAPON_KIND_GANON_SWORD onto Mario as mario_sword, then attempting to clone WEAPON_KIND_GANON_SWORD onto Mario as mario_sword2 will panic.
If clone_weapon is called using the same name, however, it will instead print a warning that you have cloned this weapon with this name, and will return that clone's weapon_id and generate_id.
Ex. Cloning WEAPON_KIND_GANON_SWORD onto Mario as mario_sword, then attempting to clone WEAPON_KIND_GANON_SWORD onto Mario as mario_sword will not create a new clone, and instead return the first clone's data.