View Full Version : Custom Kits
Sars99
04-11-2007, 09:25 PM
i did a search and it didn't come to anything
heres what i'm attempting to do
i would like to be able to change the weapons for certain kits.
for example i have been trying to get the US AT soldier with a M16a2
ObjectTemplate.create Kit US_sars_AT
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.kitType AT
ObjectTemplate.aiTemplate AT
ObjectTemplate.geometry US_Kits
ObjectTemplate.geometry.kit 3
ObjectTemplate.geometry.dropGeom 13
ObjectTemplate.networkableInfo KitInfo
ObjectTemplate.setHasCollisionPhysics 1
ObjectTemplate.unlockIndex 0
ObjectTemplate.cullRadiusScale 2.4
rem -------------------------------------
ObjectTemplate.addTemplate USATP_Predator
ObjectTemplate.addTemplate USPIS_92FS
ObjectTemplate.addTemplate kni_knife
ObjectTemplate.addTemplate UnlockUSAT
ObjectTemplate.addTemplate UnlockUSAT2
ObjectTemplate.addTemplate usrif_m16_a2
ObjectTemplate.addTemplate ParachuteLauncher
my mod is called sars_mod and its for my SP needs (like when the accounts went down)
both the file name and the kit name are the same [US_sars_AT]
and i have copied the file objects\kits\US_sars_AT.con into both the client and server.zip's in the level that i'm editing
and also in the levels init.con file added this line
run objects\kits\US_sars_AT.con
can someone tell me where i've gone wrong, or if i'm completely off course tell me step by step how to do this
thx sars
Zuke`
04-11-2007, 10:00 PM
This is how the code should look (this along with the rest of the code)
*this is done to the tweak file (Objects_Server) of US_AT
rem -------------------------------------
ObjectTemplate.addTemplate USATP_Predator
ObjectTemplate.addTemplate kni_knife
ObjectTemplate.addTemplate UnlockUSAT
ObjectTemplate.addTemplate UnlockUSAT2
ObjectTemplate.addTemplate USRIF_m16_a2
ObjectTemplate.addTemplate USPIS_92FS
ObjectTemplate.addTemplate ParachuteLauncher
rem -------------------------------------
then save that to your objects_server/kits/US/US_AT
don't worry about the order of the weapons, it may be off because I used code from yours below and from my mod to make the code here, but it doesn't matter.
By the way, you never need to change the objects_client items unless you are changing skins and the like, because those are in the client objects. (Yes, just changing the objects_server will work, don't worry).
You changing the level properties is not doing anything more than increasing the chances of a crash. Leave the level files alone unless that is what you are editing ;)
****Note*****
this will not happen in the code above, but be warned:
Make sure if you are going to have multiple changes in the loadout for each kit, you check the weapon index's for each weapon to ensure you don't have repeats.
Example:
The m24 and the m95 both have a weapon index of 3
if they are placed together, they will cause the game to crash
to prevent this, go and change the weapon index of the m95 to 8 (no other weapon is defaulted to 8). This will allow you to use both at the same time.
Hope this helps ;)
***P.S.
While gathering the code for you, BF2 decided that I had modified my game files.
Now I must reinstall and repatch... thanks :P
Sars99
04-12-2007, 01:45 PM
firstly your welcome :)
secondly i managed to do that now thx
i now have on singleplayer
karkand
with Germans vs Insurgents
the germans have
spec-ops: G-36C
sniper: L96a1 (which is now one hit kill, and 10 rounds per mag as it should do)
assualt: G-3A3
Support: MG-36
Medic: G-36K (modified to have one hit kill with headshot)
Anti-Tank: HK33A3
also working on a GB army based on the SAS
spec-ops: M4
sniper: L96
assualt: Sa80/AG-36
support: Hk21
Medic: L85a1
AT: L85a1
one thing i was interested in was 'making' my own weapons
what i mean is by editing the stuff in objects_server so i could make a L86 LSW, which would be the current L85 but with modified mag sizes and to act more like an MG... is this possible???
also is there a way to get the option of unlocks in 1.41 so i could have the MG36 as the main weapon then the SAW as the 'unlock'
EDIT:::
shouldn't touch the level files unless thats what your editing
thats what i am editing, like each map has there own new armies and setups
like ghost is SAS (soon to be GB) vs the rebels from surge, who have AK-47s and a PKM
EDIT2::: could i make my own army by giving them there own folder in objects_server.zip\kits\new army name??? then would those relate to this code
gameLogic.setTeamName 1 "MEC"
gameLogic.setTeamName 2 "EU"
gameLogic.setTeamLanguage 1 "Mec"
gameLogic.setTeamLanguage 2 "German"
gameLogic.setTeamFlag 0 "flag_neutral"
gameLogic.setTeamFlag 1 "flag_mec"
gameLogic.setTeamFlag 2 "flag_eu"
gameLogic.setKit 1 0 "MEC_Specops" "mec_light_soldier"
gameLogic.setKit 2 0 "SAS_Sars_Specops" "eu_soldier"
gameLogic.setKit 1 1 "MEC_Sniper" "mec_light_soldier"
gameLogic.setKit 2 1 "EU_Sniper" "eu_soldier"
where i could have the names of the kits like german_sniper???
and which line is it to change the magnification of a sniper scope?? jsut the M82a1's scope dont zoom that much
Zuke`
04-12-2007, 09:22 PM
You could probably rename everything, make sure you have the objects_server and object_client of your weapon, then go through and change all the .cons to include your new .tweaks....
If you need a more detailed explanation just PM later or whatever...
Magnification:
rem ---BeginComp:DefaultZoomComp ---
ObjectTemplate.createComponent DefaultZoomComp
ObjectTemplate.zoom.zoomDelay 0.08
ObjectTemplate.zoom.zoomLod 1
ObjectTemplate.zoom.addZoomFactor 0
ObjectTemplate.zoom.addZoomFactor 0.8
rem ---EndComp ---
You can also add more zoom factors to make a double zoom and the like.
To get unlocks to work (I'll use the AT kit because I have it up, change the parts of the code to this)
ObjectTemplate.create ItemContainer UnlockUSAT
ObjectTemplate.addTemplate gunyouwant
ObjectTemplate.unlockLevel 1
ObjectTemplate.create ItemContainer UnlockUSAT2
ObjectTemplate.addTemplate unlocknumber2
ObjectTemplate.replaceItem default gun
ObjectTemplate.replaceItem firstunlock
ObjectTemplate.unlockLevel 2
For your new army, I have yet to try that.
My best guess would be to edit an existing army, rather than creating a new one, then go through and change the files to match the new army name.
jdrou
04-12-2007, 10:02 PM
To get unlocks to work (I'll use the AT kit because I have it up, change the parts of the code to this)
ObjectTemplate.create ItemContainer UnlockUSAT
ObjectTemplate.addTemplate gunyouwant
ObjectTemplate.unlockLevel 1
ObjectTemplate.create ItemContainer UnlockUSAT2
ObjectTemplate.addTemplate unlocknumber2
ObjectTemplate.replaceItem default gun
ObjectTemplate.replaceItem firstunlock
ObjectTemplate.unlockLevel 2
For your new army, I have yet to try that.
My best guess would be to edit an existing army, rather than creating a new one, then go through and change the files to match the new army name.
That will change what the unlocks are, but you still won't be able to use the unlocks in the mod. The only ways I know to get real selectable unlocks offline are to run an unpatched BF2 or set up a fake account server that your game would look at instead of the real one. If you run an unranked server online I believe there is a setting to enable unlocks.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.