X Tutup

A MOD that focuses on vehicle combat and functional expansion.

Post tutorial Report RSS DZB2 Kit Weapon Modifying

Guidance on modifying weapons, Kit, and adding maps for DZB2 MOD

Posted by on - Advanced Other

This article will guide you on modifying the soldier KIT system and weapon equipment of the DZB2 MOD, as well as how to add maps to the MOD.

!!!WARNING!!!

Back up your files before making any modifications, just in case!!!

Part 1: Soldier KIT and Weapon Modification


Take US Assault as an example, open Content\SoldiersKits_server.zip\Kits\US\US_Assault.con

You will see the code as follows:


rem -------------------------------------
rem ----------------1
ObjectTemplate.addTemplate kni_knife
rem ----------------2
ObjectTemplate.addTemplate wf_m9
rem ----------------3
ObjectTemplate.addTemplate wf_ar15
rem ----------------4
ObjectTemplate.addTemplate ushgr_m67
rem ----------------5
ObjectTemplate.addTemplate bf4_smaw
rem ----------------6
ObjectTemplate.addTemplate hm_point_index6
rem ----------------7

rem ----------------8
ObjectTemplate.addTemplate nsrif_crossbow
rem -------------------------------------

ObjectTemplate.addTemplate ParachuteLauncher

This part adds the default weapons and equipment that do not require unlocking. They are displayed as the default equipment of the US Assault soldier in the game, and the corresponding unlock icons of the weapons are listed first in the unlock interface.

ObjectTemplate.addTemplate wf_m9
rem ----------------3
ObjectTemplate.addTemplate wf_ar15
rem ----------------4
ObjectTemplate.addTemplate ushgr_m67
rem ----------------5
ObjectTemplate.addTemplate bf4_smaw



Then, the following code section is for adding unlockable items to US Assault.

2dwa


Take the code UnlockUS_k3s1w2 (the blue selected part in the reference) as an example and find the corresponding code for adding this unlockable weapon in the following code.

5f


As you can see, the second unlock item adds the F2000 assault rifle, and the first one is the TYPE97. Then, the HUD arrangement of these weapons in the game is in the corresponding order.

ks2

As shown in the reference, the default AR15 assault rifle is ranked first. You should understand their arrangement rule. Of course, the same applies to weapons and equipment in other sections.

For example, for the pistol section, you can see the code for adding unlockable weapons to the pistol slot in US Assault:

6


And the corresponding code below:

7


As you can see, the first unlock item is an M1911, and the second one is an M93R, while the default M9 pistol is added in the code mentioned at the beginning.

Similarly, their corresponding UI relationship in the game follows the same order.

ks3

The same logic applies to other equipment. However, note that not all slots have the same number of available unlocks. As you may notice in the reference, the primary weapon has 1 default weapon and 20 unlock slots (some of the later unlock slots are not enabled, which are the green code positions in the reference; you can add the code by yourself, and detailed instructions will be provided below), while the pistol section has 1 default weapon and 13 unlock slots.

For the remaining two optional unlockable secondary equipment, they only have 1 default weapon and 6 unlock slots each, as shown in the reference.

ks4

You should now be able to find and understand their corresponding code in US_Assault.con by yourself.

Alright, you should now understand how this Kit system adds weapons.

But this only adds weapons to the Kit. Since this Kit system is not native to BF2, it cannot directly read the images of these weapons. You also need to modify the corresponding UI images in menu_server.zip!

Similarly, taking US Assault as an example above, to modify the unlock weapon UI interface images of this soldier, open:

menu_server.zip\HUD\HudSetup\AGMCustomization\Icons\usk3.con

You will see the following code:

3


Obviously, this code corresponds one-to-one with the code in the soldier's Kit section mentioned earlier.

The UI image referenced by WeaponIconUSk3s1w2 is wf_f2000.tga (the actual format can be .dds), which exactly corresponds to the unlockable weapon F2000 added by the code section UnlockUS_k3s1w2 mentioned earlier.

As you can see, "USk3s1w2" in WeaponIconUSk3s1w2 corresponds to "US_k3s1w2" in UnlockUS_k3s1w2, with only one symbol difference. I believe you can understand the correspondence by now.

Of course, this image should point to the actual path of the weapon selection image of this weapon. For the F2000 weapon, the path is Ingame/Weapons/Icons/Hud/wf_f2000.tga.

However, not all weapon selection images are stored in this path. Some weapons by the author are stored in the path Ingame/Weapons/Icons/Hud/Selection, and the image names themselves are not consistent with the weapon code names. You need to pay attention to these details. For the specific code, please check the content referenced by the line:

ObjectTemplate.weaponHud.selectIcon 

in the specific weapon Tweak document.

For default weapons, their corresponding UI image codes are WeaponIconUSk3s1w0, WeaponIconUSk3s2w0, WeaponIconUSk3s3w0, WeaponIconUSk3s4w0 and so on.

For example, the code section in the reference:

hudBuilder.createPictureNode us_kits_split WeaponIconUSk3s1w0 2000 0 128 32
hudBuilder.setPictureNodeTexture Ingame/Weapons/Icons/Hud/wf_ar15.tga
hudBuilder.setNodeShowVariable KitsShow

This code section corresponds to the UI image of the default AR15.

Of course, this is for the US Assault soldier. For soldiers of other factions, the code is similar. For example, for CH AT, you can see that the UI codes of its default weapons are WeaponIconCHk7s1w0, WeaponIconCHk7s2w0, WeaponIconCHk7s3w0, WeaponIconCHk7s4w0. Similarly, the codes of unlockable weapons and their corresponding UI codes become like this:

Unlock section:

UnlockCH_k7s1w1

UnlockCH_k7s2w1

UnlockCH_k7s3w1

……

UI section:

WeaponIconCHk7s1w1

WeaponIconCHk7s2w1

WeaponIconCHk7s2w1

……

Among them, the correspondence between factions and soldier types is obvious. US, CH, MEC, EU in the code sections represent the four factions, and k1, k2, k3……k7 represent the 7 corresponding soldier types from top to bottom, as shown in the reference.

ks1

This is the correspondence for the US faction, and the same applies to other factions.

Obviously, US Assault corresponds to usk3, and US_AT corresponds to usk7. The same logic applies to soldiers of other factions.

When you need to modify UI images, you can find the corresponding section.

It should be noted here that you will find that there is actually only the UN faction in the MOD, and no EU faction. Yes, this is a special correspondence. Because this Kit system is fully developed based on the four factions of the original BF2, the original code names use the original names. And the DZB2 mod is based on AIX2. Therefore, the EU code section in DZB2 corresponds to the actual UN faction.

That is, UN_Assault corresponds to euk3. Similarly, the codes of its unlock items correspond to UnlockEU_k3………

The same applies to other soldiers of the UN faction.

And when you need to modify the UI, you should open the documents named euk.

Alright, the principle of the Kit system has been briefly explained.

Next is modifying and replacing existing weapons or adding new (unlockable) weapons.

Weapon Replacement Section


Still taking US Assault as an example. If you need to modify its default weapon.

For example, changing the AR15 assault rifle to the AK12 assault rifle already available in the MOD:

Open Content\SoldiersKits_server.zip\Kits\US\US_Assault.con, and change:

ObjectTemplate.addTemplate wf_ar15

to:

ObjectTemplate.addTemplate wf_ak12

Then open menu_server.zip\HUD\HudSetup\AGMCustomization\Icons\usk3.con, and find:

hudBuilder.setPictureNodeTexture Ingame/Weapons/Icons/Hud/wf_ar15.tga

change it to:

hudBuilder.setPictureNodeTexture Ingame/Weapons/Icons/Hud/wf_ak12.tga

In this way, the replacement of the default weapon is completed.

The same applies to other unlock items. For example, changing the unlockable F2000 assault rifle of US Assault to a MINIGUN machine gun:

Find the code section:

ObjectTemplate.create ItemContainer UnlockUS_k3s1w2
ObjectTemplate.addTemplate wf_f2000
ObjectTemplate.unlockLevel 2

Then change:

ObjectTemplate.addTemplate wf_f2000

to:

ObjectTemplate.addTemplate EMZPJ_Terror4000_MiniGun

Similarly, modify the image in the UI. In usk3.con, find:

hudBuilder.createPictureNode us_kits_split WeaponIconUSk3s1w2 2000 0 128 32
hudBuilder.setPictureNodeTexture Ingame/Weapons/Icons/Hud/wf_f2000.tga
hudBuilder.setNodeShowVariable KitsShow

Change the line:

hudBuilder.setPictureNodeTexture Ingame/Weapons/Icons/Hud/wf_f2000.tga

to:

hudBuilder.setPictureNodeTexture Ingame/Weapons/Icons/Hud/ EMZPJ_Terror4000_MiniGun.tga

The same logic applies to other weapons.

All weapons of soldiers from other factions follow the same code rules!

Adding New Weapons

As mentioned earlier, some unlock slots are not yet used. You can enable them to add new unlockable weapons in the game.

For example, taking the first option (Slot1 in the reference) of US Assault as an example, there are 5 remaining slots.

Enable the first empty slot, which is the 16th unlock slot: UnlockUS_k3s1w16.

Open Content\SoldiersKits_server.zip\Kits\US\US_Assault.con, and find:

ObjectTemplate.addTemplate UnlockUS_k3s1w13
ObjectTemplate.addTemplate UnlockUS_k3s1w14
ObjectTemplate.addTemplate UnlockUS_k3s1w15

Insert a new line of code below ObjectTemplate.addTemplate UnlockUS_k3s1w15:

ObjectTemplate.addTemplate UnlockUS_k3s1w16

After modification, it should be as shown in the reference:

ObjectTemplate.addTemplate UnlockUS_k3s1w13
ObjectTemplate.addTemplate UnlockUS_k3s1w14
ObjectTemplate.addTemplate UnlockUS_k3s1w15
ObjectTemplate.addTemplate UnlockUS_k3s1w16

Then, create code to add the corresponding unlockable weapon at the corresponding position below.

Find:

ObjectTemplate.create ItemContainer UnlockUS_k3s1w15
ObjectTemplate.addTemplate wf_hk433
ObjectTemplate.unlockLevel 15
Add the new code below it:

ObjectTemplate.create ItemContainer UnlockUS_k3s1w16
ObjectTemplate.addTemplate new_weapon_code
ObjectTemplate.unlockLevel 16


Among them, new_weapon_code is the code of the new weapon you add.

In the code ObjectTemplate.unlockLevel 16, the final number can be any number between 1 and 99 that does not duplicate with the numbers of existing unlock items in the soldier's Kit. It is recommended that you fill it in according to the similar rules of the existing code.

Then open menu_server.zip\HUD\HudSetup\AGMCustomization\Icons\usk3.con, and find:

hudBuilder.createPictureNode         us_kits_split WeaponIconUSk3s1w16 2000 0 128 32
hudBuilder.setPictureNodeTexture      Ingame/Weapons/Icons/Hud/noweapon.tga
hudBuilder.setNodeShowVariable      KitsShow

Change the image referenced in the line:
hudBuilder.setPictureNodeTexture      Ingame/Weapons/Icons/Hud/noweapon.tga

to the weapon selection UI image of the new weapon you add.

Similarly, if you want to add a new unlockable weapon in Item 2 (pistol):

Enable the first empty slot, which is the 12th unlock slot: UnlockUS_k3s8w12.

Open Content\SoldiersKits_server.zip\Kits\US\US_Assault.con, and find:

ObjectTemplate.addTemplate UnlockUS_k3s2w9
ObjectTemplate.addTemplate UnlockUS_k3s2w10
ObjectTemplate.addTemplate UnlockUS_k3s2w11

Insert a new line of code below ObjectTemplate.addTemplate UnlockUS_k3s2w11:

ObjectTemplate.addTemplate UnlockUS_k3s2w12

Then similarly, add the code at the corresponding position below:

ObjectTemplate.create ItemContainer UnlockUS_k3s2w12
ObjectTemplate.addTemplate new_weapon2_code
ObjectTemplate.unlockLevel 22

Then modify the corresponding UI in menu_server.zip.

!!! Important Notes !!!


  • The letters in the newly added code such as UnlockUS_k3s1w16 must strictly follow the uppercase and lowercase specifications of the existing code.

You cannot write it as unLOCKus_K3S1W16 or anything else. The uppercase and lowercase of each letter in the corresponding position must be strictly consistent!!! Otherwise, the Kit system cannot recognize it and the game may crash. Similarly, the ending numbers must also be arranged in the corresponding order. The same applies to unlock items in other slots.

  • As mentioned earlier, there are 5 remaining slots in Slot 1, so you can add up to UnlockUS_k3s1w20. Even if you add UnlockUS_k3s1w21 or UnlockUS_k3s1w999, the system will not recognize and make it effective.

The same applies to other slots. For example, the pistol slot has 2 remaining slots, so you can add up to UnlockUS_k3s2w13. For the third and fourth equipment, there is only 1 remaining slot each, so you can only add up to UnlockUS_k3s3w6 and UnlockUS_k3s4w6 respectively.

  • You may notice that for Unlock Item 2 (pistol slot), Item 3 and Item 4, the numbers following s in their UnlockUS_k3s?w? code sections also correspond: s2 refers to Item 2 (pistol slot), s3 refers to Equipment 3, and s4 refers to Equipment 4. When you add new unlock items, you should pay attention to these differences and add the code correctly.

This set of code rules applies to all soldiers and weapons of other factions. Observe carefully and you can find the pattern. Unlock items between different factions and soldiers are independent of each other and do not affect one another. Of course, you can see that I use the same weapons for them, which is just for the convenience of unified management. You can completely set different unlockable weapons for each faction.

  • You don't need to worry about duplicate numbers in ObjectTemplate.itemIndex of unlockable weapons. They can be any number between 1 and 8. You can place a weapon with any itemIndex value in any unlock slot. I distinguish them by item only for the convenience of management and aesthetics. In fact, you can place a primary weapon with itemIndex 3 in the pistol slot, or a zipline with itemIndex 8 in the rocket launcher slot. If you do this, the actual unlocked weapon will take precedence over the last option you select. This only applies to unlockable weapons!

The itemIndex of default weapons still cannot duplicate with that of other default weapons, otherwise the game will crash without an error when loading the map.



Because this MOD has added a large number of weapons that are loaded simultaneously in a single game, which has occupied a lot of memory, this MOD must set the "LIGHTING" option in the graphics settings to "Medium" in DirectX 9 mode of Windows10/11 to save some memory for map loading, otherwise the game will crash due to insufficient memory.

(For Windows XP/7 systems, this option can be set to "High" because the old systems have better support for DirectX 9 and can utilize more memory)

Of course, if possible, I recommend that you use the DXVK plugin on Windows10/11. For the usage method, see the Summary section on the main page of this MOD.


The existing files of this MOD retain the old version of weapons, but I have made some modifications to these weapons, mainly reducing the polygon count of Geom 1. So when you see BOTs holding these weapons, they will look relatively rough. However, Geom0, the model in the player's first-person view, remains unchanged.

If you need to use these weapons, open Content\_old_Weapons_client.zip and Content\_old_Weapons_server.zip, and put the corresponding weapon folders into the same path in Content\Weapons_client.zip and Content\ Weapons_server.zip.

For example, enable the MCX SPEAR assault rifle in the old version files:

Open _old_Weapons_client.zip\Weapons\Handheld, find the MCXSPEAR folder, and put the entire folder into Weapons_client.zip\Weapons\Handheld.

The same operation applies to _old_Weapons_server.zip and Weapons_server.zip.

Open _old_Weapons_server.zip\Weapons\Handheld, find the MCXSPEAR folder, and put the entire folder into Weapons_server.zip\Weapons\Handheld.

Then, you can equip soldiers with this weapon according to the method of modifying or adding weapons mentioned earlier.

Deleting Existing Unlock Items

Taking US Assault as an example, delete the 15th unlockable weapon HK433 in the first item:


Open Content\SoldiersKits_server.zip\Kits\US\US_Assault.con, and delete the corresponding code in SoldiersKits_server.zip:

Open and delete:

ObjectTemplate.addTemplate UnlockUS_k3s1w15

and

ObjectTemplate.create ItemContainer UnlockUS_k3s1w15
ObjectTemplate.addTemplate wf_hk433
ObjectTemplate.unlockLevel 15

Then you can delete the HK433 assault rifle unlockable for this soldier. The same applies to other weapons.

Modify the corresponding code in menu_server.zip,

note!!! Modify, do not delete!!!

Open menu_server.zip\HUD\HudSetup\AGMCustomization\Icons\usk3.con, and find:

hudBuilder.createPictureNode         us_kits_split WeaponIconUSk3s1w15 2000 0 128 32
hudBuilder.setPictureNodeTexture      Ingame/Weapons/Icons/Hud/wf_hk433.tga
hudBuilder.setNodeShowVariable      KitsShow


Change the line:

hudBuilder.setPictureNodeTexture      Ingame/Weapons/Icons/Hud/wf_hk433.tga

to:

hudBuilder.setPictureNodeTexture      Ingame/Weapons/Icons/Hud/noweapon.tga


Modify this line of code to make the game UI display a 🚫 symbol, do not delete it! Otherwise, the game will report an error and crash.

The above is all the guidance for modifying the Kit section.


Part 2: Adding New Maps to the MOD

This MOD is compatible with all original BF2 and AIX2 maps. Third-party maps are not guaranteed to run.

Open the map's server.zip\Init.con.

  • Add the Kit system guide code:

Add a line of code at a suitable position above the line gameLogic.setTeamName ……

run ../../common/Scripts/AGMCustomization/function/loader.con team1_kits_split team2_kits_split

Among them, team1 and team2 should be the actual faction names of the two sides of this map. For example, for a map of CH VS US, it should actually be:

run ../../common/Scripts/AGMCustomization/function/loader.con ch_kits_split us_kits_split

You can check the lines:

gameLogic.setTeamName 1 "…"
gameLogic.setTeamName 2 "…"

to know the corresponding factions.

Note!!! As mentioned earlier, the UN faction actually corresponds to the EU code, so if there is a UN faction here, you need to write eu_kits_split.

For example, for a map of MEC VS UN, it should be:

run ../../common/Scripts/AGMCustomization/function/loader.con mec_kits_split eu_kits_split

  • Modify Soldier Kit References

For the original BF2 or other third-party maps, you need to change the soldier and KIT codes used by the map to the soldier and KIT codes of AIX2.

For example, in the original version, the soldiers and KITs used for CH VS US are:

gameLogic.setKit 1 0 "CH_Specops" "ch_light_soldier"
gameLogic.setKit 2 0 "US_Specops" "us_light_soldier"

gameLogic.setKit 1 1 "CH_Sniper" "ch_light_soldier"
gameLogic.setKit 2 1 "US_Sniper" "us_light_soldier"

gameLogic.setKit 1 2 "CH_Assault" "ch_heavy_soldier"
gameLogic.setKit 2 2 "US_Assault" "US_heavy_soldier"

gameLogic.setKit 1 3 "CH_Support" "ch_heavy_soldier"
gameLogic.setKit 2 3 "US_Support" "US_heavy_soldier"

gameLogic.setKit 1 4 "CH_Engineer" "ch_light_soldier"
gameLogic.setKit 2 4 "US_Engineer" "us_light_soldier"

gameLogic.setKit 1 5 "CH_Medic" "ch_light_soldier"
gameLogic.setKit 2 5 "US_Medic" "us_light_soldier"

gameLogic.setKit 1 6 "CH_AT" "ch_heavy_soldier"
gameLogic.setKit 2 6 "US_AT" "US_heavy_soldier"

You need to change them to:

gameLogic.setKit 1 0 "CH_Specops" "ch_Specops_soldier"
gameLogic.setKit 2 0 "US_Specops" "us_Specops_soldier"

gameLogic.setKit 1 1 "CH_Sniper" "ch_Sniper_soldier"
gameLogic.setKit 2 1 "US_Sniper" "us_Sniper_soldier"

gameLogic.setKit 1 2 "CH_Assault" "ch_Assault_soldier"
gameLogic.setKit 2 2 "US_Assault" "us_Assault_soldier"

gameLogic.setKit 1 3 "CH_Support" "ch_Support_soldier"
gameLogic.setKit 2 3 "US_Support" "us_Support_soldier"

gameLogic.setKit 1 4 "CH_Engineer" "ch_Engineer_soldier"
gameLogic.setKit 2 4 "US_Engineer" "us_Engineer_soldier"

gameLogic.setKit 1 5 "CH_Medic" "ch_Medic_soldier"
gameLogic.setKit 2 5 "US_Medic" "us_Medic_soldier"

gameLogic.setKit 1 6 "CH_AT" "ch_AT_soldier"
gameLogic.setKit 2 6 "US_AT" "us_AT_soldier"

Pay attention to the order of TEAM1 and TEAM2. For the codes of other factions, refer to other maps with different factions in the MOD.

This MOD will automatically replace the original BF2 or AIX2 vehicles with the same model vehicles in the MOD, or other vehicles of the same type by default. If you need precise vehicle replacement, please search for tutorials on modifying map vehicles by yourself, which have been written by predecessors and will not be repeated here.

This guide ends here. I hope you can understand all the above content and modify this MOD according to your own preferences. Wish you a good game!


Translated by AI, please forgive any errors.

Post comment Comments
CF2.0
CF2.0 - - 86 comments

好欸!

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account:

X Tutup