The year is 2142 and the dawn of a new ice age has thrown the world into a panic. The soil not covered by ice can only feed a fraction of the Earth's population. The maths is simple and brutal: some will live, most will die. In Battlefield 2142, players choose to fight for one of two military superpowers - the European Union or the newly formed Pan Asian Coalition - in an epic battle for survival.

Post tutorial Report RSS How to Create Pickup Kits

Tutorial by _O2_ on BFSP Forums. This tutorial tells you how to create in-game pickup kits.

Posted by on - Basic UI/HUD

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).

At the bottom of this post you will find an attachment which contains the
CollisionMesh you can use for any pickup kit, as well as an example US
Long Range Sniper pickup kit. The following explains the steps taken to
create the example kit.

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, 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 (see attachment):

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:

CODE
ObjectTemplate.create Kit US_Sniper


With this line:

CODE
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

The CollisionMesh was created by mschoeldgen and kindly made freely available at Bfeditor.org. This thread also contains information on how to get your pickup kits into the bf2 editor if you prefer using the editor.

After this line:

CODE
ObjectTemplate.cullRadiusScale 2.4


Insert these lines:

CODE
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:

CODE
ObjectTemplate.addTemplate USRIF_M24


With this line:

CODE
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:

CODE
ObjectTemplate.geometry US_Kits


with this line:

CODE
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:

CODE
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:

CODE
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:

CODE
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:

CODE
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:

CODE
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.

The Download

Post comment Comments
Kenetics
Kenetics - - 19 comments

Thanks for the tutorial! :D
Spent a long time wondering why bf2 was crashing when I added a extra kit to the kits folder. Turned out the file name and the "ObjectTemplate.create Kit" was different.

Reply Good karma Bad karma+1 vote
performance
performance - - 5 comments

how to add flamethower on battlefield 2 for i can use it

Reply Good karma Bad karma+1 vote
Roam1982
Roam1982 - - 15 comments

nice thanks

Reply Good karma Bad karma+1 vote
fighterpil
fighterpil - - 75 comments

Thanks for the great tutorial! I'm curious, would it be possible to make pickup kits randomly spawn in different locations, like in PUBG?

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: