Create custom pickup kits

By O2

This post aims to give an example of how you can create custom pickup kits and add them to maps fairly easily (bf2 editor not required).


1.0 - Creating the Pickup Kit

Determine what kind of kit you want to create, based on the different soldier kits/classes in the game. For our example we are going to create a Sniper kit.

1.1 - Start with a template

We want to create a Sniper kit for the US team, as an example, which means we want to copy the contents of the following file:



Objects_server.zip\Kits\US\US_Sniper.con

Into our own custom file



Objects_server.zip\Kits\PICKUP\PICKUP_US_LongRangeSniper.con

1.2 - Renaming the Kit

We now have a template to work with for our custom pickup kit. We need to change a few things to get it working. First, we need to rename the kit to our custom kit, as follows:

Replace this line:


ObjectTemplate.create Kit US_Sniper

With this line:



ObjectTemplate.create Kit PICKUP_US_LongRangeSniper


Notice that the name we replaced US_Sniper with is the same as our kit's .con file.

1.3 - Adding the CollisionMesh

Choose your collison mesh and it for your weapon.

Note: This thread alsocontains information on how to get your pickup kits into the bf2 editor if you prefer using the editor.

After this line:



ObjectTemplate.cullRadiusScale 2.4


Insert these lines:



rem ---------------CollisionMesh----------------------
ObjectTemplate.collisionMesh small_collonly0
ObjectTemplate.mapMaterial 0 collision_material 76
ObjectTemplate.physicsType Point

rem ---------------/CollisionMesh---------------------


1.4 - Modifying kit items (weapons)

In our example, we're going to replace the standard M24 with the M95 Barrett, as follows:

Replace this line:



ObjectTemplate.addTemplate USRIF_M24


With this line:



ObjectTemplate.addTemplate ussni_m95_barret


1.4.1 - Adding a weapon geometry (optional)

If you would prefer to see the actual weapon on the ground, instead of a soldier's kit, then replace this line:



ObjectTemplate.geometry US_Kits


with this line:



ObjectTemplate.geometry ussni_m95_barret


Note that by default if you replace a PCO on a map with this, then the weapon may well be half submerged in the ground. To remedy this, you need to edit the Y value of the 'Object.absolutePosition X/Y/Z' for the ObjectSpawner you are using (adding .2 to .3 to the Y value seems to work well).


1.5 - Removing the unlocks

AFAIK, it won't hurt to leave the unlocks in the .con file, but they only work on ranked servers anyway so you might as well go ahead and remove them:

Delete the following lines:



ObjectTemplate.addTemplate UnlockUSSniper
ObjectTemplate.addTemplate UnlockUSSniper2
...
ObjectTemplate.create ItemContainer UnlockUSSniper
ObjectTemplate.addTemplate ussni_m95_barret
ObjectTemplate.unlockLevel 1

ObjectTemplate.create ItemContainer UnlockUSSniper2
ObjectTemplate.addTemplate gbrif_l96a1
ObjectTemplate.replaceItem USRIF_M24
ObjectTemplate.replaceItem ussni_m95_barret
ObjectTemplate.unlockLevel 2


1.6 - Save the file

Save the file and we're done. We've now created a US Long Range Sniper pickup kit. The next step is getting it into a map.

2.0 - Getting Our Pickup Kit Into a Map

This is a little more tricky. First off, without using the editor we are limited to replacing an existing PCO (e.g. Stinger/Igla/TOW/Artillery Cannon, etc). In this example we're going to replace the US Artillery Cannon (USART_LW155) with our US Long Range Sniper Kit on Gulf of Oman SP 16 (vanilla).

2.1 - Getting our map to load custom objects

You've probably seen this before in a number of maps which have been released on BFSP. This is a process which allows us to load custom objects (vehicles, weapons, etc) for a particular map.

First off, we're going to extract the server.zip for Gulf of Oman so we can modify it. Go ahead and extract it to your temp directory.

2.2 - Modifying tmp.con to load our custom pickup kit

Open \Server\tmp.con and add the following line:



run Objects\Kits\PICKUP\PICKUP_US_LongRangeSniper.con


This line tells the game that when we load up this map we want it to include our pickup kit.

2.3 - Creating a ServerArchives.con file

Create a new text file \Server\ServerArchives.con and open it. Now add the following line:



fileManager.mountArchive Levels/gulf_of_oman/Objects_Server.zip Objects


Save and close the file. This file tells the game to mount the archive which contains our custom pickup kit. OK, almost done, all we have to do now is place the pickup kit on the map.

2.4 - Replacing a PCO with a Pickup Kit

Here's where we're going to replace the US Artillery Cannon with our pickup kit. Open the file \Server\GameModes\sp1\16\GamePlayObjects.con and replace this:



rem [ObjectSpawnerTemplate: CPNAME_GO_SP16_beach_ART]
ObjectTemplate.create ObjectSpawner CPNAME_GO_SP16_beach_ART
ObjectTemplate.activeSafe ObjectSpawner CPNAME_GO_SP16_beach_ART
ObjectTemplate.modifiedByUser nla
ObjectTemplate.isNotSaveable 1
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.setObjectTemplate 2 USART_LW155
ObjectTemplate.minSpawnDelay 260
ObjectTemplate.maxSpawnDelay 360
ObjectTemplate.holdObject 1
ObjectTemplate.teamOnVehicle 1


with this:



rem [ObjectSpawnerTemplate: CPNAME_GO_SP16_beach_ART]
ObjectTemplate.create ObjectSpawner CPNAME_GO_SP16_beach_ART
ObjectTemplate.activeSafe ObjectSpawner CPNAME_GO_SP16_beach_ART
ObjectTemplate.modifiedByUser nla
ObjectTemplate.isNotSaveable 1
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.setObjectTemplate 2 PICKUP_US_LongRangeSniper
rem ObjectTemplate.setObjectTemplate 2 USART_LW155
rem ObjectTemplate.minSpawnDelay 260
rem ObjectTemplate.maxSpawnDelay 360
rem ObjectTemplate.holdObject 1
rem ObjectTemplate.teamOnVehicle 1


Save and close the file. Now you will need to re-zip all the files under \Server\*.* into a zip file called Server.zip.

2.5 - Deploying our map

All that is left to do is deploy our map. First make sure you have made a backup copy of the original Server.zip for Gulf of Oman, and once you have done that go ahead and copy your new Server.zip to '\mods\BF2\levels\gulf_of_oman\Server.zip'.

Now copy our custom Objects_Server.zip (see attachment) to '\mods\BF2\levels\gulf_of_oman\Objects_Server.zip'.

That should be it. Fire up Gulf of Oman SP 16, join US and spawn at the beach. Then go have a look where the US Artillery Cannon used to be and you should see a soldier's kit sitting there. Walk up to it and press your 'get key', just like you would to pick up a fallen soldier's kit.

Have fun.

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