How to change bot's use of the special Handweapons

This tutorial will look into means to change the bot's use of the special handweapons which mainly applies to Defib, Heal, Supply, Repair, and mine weapons). Each handweapon has it's own AItemplate, which tells the bots something about how to use the weapon. Now there are some things that are hard coded into the game engine, and it appears that many of the special hand weapons can only be used by bots with the standard kit normally associated with that special handweapon. For, example, only medic bots can heal and revive, even if another kit is set up with a health kit or defib unit. So, if you wanted to disable the bots use of special purpose hand weapons, reassigning those special hand weapons to different kits may be one method.

One other thing that seems to be hardcoded is that bots will give priority to players over other bots. So this means if a bot medic will heal or revive a player before another bot. There does not seem to be any way to change this.

Unlike regular hand weapons, the AItemplates for most special purpose weapons list strategic strengths which set the target priority for the bots for attacking different types of targets. For example, here is a generic rifle AItemplate:

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

The standard AItemplates for the special purpose hand weapons will look something like these:

> weaponTemplate.create ammobox\_AI
>
>

> weaponTemplate.weaponType Ammo
>
>

> weaponTemplate.minRange 0.0
>
>

> weaponTemplate.maxRange 60.0
>
>
>
>

> rem \*\*\* Repair \*\*\*
>
>

> weaponTemplate.create repair\_AI
>
>

> weaponTemplate.weaponType Repair
>
>

> weaponTemplate.minRange 0.0
>
>

> weaponTemplate.maxRange 60
>
>
>
>

> rem \*\*\* medic defib \*\*\*
>
>

> weaponTemplate.create defib\_AI
>
>

> weaponTemplate.weaponType Revive
>
>

> weaponTemplate.minRange 0.0
>
>

> weaponTemplate.maxRange 5.0
>
>
>
>

> rem \*\*\* Heal \*\*\*
>
>

> weaponTemplate.create heal\_AI
>
>

> weaponTemplate.weaponType Healing
>
>

> weaponTemplate.minRange 0.0
>
>

> weaponTemplate.maxRange 60.0
>
>

The only thing you can can adjust on these is the range, which usually means setting the maxRange smaller or larger. So for example, here the defib\_AI is set to only 5 when the heal\_AI is set to 60. This means that a bot will only run 5 meters to revive someone, but will run 60 meters to provide healing. This reduces excessive Revives. Alternatively, by setting the min and max ranges to both zero, would be another way to disable the bots use of those hand weapons.

There is, however, another areas to look into to adjust the bots use of the Special Handweapons: The AIbehaviors. These are in the mod's AI folder with a file called Aibehaviors.Ai, which is a simple txt file that can be edited with notepad.

In the Aibehavior.ai file there is a list of all the different AIbehaviors with each of the special handweapons having their own:

> aiSettings.setBehaviour 0 Avoid
>
>

> aiSettings.setBehaviour 1 MoveTo
>
>

> aiSettings.setBehaviour 2 Idle
>
>

> aiSettings.setBehaviour 3 Fire
>
>

> aiSettings.setBehaviour 4 TakeCover
>
>

> aiSettings.setBehaviour 5 Change
>
>

> aiSettings.setBehaviour 6 Special
>
>

> aiSettings.setBehaviour 7 Revive
>
>

> aiSettings.setBehaviour 8 c4
>
>

> aiSettings.setBehaviour 9 Special2
>
>

> aiSettings.setBehaviour 10 Special3
>
>

> aiSettings.setBehaviour 11 Random
>
>

> aiSettings.setBehaviour 12 Triggerable
>
>

Now bots, using a handweapon will use the standardweights priority list:

> rem \*\*\* Construct standard weights \*\*\*
>
>

> aiSettings.createBehaviourModifiers StandardWeights
>
>

> aiSettings.setBehaviourModifier Avoid       1.0
>
>

> aiSettings.setBehaviourModifier MoveTo      1.0
>
>

> aiSettings.setBehaviourModifier Idle        0.1
>
>

> aiSettings.setBehaviourModifier Fire        7.5
>
>

> aiSettings.setBehaviourModifier Special     3.0
>
>

> aiSettings.setBehaviourModifier TakeCover   2.0
>
>

> aiSettings.setBehaviourModifier Change      1.9
>
>

> aiSettings.setBehaviourModifier Revive      3.0
>
>

> aiSettings.setBehaviourModifier c4          1.0
>
>

> aiSettings.setBehaviourModifier Special2    1.0
>
>

> aiSettings.setBehaviourModifier Special3    1.0
>
>

> aiSettings.setBehaviourModifier Random      1.0
>
>

> aiSettings.setBehaviourModifier Triggerable 1.0
>
>

Looking at this list, Fire as the highest priority of 7.5, with Revive set to 3.0. Setting to Revive to a higher or lower number will increase or reduce the likelihood that a bot will repsond to a revive request if they are with the max range. So, by increasing it to 4.0 would mean the bot will move to revive a downed comrade even in face of danger, unless already engaged in a fire fight. Reducing it to 1.0 would reduce Reviving to a bot to just a mundane action and it will likely only happen if it has nothing better to do, but taking it to 8 would mean that the bot would actually stop in the middle of a firefight to go revive a downed buddy.

Each kit with special abilites has an ability line with the line for the special ability. A setting of 1 enables it, while a setting of 0 is the default would disable it.:

ObjectTemplate.createComponent Ability

ObjectTemplate.ability.hasRepairingAbility 1

ObjectTemplate.ability.hasAmmoAbility 1

ObjectTemplate.ability.hasHealingAbility 1