Post tutorial RSS BF2 Modding Tutorial

Basic BF2 Modding Tutorial based on what I have learned

Posted by on - Basic Server Side Coding

On the HUD:

* To disable names above soldiers: Add the line "renderer.drawNametags 0" to the init.con file in the mods folder

* To make flags visible/invisible on the map: Open the "Levels" folder & then the map you want to tweak. There, open "server.zip" & go to "GameModes". Look for the one you want & open "GamePlayObjects.con". Scroll down to the flags (almost at the end) & when you find the flag you want, add the line "ObjectTemplate.showOnMinimap 0" at the end to make that flag invisible on the map, or remove it to make it visible again.

On the AI:

* To set number of bots per map: Go to the AI folder inside the mods folder, open the AIDefaults file, the file itself tells you what to do in the 1st lines.

* To make the AI shoot better or worse: Go to the AI folder inside the mods folder, open the AIDefaults file & set the "aiSettings.setBotSkill" line to 1.0 for the highest accuracy or 0.X for something lower

* To make the AI aproach the targets only as much as necessary (only works for infantry): You have to tweak each ranged weapon individually. Inside the mods folder, open "Objects_server.rar", "weapons", "handheld", open a weapons folder, open the "ai" folder, open the file inside & set the "weaponTemplate.optimalRangePercentage" line to 99.

* To make AI infantry more prone to take cover: Open the same file of the previous point & set the "weaponTemplate.setFiringPose" line to "Lying"

* To set at which range bots will use a weapon: Open the same file of the previous 2 points & set the distance in the "weaponTemplate.maxRange" line, the equivalency is meters. For vehicle-mounted weapons, the file you need to edit might be in the "vehicles" folder instead of the "weapons" folder (inside that specific vehicles folder) if not, it should be in either the "armament" or the "stationary" folders inside the weapons folder

* To make ai pilots stop abandoning transport helis in-flight: Open the chopper's folder inside the objects_server .zip file. There open the .tweak file % look for the line "ObjectTemplate.setSoldierExitLocation -2/-0.2/0 0/0/0" (the numbers may vary), the line is repeated many times in the file, one for each position, pilot is usually 1st. Under the line add the line "ObjectTemplate.dontAllowExit 1" That makes both ai & player unable to exit, it can be applied to any position

* To make bots man and stay longer on stationary weapons: Try increasing the temperature for the weapon in the "aiTemplate.basicTemp #" line in the object.ai file. Im not 100% sure it works.

* To disable bots attacking with defibrillators: Open the defibrillator's "weapons.ai" file & set the strength against infantry to 1.0

* To make bots unable to shoot a weapon through smoke: You have to tweak each weapon individually. Open Objects_server.zip, search for each weapon & open the ai folder inside each one, there open weapons.ai & add the line "weaponTemplate.setFiresThroughTransparent 0" at the bottom. Im not 100% sure this is how it works

On the game:

* To set the number of tickets(points) each side gets: Enter the "levels" folder inside your mods folder, open the folder of a specific map, then the .zip file "server" & there open the file "init". There you can set the number you want in a series of lines, the 1st of which is "gameLogic.setDefaultNumberOfTicketsEx 16 1". When you play that map the number of tickets for both sides will be twice the number set in the file, I dont know why.

* To set how long it takes for dropped kits to disappear: Inside the mod´s folder open "objects_server.rar". Inside open "kits" & look for the one you want to change. Open the .con file & at the bottom of the 1st paragraph add the line: "ObjectTemplate.timeToLiveAfterDeath 75". Change the numbers to whatever you want (equivalent to seconds)

* To better ai spawning off the squadleader (supposedly): Inside Objects_server.zip/soldiers/Common/common.con rem the line "ObjectTemplate.setScatterSpawnPositions 1"

* To set who owns which flag at the beginning: Open any maps folder at the Levels folder & open "server.rar/GameModes/sp1(usually)/X/GamePlayObjects.con". There you have to scroll down almost to the bottom of the file to look for the flags, each one is under a "ObjectTemplate.addTemplate flagpole" line. To set ownership of a flag you must add the line: "ObjectTemplate.team 1(or 2)" under the line "ObjectTemplate.radius X". To quickly check which side is 1 & which 2 for each map, open the "init.con" file inside "server.rar" & scroll down just a little bit.

* To choose which flags are "cappable": You must tweak the same file that in the previous point. There, under each flag, the line: "ObjectTemplate.unableToChangeTeam 1" must be present for the flag to be "uncappable" or absent for it to be a normal flag.

* To set the "capping" range of a flag: You must tweak the same file that in the previous point. Under the flag you want to edit, look for the "ObjectTemplate.radius" line & change the value as you wish.

* To set infantry moving speed/jump height: Edit the file "Objects\soldiers\Common\Common.con". But reducing the walking & sprinting speed (phy-soldier-speed-factor #) disables the 1p sprinting animation, I havent found the solution yet.

* To change a map's description: You will find it in Levels/(map name)/Info/(map name).txt. Its the text between the 2 <briefing> markers. Just write what you want

* To change how long dead bodies stay before disappearing: Go to "Objects_server.rar/soldiers" look for a soldier you'd like to change & open it's tweak file & look for the line: "ObjectTemplate.armor.TimeToStayAsWreck". Change the value to whatever you want. I think it's equivalent to seconds. Setting to -1 makes them last forever, but this causes lag

* To change how effective ammo-kits/med-kits/wench are: Go to: Objects_server.zip/weapons/handheld/wench(for example) & open the .tweak file. The line: ObjectTemplate.ammo.abilityStrength sets how many hp it restores with each "hit". The line: ObjectTemplate.ammo.abilityDrain set how much each "hit" tires the user. The "radius" line changes exactly that (in meters). I don't know what the other lines do yet.

On the Weapons:

* To set the damage of a weapon: Look for the weapon's folder in "objects_server.rar" & open the tweak file. There, look for the lines:

"ObjectTemplate.minDamage x
ObjectTemplate.damage x
ObjectTemplate.distToStartLoseDamage x
ObjectTemplate.distToMinDamage x"

I think these lines are pretty self-explanatory. I have noticed that the damage of BF2s combat knife in-game seems to be like 4 times the value set in the file, I dont know why.

On the Vehicles:

* To set which camera views are available when pressing "cycle camera" button: Open the "ObjectsServer" zip file in the mods folder. Search for the specific vehicles folder & open the .tweak file. Search for the "Camera_RotationRpm" lines for the different positions & under each one add:
ObjectTemplate.CVMNose 1
ObjectTemplate.CVMChase 1
ObjectTemplate.CVMFrontChase 0
ObjectTemplate.CVMFlyBy 0

If you want only 1st & 3rd person, for example. "Nose"=1st person, "chase"=3rd person, "front chase"=rear view

* To set how long destroyed vehicles last before self-exploding: Open the objects_server.rar file, go to "vehicles" & look for the one you want to tweak (might also be in "booster_server.rar"). Inside the vehicle´s folder open the tweak file, look for the "ObjectTemplate.armor.timeToStayAsWreck" line & set the number you want (equivalent to seconds, -1 makes it stay forever)

* To set how long it takes for vehicles to respawn: It must be done map by map. Inside the mod´s folder go to the levels folder & there to any map´s folder. Open the "server.zip" file & there go to gamemodes, sp1, 16(for example) & there open the "gameplayobjects.con" file. In the file you will see a paragraph for each spawnpoint for vehicles, emplaced guns & command structures. At the bottom of any you want to tweak, add the lines:

ObjectTemplate.minSpawnDelay 360
ObjectTemplate.maxSpawnDelay 360

if they are not there already. Change the numbers to whatever you want (equivalent to seconds, I don´t know what happens when adding 2 different numbers to the 2 lines)

* To choose which vehicle(or defensive weapon) spawns where: You need to open a specific level folder, then open "server.rar/GameModes/sp1(usually)/16(or another)/GamePlayObjects.con". There, you will find a list of the spawn points for vehicles & defensive weapons. they usually have 2 lines that go like this:

ObjectTemplate.setObjectTemplate 1 xxx
ObjectTemplate.setObjectTemplate 2 xxx

The 1st line selects the vehicle for side 1 & the second for side 2, to see which side is which you must open "init.con" inside "server.rar". You can change the vehicles, delete a line so only 1 side will get vehicles from that point, or delete both lines so that no vehicle will spawn there. You supposedly can do the same things with defensive weapons, but I wouldnt tinker too much with those. To change these spawn points you need to use the editor.

* To make a vehicle belong to a faction even when its unmanned: You must choose a map & open the same file as in the previous point, there look for the spawning point of the vehicle you want to tweak, & under the last lines, usually:

ObjectTemplate.minSpawnDelay x
ObjectTemplate.maxSpawnDelay x

Add the line: "ObjectTemplate.teamOnVehicle 1" This makes it so that the vehicle(s) that spawn there belong to the faction that owns that flag. I imagine the same should apply to static weapons, if tweaked the same way.

Comments
56region
56region

Thanks for your advice. Now even I can not leave the helicopter or the tank ...)

Reply Good karma Bad karma+1 vote
X1Destroy
X1Destroy

Do you know how to make AI always try to get inside the gun slot of attack heli?

How to make them use the TV-guided missile?

Reply Good karma Bad karma+1 vote
56region
56region

In the AI ​​file of the car you need, specify the temperature above 100 for example or 150 for the arrow's place. And the bots will jump there very quickly.

Reply Good karma Bad karma+1 vote
BF2_SP_Freak_on_weed Author
BF2_SP_Freak_on_weed

Thanks for that

Reply Good karma+1 vote
BF2_SP_Freak_on_weed Author
BF2_SP_Freak_on_weed

Sorry, I didnt see your comment until now, I dont know but check here: Classic-battlefield-modding.fandom.com

Reply Good karma+1 vote
Guest
Guest

This comment is currently awaiting admin approval, join now to view.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.