Classic Battlefield Modding Wikia
Advertisement

By Dnamro

First of all, I user the term "Common Handweapon AI" to mean that I have one file that has all the AI templates for the different types of hand weapons. This makes it a lot easier to customize and balance the hand weapon AI. A mod can have a wide variety of hand weapons, but there are really only a few different types and they need to be set up consistently so the bots will use the weapons properly. This way it is really easy to add extra weapons to the mod and you can customize the AI gameplay how you want it. For example, since bots don't run out of ammo, you can have the bots use a variety of weapons based on distance to make it seem more realistic. Also it you have the bots use pistols up close, they will be less lethal than if they used the main weapon all the time. You can also customize the weapon AI to the map. So, if you had a night map, for example, you could have the bots use the handweapons at much shorter ranges. The special purpose weapons (Heal, revive, Ammo, repair) should be set to a strategic strength depending on the priority that you want the bots to use. I generally set them to a low priority because I want the bots fight first and then do healing, reviving, repairing or Supplying after the firefight.

Note: The strength command (weaponTemplate.setStrength) is a relative value, usually between 0 and 20.


Setting up: In the handweapon object folder, I added a weapon.AI file with all the custom handweapon AI templates in \custom_handweapon_AI folder. Each template needs to have a unique name and then each handweapon needs to be assigned on of the Aitemplate names in this file.

The types of hand weapons are generally:

Knifes - melee range only. bots don't are very ineffective with knives. I recommend not enabling by setting the knives with a 0 range and 0 strength so they won't try to use it.

pistols - short range.

shotguns - short range. If the shotgun kit has a pistol

rifle - medium range

sniper - In this case, it would look more realistic to have the sniper use a pistol at short ranges and the sniper rifle at medium and long ranges.

rocket launcher - Set this to a narrow range so the bots don't rocket spam

grenades - Set this to a very narrow range so the bots don't grenade spam.


Here is a example Common AI folder from a BF2142 mod:


rem *****************

rem *** Common AI ***

rem *****************

weaponTemplate.create melee_weapon_AI

weaponTemplate.weaponType CloseCombat

weaponTemplate.indirect 0

weaponTemplate.minRange 0.0

weaponTemplate.maxRange 2.0

weaponTemplate.optimalRangePercentage 80

weaponTemplate.setFiringPose Standing

weaponTemplate.setStrength Infantry    15.0

weaponTemplate.setStrength LightArmour 0.0

weaponTemplate.setStrength HeavyArmour 0.0

weaponTemplate.setStrength NavalArmour 0.0

weaponTemplate.setStrength Helicopter  0.0

weaponTemplate.setStrength AirPlane    0.0

weaponTemplate.setSoundSphereRadius    0.0

weaponTemplate.deviation 0

weaponTemplate.create deployer_AI

weaponTemplate.weaponType FireAndForget

weaponTemplate.shouldRearm 0

weaponTemplate.minRange 40.0

weaponTemplate.maxRange 100.0

weaponTemplate.optimalRangePercentage 70

weaponTemplate.setFiringPose Crouching

weaponTemplate.setStrength Infantery    10.1

weaponTemplate.setStrength LightArmour 0.0

weaponTemplate.setStrength HeavyArmour 0.0

weaponTemplate.setStrength NavalArmour 0.0

weaponTemplate.setStrength Helicopter  0.0

weaponTemplate.setStrength AirPlane    0.0

weaponTemplate.setFiresThroughTransparent 0

rem *** Ammo ***

weaponTemplate.create ammobox_resupply_AI

weaponTemplate.weaponType Ammo

weaponTemplate.minRange 0.0

weaponTemplate.maxRange 60.0

rem *** Repair ***

weaponTemplate.create repair_vehicle_AI

weaponTemplate.weaponType Repair

weaponTemplate.minRange 0.0

weaponTemplate.maxRange 60

rem *** medic defib ***

weaponTemplate.create defib_revive_AI

weaponTemplate.weaponType Revive

weaponTemplate.minRange 0.0

weaponTemplate.maxRange 5.0

rem *** Heal ***

weaponTemplate.create heal_trooper_AI

weaponTemplate.weaponType Healing

weaponTemplate.minRange 0.0

weaponTemplate.maxRange 60.0

rem *** deploy mine ***

weaponTemplate.create mine_drop_AI

rem weaponTemplate.weaponType C4

weaponTemplate.indirect 0

weaponTemplate.minRange 0.0

weaponTemplate.maxRange 30.0

weaponTemplate.isThrown 1

weaponTemplate.optimalRangePercentage 1

weaponTemplate.setStrength Infantry    2.0

weaponTemplate.setStrength LightArmour 1.0

weaponTemplate.setStrength HeavyArmour 0.0

weaponTemplate.setStrength NavalArmour 0.0

weaponTemplate.setStrength Helicopter  0.0

weaponTemplate.setStrength AirPlane    0.0

weaponTemplate.setSoundSphereRadius    30.0

rem *** Pistol

weaponTemplate.create pistol_AI

weaponTemplate.indirect 0

weaponTemplate.minRange 2.1

weaponTemplate.maxRange 30.0

weaponTemplate.optimalRangePercentage 35

weaponTemplate.setFiringPose Crouching

weaponTemplate.setStrength Infantry    6.0

weaponTemplate.setStrength LightArmour 2.0

weaponTemplate.setStrength HeavyArmour 1.0

weaponTemplate.setStrength NavalArmour 0.0

weaponTemplate.setStrength Helicopter  0.0

weaponTemplate.setStrength AirPlane    0.0

rem***  rifle (e11c, dlt19, MG15, bowcaster, a280)

weaponTemplate.create rifle_AI

weaponTemplate.indirect 0

weaponTemplate.minRange 2.1

weaponTemplate.maxRange 200.0

weaponTemplate.optimalRangePercentage 35

weaponTemplate.setFiringPose Crouching

weaponTemplate.setStrength Infantry    8.0

weaponTemplate.setStrength LightArmour 3.0

weaponTemplate.setStrength HeavyArmour 2.0

weaponTemplate.setStrength NavalArmour 1.0

weaponTemplate.setStrength Helicopter  1.0

weaponTemplate.setStrength AirPlane    1.0

weaponTemplate.allowedDeviation 15.0

weaponTemplate.deviationCorrectionTime 1

weaponTemplate.deviation 0.1

rem  Sniper (e17d, disrupter)

weaponTemplate.create sniper_rifle_AI

weaponTemplate.weaponType Sniper

weaponTemplate.indirect 0

weaponTemplate.minRange 100.0

weaponTemplate.maxRange 300.0

weaponTemplate.optimalRangePercentage 70

weaponTemplate.setFiringPose Lying

weaponTemplate.setStrength Infantry    12.0

weaponTemplate.setStrength LightArmour 0.0

weaponTemplate.setStrength HeavyArmour 0.0

weaponTemplate.setStrength NavalArmour 0.0

weaponTemplate.setStrength Helicopter  0.0

weaponTemplate.setStrength AirPlane    0.0

weaponTemplate.deviation 0.1

rem Heavy rifle (T21, MK1)

weaponTemplate.create heavy_rifle_AI

weaponTemplate.indirect 0

weaponTemplate.minRange 30.1

weaponTemplate.maxRange 100.0

weaponTemplate.optimalRangePercentage 50

weaponTemplate.setFiringPose Lying

weaponTemplate.setStrength Infantry    11.0

weaponTemplate.setStrength LightArmour 4.0

weaponTemplate.setStrength HeavyArmour 2.0

weaponTemplate.setStrength NavalArmour 0.0

weaponTemplate.setStrength Helicopter  0.0

weaponTemplate.setStrength AirPlane    0.0

weaponTemplate.allowedDeviation 15.0

weaponTemplate.deviationCorrectionTime 1

weaponTemplate.deviation 0.1

rem *** shotgun (flechette, CR1)

weaponTemplate.create shotgun_AI

weaponTemplate.indirect 0

weaponTemplate.minRange 2.1

weaponTemplate.maxRange 30.0

weaponTemplate.optimalRangePercentage 35

weaponTemplate.setFiringPose Crouching

weaponTemplate.setStrength Infantry    8.0

weaponTemplate.setStrength LightArmour 1.0

weaponTemplate.setStrength HeavyArmour 0.0

weaponTemplate.setStrength NavalArmour 0.0

weaponTemplate.setStrength Helicopter  0.0

weaponTemplate.setStrength AirPlane    0.0

weaponTemplate.deviation 0.1

rem *** rocket launcher  HH15, demp15, demp

weaponTemplate.create rocket_launcher_AI

weaponTemplate.minRange 10.0

weaponTemplate.maxRange 160.0

weaponTemplate.optimalRangePercentage 35

weaponTemplate.setFiringPose Crouching

weaponTemplate.setStrength Infantry    3.0

weaponTemplate.setStrength LightArmour 6.0

weaponTemplate.setStrength HeavyArmour 8.0

weaponTemplate.setStrength NavalArmour 0.0

weaponTemplate.setStrength Helicopter  2.0

weaponTemplate.setStrength AirPlane    1.0

weaponTemplate.setFiresThroughTransparent 0

rem *** grenade launcher PMG

weaponTemplate.create grenade_launcher_AI

weaponTemplate.minRange 10.0

weaponTemplate.maxRange 100.0

weaponTemplate.optimalRangePercentage 35

weaponTemplate.setFiringPose Crouching

weaponTemplate.setStrength Infantry    8.0

weaponTemplate.setStrength LightArmour 4.0

weaponTemplate.setStrength HeavyArmour 1.0

weaponTemplate.setStrength NavalArmour 0.0

weaponTemplate.setStrength Helicopter  0.0

weaponTemplate.setStrength AirPlane    0.0

weaponTemplate.setFiresThroughTransparent 0

rem *** grenade ***

weaponTemplate.create grenade_AI

weaponTemplate.shouldRearm 0

weaponTemplate.indirect 0

weaponTemplate.isThrown 1

weaponTemplate.minRange 45.0

weaponTemplate.maxRange 65.0

weaponTemplate.optimalRangePercentage 85

weaponTemplate.setFiringPose Standing

weaponTemplate.setStrength Infantry    5.0

weaponTemplate.setStrength LightArmour 1.0

weaponTemplate.setStrength HeavyArmour 1.0

weaponTemplate.setStrength NavalArmour 0

weaponTemplate.setStrength Helicopter  0.0

weaponTemplate.setStrength AirPlane    0.0

weaponTemplate.setSoundSphereRadius  30.0

weaponTemplate.setExplosionRadius 10.0

weaponTemplate.allowedDeviation 2.5

weaponTemplate.setFiresThroughTransparent 0

weaponTemplate.isEmpWeapon 0

weaponTemplate.explodesOnImpact 0

rem *** grenade Anti_vehicle***

weaponTemplate.create grenade_AV_AI

weaponTemplate.shouldRearm 0

weaponTemplate.indirect 0

weaponTemplate.isThrown 1

weaponTemplate.minRange 45.0

weaponTemplate.maxRange 65.0

weaponTemplate.optimalRangePercentage 85

weaponTemplate.setFiringPose Standing

weaponTemplate.setStrength Infantry    0.0

weaponTemplate.setStrength LightArmour 5.0

weaponTemplate.setStrength HeavyArmour 6.2

weaponTemplate.setStrength NavalArmour 0

weaponTemplate.setStrength Helicopter  0.0

weaponTemplate.setStrength AirPlane    0.0

weaponTemplate.setSoundSphereRadius  30.0

weaponTemplate.setExplosionRadius 10.0

weaponTemplate.allowedDeviation 2.5

weaponTemplate.setFiresThroughTransparent 0

weaponTemplate.isEmpWeapon 0

weaponTemplate.explodesOnImpact 0



Advertisement