IPB

Welcome Guest ( Log In | Register )

HowTo: Create Pickup Kits, Demonstrates how to create custom pickup kits and add them to maps
_O2_
post Jul 17 2007, 09:18 PM
Post #1


Generation Kill
****

Group: Soldiers
Posts: 297
Joined: 18-September 06
From: Australia
Member No.: 2,168



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 http://bfeditor.org/forums/index.php?showtopic=3867. 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.


Attached File(s)
Attached File  Objects_server.zip ( 1.84K ) Number of downloads: 297
 
Go to the top of the page
 
+Quote Post
2 Pages V   1 2 >  
Start new topic
Replies (1 - 14)
SatNav
post Jul 17 2007, 11:00 PM
Post #2


Cesar
*******

Group: Banned
Posts: 6,918
Joined: 24-June 05
Member No.: 752



great tutorial _O2_. bigthumb.gif
@admins maybe sticky this?
Go to the top of the page
 
+Quote Post
imtheheadhunter
post Jul 17 2007, 11:04 PM
Post #3


Debug assertion failed! Text:people == stupid!
Group Icon

Group: Mr. Admin
Posts: 1,005,138
Joined: 8-March 06
From: The freaking Twilight zone!
Member No.: 1,609



QUOTE(SatNav @ Jul 18 2007, 01:00 AM) [snapback]80408[/snapback]

@admins maybe sticky this?


i second that.

and i think the stickys should be merged into 1 or 2 threads, IMO they take up too much space in the page.


--------------------
Go to the top of the page
 
+Quote Post
DasRoach
post Jul 18 2007, 03:59 AM
Post #4


Monkey Magic
*****

Group: Soldiers
Posts: 1,484
Joined: 7-January 05
From: New Zealand
Member No.: 468



very good post O2 smile.gif
this is the same technique used in AIX, I tip my hat to mschoeldgen and the others who managed to get this awesome feature working biggrin.gif


--------------------

The distance between insanity and genius is measured only in success
Go to the top of the page
 
+Quote Post
Drifterboy
post Jul 18 2007, 04:49 AM
Post #5


^ the properway to headbang ^
****

Group: Soldiers
Posts: 647
Joined: 13-January 07
From: South Aussie
Member No.: 2,929



that was way easier to understand than the "spawning kits the '42 way"

good work _O2_


--------------------
Go to the top of the page
 
+Quote Post
MasterChiefRulZ
post Jul 18 2007, 01:14 PM
Post #6


You know the drill...
Group Icon

Group: Mr. Admin
Posts: 10,444
Joined: 31-December 03
From: Home
Member No.: 48



QUOTE(imtheheadhunter @ Jul 18 2007, 01:04 AM) [snapback]80409[/snapback]

QUOTE(SatNav @ Jul 18 2007, 01:00 AM) [snapback]80408[/snapback]

@admins maybe sticky this?


i second that.

and i think the stickys should be merged into 1 or 2 threads, IMO they take up too much space in the page.

You're right. I'll try to condense all these stickies down within the next few days. smile.gif


--------------------
Go to the top of the page
 
+Quote Post
mschoeldgen
post Aug 1 2007, 10:11 AM
Post #7


Major
****

Group: Soldiers
Posts: 740
Joined: 26-September 04
From: Berlin
Member No.: 410



Placement of the Kits is be considerably easier when you enter the Kitname into your /bf2editor/mods/<YourMod>/LevelEditor/ObjectSpawnerDef.con
Once in that list it will appear in the initial dialogue for ObjectSpawners ( and show up in the map at once ) Thanks to takiwa for that hint biggrin.gif


--------------------
http://www.xww2.com Reviving the past on todays game engine
Go to the top of the page
 
+Quote Post
The Bone Collect...
post Mar 15 2008, 02:55 AM
Post #8


Enlisted
*

Group: Soldiers
Posts: 12
Joined: 12-July 07
Member No.: 3,512



Sorry to revive a post but:

QUOTE
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


Doesn't seem to do a thing with ANY weapons in the latest patch.
Any ideas on how to remedy this?
Go to the top of the page
 
+Quote Post
_O2_
post Mar 15 2008, 04:29 AM
Post #9


Generation Kill
****

Group: Soldiers
Posts: 297
Joined: 18-September 06
From: Australia
Member No.: 2,168



QUOTE(The Bone Collector @ Mar 15 2008, 06:55 PM) *
Doesn't seem to do a thing with ANY weapons in the latest patch.
Any ideas on how to remedy this?


Works fine with BF2 running the 1.41 patch - might want to run through the steps again and make sure you haven't missed something.
Go to the top of the page
 
+Quote Post
The Bone Collect...
post Mar 15 2008, 05:36 AM
Post #10


Enlisted
*

Group: Soldiers
Posts: 12
Joined: 12-July 07
Member No.: 3,512



Yep, i missed it alright. I'm supposed to mod the Objects Server not Objects Client >.<
Sorry for the trouble O2. Good tutorial smile.gif
Go to the top of the page
 
+Quote Post
wurzelsepp
post Mar 20 2008, 09:15 AM
Post #11


Lt. Colonel --<D4MiCH>--
****

Group: Soldiers
Posts: 377
Joined: 29-December 06
Member No.: 2,850



thx o2 thats great!!!

really easy and useful....

This post has been edited by wurzelsepp: Mar 20 2008, 09:15 AM


--------------------
Another bad guy bites the dust, am I good or am I good? - Operation Flashpoint
Go to the top of the page
 
+Quote Post
BigNate37
post Apr 25 2008, 08:17 PM
Post #12


Enlisted
*

Group: Soldiers
Posts: 11
Joined: 9-April 08
From: Regina, SK
Member No.: 4,837



I'm having trouble getting this to work in Special Forces.

I did everything the same (using Ghost Town as the map) except two things:
  1. There was no tmp.con file. I checked, and Ghost Town's Init.con was still invoking tmp.con the same way as Gulf of Oman's does, so I simply created the tmp.con file and then added the prescribed line.
  2. I tried to put the pickup kit in place of both artillery guns (each side has only one). I used slightly different code to acommodate the different map objects, and I think I did it right despite my ignorance in modding. See below for the exact changes.
QUOTE(text removed)
rem [ObjectSpawnerTemplate: singleplayer_16p_GT_WaterStation_ART]
ObjectTemplate.create ObjectSpawner singleplayer_16p_GT_WaterStation_ART
ObjectTemplate.activeSafe ObjectSpawner singleplayer_16p_GT_WaterStation_ART
ObjectTemplate.modifiedByUser "armandoma"
ObjectTemplate.isNotSaveable 1
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.setObjectTemplate 1 ARS_D30
ObjectTemplate.minSpawnDelay 360
ObjectTemplate.maxSpawnDelay 360
ObjectTemplate.teamOnVehicle 1

...

rem [ObjectSpawnerTemplate: singleplayer_16p_GT_Suburbs_ART]
ObjectTemplate.create ObjectSpawner singleplayer_16p_GT_Suburbs_ART
ObjectTemplate.activeSafe ObjectSpawner singleplayer_16p_GT_Suburbs_ART
ObjectTemplate.modifiedByUser "armandoma"
ObjectTemplate.isNotSaveable 1
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.setObjectTemplate 2 USART_LW155
ObjectTemplate.minSpawnDelay 360
ObjectTemplate.maxSpawnDelay 360
ObjectTemplate.teamOnVehicle 1

QUOTE(text added)
rem [ObjectSpawnerTemplate: singleplayer_16p_GT_WaterStation_ART]
ObjectTemplate.create ObjectSpawner singleplayer_16p_GT_WaterStation_ART
ObjectTemplate.activeSafe ObjectSpawner singleplayer_16p_GT_WaterStation_ART
ObjectTemplate.modifiedByUser "armandoma"
ObjectTemplate.isNotSaveable 1
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.setObjectTemplate 1 PICKUP_US_LongRangeSniper
rem ObjectTemplate.setObjectTemplate 1 ARS_D30
rem ObjectTemplate.minSpawnDelay 360
rem ObjectTemplate.maxSpawnDelay 360
rem ObjectTemplate.teamOnVehicle 1

...

rem [ObjectSpawnerTemplate: singleplayer_16p_GT_Suburbs_ART]
ObjectTemplate.create ObjectSpawner singleplayer_16p_GT_Suburbs_ART
ObjectTemplate.activeSafe ObjectSpawner singleplayer_16p_GT_Suburbs_ART
ObjectTemplate.modifiedByUser "armandoma"
ObjectTemplate.isNotSaveable 1
ObjectTemplate.hasMobilePhysics 0
ObjectTemplate.setObjectTemplate 2 PICKUP_US_LongRangeSniper
rem ObjectTemplate.setObjectTemplate 2 USART_LW155
rem ObjectTemplate.minSpawnDelay 360
rem ObjectTemplate.maxSpawnDelay 360
rem ObjectTemplate.teamOnVehicle 1


I'm guessing that the number between ObjectTemplate.setObjectTemplate and the name of the kit is the team number for that object, which shouldn't matter for a pickup kit.


Anyways, what happens is both artillery guns are gone (no complaints) but there are no kits in their place. I've tried spamming the 'get' key over the entire area which was formerly covered by the gun, with no luck. I'm running this in windowed debug mode, and it worked fine. I was hoping to exand upon this by creating pickup kits with Special Forces gear, which should be easy for me once I get this working.

Edit: Ah yes, obligatory apologies for grave digging. I figured it would be better than starting a new thread since this is a sticky.

This post has been edited by BigNate37: Apr 25 2008, 08:19 PM


--------------------
Go to the top of the page
 
+Quote Post
BigNate37
post Apr 29 2008, 07:47 PM
Post #13


Enlisted
*

Group: Soldiers
Posts: 11
Joined: 9-April 08
From: Regina, SK
Member No.: 4,837



QUOTE(BigNate37 @ Apr 25 2008, 08:17 PM) *
I'm having trouble getting this to work in Special Forces.

I did everything the same (using Ghost Town as the map) except two things:
  1. There was no tmp.con file. I checked, and Ghost Town's Init.con was still invoking tmp.con the same way as Gulf of Oman's does, so I simply created the tmp.con file and then added the prescribed line.
  2. I tried to put the pickup kit in place of both artillery guns (each side has only one). I used slightly different code to acommodate the different map objects, and I think I did it right despite my ignorance in modding. See below for the exact changes.

I'm guessing that the number between ObjectTemplate.setObjectTemplate and the name of the kit is the team number for that object, which shouldn't matter for a pickup kit.


Anyways, what happens is both artillery guns are gone (no complaints) but there are no kits in their place. I've tried spamming the 'get' key over the entire area which was formerly covered by the gun, with no luck. I'm running this in windowed debug mode, and it worked fine. I was hoping to exand upon this by creating pickup kits with Special Forces gear, which should be easy for me once I get this working.


Well I've confirmed that #1 isn't the problem. You can also run the kit's con file from right in Init.con where tmp.con is run, but whichever way you run the con file if you do it wrong you get a CTD so that's not my problem.

The number for ObjectTemplate.setObjectTemplate is definately the team number; this is used to spawn appropriate vehicles based on which team controls the CP. Probably doesn't matter as long as it's the same as the arty, but it didn't hurt to put a line in for each team (which is what PoE 2.1 does).

I put the arty guns back temporarily to raise them a meter, swapping in the pickup kit code again. That still didn't work, ruling out the idea that the kits were stuck under ground.



In fact, the only part that I haven't become an expert in is 1.3 aboveā€”I don't know what collision meshes are or what they do. I'm guessing that's the problem because I've done everything else in this tutorial for other personal hacks, and it's been going well. Can anyone offer some advice?


--------------------
Go to the top of the page
 
+Quote Post
mschoeldgen
post Nov 18 2008, 03:44 AM
Post #14


Major
****

Group: Soldiers
Posts: 740
Joined: 26-September 04
From: Berlin
Member No.: 410



Here's a few more hints on the pickup kits. One of them is only of concern if you modelled your own soldier kits , which probably most of the mods don't but we had to.

1. Pickup Kits always spawn in the 0/0/0 rotation . Any placement in other rotations won't work , the kits always revert to a zero rotation in the game. We have to live with that. Point your mappers attention to this fact.

2. If you have the problem of the pickup kit geometry sticking through the soldier body after he picked it up this is related to a wrong export of your standard soldier kits. They need to be in a hierachy with the same system as DICE used it. An example of a working kit hierachy has been posted at bfeditor.org in the hierachy help thread.

3. A pickup kit can switch the geometry of the soldier who took it. E.g. if you have a Sniper Kit as pickup, its 'kitGeometry' parameter can be used to switch the soldiers kit to the sniper outfit.


--------------------
http://www.xww2.com Reviving the past on todays game engine
Go to the top of the page
 
+Quote Post
Milleuros
post Nov 18 2008, 06:25 AM
Post #15


Major
****

Group: Soldiers
Posts: 780
Joined: 23-February 08
From: Switzerland
Member No.: 4,604



QUOTE(mschoeldgen @ Nov 18 2008, 10:44 AM) *
1. Pickup Kits always spawn in the 0/0/0 rotation . Any placement in other rotations won't work , the kits always revert to a zero rotation in the game. We have to live with that. Point your mappers attention to this fact.


Wrong, I could rotate them on my maps.


--------------------
Hoping the English was correct
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 24th November 2017 - 02:16 PM