by SGT Prof

his tutorial will help you to add new weapon to BF2/mod. 

Actually is this tut is similar to previously called ,,create your BF2 kit". I would suggest to read it before doing what I want explain here: Moddb.com

This action requires notepad or wordpad

Here you go. First you must find what weapon you would like to add. For start probably you would like to try something. Check for custom content here: Bf2.gamebanana.com  (or in our own Community mini-mods section )  --mcr

Then you downloaded (zip, winrar) files, extract archives and drop weapon foldier on desktop. 


Open: Bf2/ mods/ your mod/ objects_server/ weapons
Open: Bf2/ mods/ your mod/ objects_client/ weapons

if weapon have custom HUD icon then you need add it to menu client:



Open: Bf2/ mods/ your mod/ Menu_client/ HUD/ Texture/ Ingame/ weapons/ icons/ HUD

Open: Bf2/ mods/ your mod/ Menu_client/ HUD/ Texture/ Ingame/ weapons/ icons/ HUD/ selection


put HUD icon to right places

KITS EDITING:

Open: Bf2/ mods/ your mod/ objects_server/ kits (make sure your kit is not read-only mode). Click right mouse and check. 

Okay, now make sure you realy have done all previous steps and new weapon already exists in your weapons foldiers (2 places). 

Open selected kit and now you must know what item index it have. 

? how check ?

- open your custom weapon tweak with notepad and find thise line:



rem -------------------------------------
ObjectTemplate.addTemplate S_M24_Fire1P
ObjectTemplate.setPosition 0/0.0251192/0.617667
ObjectTemplate.addTemplate S_M24_Fire1P_Outdoor
ObjectTemplate.setPosition 0/0.0259557/0.620327
ObjectTemplate.addTemplate S_M24_Fire3P
ObjectTemplate.setPosition 0/0.0248084/0.616961
ObjectTemplate.addTemplate S_M24_BoltClick
ObjectTemplate.setPosition 0/0.0228307/-0.165919
ObjectTemplate.addTemplate S_M24_TriggerClick
ObjectTemplate.setPosition 0/-0.0405023/-0.183669
ObjectTemplate.addTemplate S_M24_SwitchFireRate
ObjectTemplate.addTemplate S_M24_Reload1P
ObjectTemplate.addTemplate S_M24_Reload3P
ObjectTemplate.addTemplate S_M24_Deploy1P
ObjectTemplate.addTemplate S_M24_Deploy3P
ObjectTemplate.addTemplate S_M24_Zoom
ObjectTemplate.setPosition 0/0.0284011/-0.141757
ObjectTemplate.addTemplate e_muzz_sniper
ObjectTemplate.setPosition 0/0.0271032/0.612798
ObjectTemplate.addTemplate e_shellejection_rifle
ObjectTemplate.setPosition -0.00302492/0.0299253/-0.0828321
ObjectTemplate.setRotation -3.4436/3.75679/1.22417
rem -------------------------------------
ObjectTemplate.animationSystem1P Objects/Weapons/Handheld/USRIF_M24/AnimationSystem1p.inc
ObjectTemplate.animationSystem3P Objects/Weapons/Handheld/USRIF_M24/AnimationSystem3p.inc
ObjectTemplate.projectileTemplate M24_Projectile
ObjectTemplate.velocity 1000
ObjectTemplate.itemIndex 3 

ObjectTemplate.delayToUse 1.6


Now be sure to replace weapon with the same item index. For example if you got primary custom (new) weapon (item index 3), you must replace it with old primary weapon (item index 3). 

You can do same thing with pistols, but now item index will be with number 2. 

Notes: You can't add more then 9 weapons for one kit. EVERY WEAPON MUST HAVE DIFERENT ITEM INDEX OR YOUR GAME MUST CRASH. For example: Knife- intem indiex 1, pistol- item index 2, assault rifle- item index 3....

all weapons must be different in kit, e.g. in kit not recommended have two ak47...

Crash fix:

Possible bugs: Game crash at textures loading or after load in menu you see white weapon icon. It means that something is wrong with weapon icon. 

How add working, but vBF2 (not same weapon icon for test) ?

Open your custom weapon tweak and copy icon code from other exsiting and working (default) weapon. 

Like this:



ObjectTemplate.weaponHud.weaponIcon Ingame\Weapons\Icons\Hud\M24.tga
ObjectTemplate.weaponHud.altWeaponIcon Ingame\Weapons\Icons\Hud\M24.tga

ObjectTemplate.weaponHud.selectIcon Ingame\Weapons\Icons\Hud\M24.tga


If mod still crash after edit and you don't know reason, run BF2 mod in windowed mode.

Right click on scortcut and you will see something like this:



E:\Battlefield2\BF2.exe +menu 1 +fullscreen 1


set to: 



E:\Battlefield2\BF2.exe +menu 1 +fullscreen 0


Then you will get error massage and will know why mod crash. 

Set 0 to 1 if you want fullscreen back. 

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