Cloning A Weapon (and Modding It A Little)

By kay


This tutorial will show you how to clone a weapon in BF2. The example will be the "chpis_qsz92", the Chinese standard Sidearm.


Step #1 - getting the necessary files:


Open "/mods/bf2/objects_server.zip", look for the weapon you want to mod in "/weapons/handheld/" and copy the folder called "chpis_qsz92" to your working directory.


Step #2 - cleaing up the workspace:


Remove the subdirectories called "ai", "Animations" and "meshes" as well as the files called "AnimationSystem1p.inc", "AnimationSystem3p.inc" and "Weapon.desc".


Step #3 - naming the weapon:


Rename the files "chpis_qsz92.con" and "chpis_qsz92.tweak" to something else, since I'm building a flaregun, I called them "deecyne_flaregun.com" and "deecyne_flaregun.tweak".


Step #4 - naming the weapon cont'd:


Go up a directory and change the name of the directory (which is: "chpis_qsz92") to the name of your ".con" and ".tweak" files, then change back into the directory and make the files *writeable*.


Step #5 - changing the weapon's templates:


Now open up the "deecyne_flaregun.con" file in a text editor and change this:


ObjectTemplate.create GenericFireArm chpis_qsz92

to


ObjectTemplate.create GenericFireArm deecyne_flaregun

and


include chpis_qsz92.tweak

to


include deecyne_flaregun.tweak

now, remove the following line:


GeometryTemplate.create BundledMesh chpis_qsz92

Step #6 - saving your changes:


Save the file and close it. Then open "deecyne_flaregun.tweak".


Step #7 - tweaking your weapon:


The changes you will have to make to the "deecyne_flaregun.tweak" depend on the things you want to accomplish. I'm trying to make a flaregun, so my changes would be:


ObjectTemplate.ammo.nrOfMags 8

ObjectTemplate.ammo.magSize 15

to


ObjectTemplate.ammo.nrOfMags 2

ObjectTemplate.ammo.magSize 45

as well as:


ObjectTemplate.itemIndex 2

to


ObjectTemplate.itemIndex 1

Since I'm not using a knife, I'm utilizing the empty slot for the flaregun, you might need to adjust the *itemIndex* to your needs.


These are just a few settings, you might need / want to change a lot more, maybe the damage or deviation, killmessage - it's all in there and waiting to be modded.


Step #8 - changing the projectile:


Since this is a flaregun, we'll have to adjust the projectile that gets fired by the weapon:


ObjectTemplate.projectileTemplate chpis_qsz92_Projectile

becomes:


ObjectTemplate.projectileTemplate deecyne_flaregun_Projectile

and


ObjectTemplate.create GenericProjectile chpis_qsz92_Projectile

becomes:


ObjectTemplate.create GenericProjectile deecyne_flaregun_Projectile

Step #9 - adjusting the damage:


It's a flaregun and, while these weapons are able to inflict damage in real-life, this version won't be able to:


ObjectTemplate.minDamage 8

ObjectTemplate.damage 20

gets changed to:


ObjectTemplate.minDamage 0

ObjectTemplate.damage 0

Step #10 - changing the sound settings:


Next step is to change the sound file template name to the one we use for the weapon, the easiest thing to do is to use the "search & replace" function of your text editor and replace:


S_chpis_qsz92_

with


S_deecyne_flaregun_

Don't forget to save the file in the meantime!


Note on Steps #11 - #13:


You only need to follow the next few steps if you want your weapon to have a different projectile. If you just wanted to clone a weapon, you're done now and should move to step #14.


Step #11 - modding the projectile (appearance):


This section isn't yet done. Currently, the following is planned:


* discuss how to change the projectile's appearance


Step #12 - modding the projectile (speed):


* discuss how to change the projectile's speed


Step #13 - modding the projectile (timetolive):


* discuss how to change the projectile's timetolive


Step #14:


Finally, save all the open files, close them, then put them into "/mods/yourmod/objects_server.zip/Weapons/handhelds".


Attach your new weapon to a kit (make sure to use the right name) and fire up the game to see how the weapon works for you.


final words and modded files:


A huge "thank you" goes out to Harry from #bfeditor on irc://irc.gamesurge.net/ who helped me with just about everything.

Community content is available under CC-BY-SA unless otherwise noted.