TFBot: Difference between revisions
(Page created.) |
(More additions of various blocks. ExtAttr and keyvalues not yet updated.) |
||
Line 13: | Line 13: | ||
MinTargetRange 50 //If set, the task activates only when the target is more than specified units away | MinTargetRange 50 //If set, the task activates only when the target is more than specified units away | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== SpawnTemplate == | |||
<syntaxhighlight> | |||
SpawnTemplate [$SIGSEGV] //Spawn custom player template | |||
{ | |||
Name "Sentry" | |||
Bone "bip_head" //Bone name where the template should be attached to | |||
//Some bone names are listed here: | |||
//bip_head | |||
//bip_spine_2 - used by flag | |||
//bip_hand_L | |||
//bip_hand_R | |||
//weapon_bone_R | |||
//weapon_bone_L | |||
//bip_foot_L | |||
//bip_foot_R | |||
} | |||
</syntaxhighlight>Allows you to spawn [https://steamcommunity.com/sharedfiles/filedetails/?id=2289315026 PointTemplates], which will automatically be parented on the bot this block is on. Does <u>not</u> support global keyvalues. Bone names can also be found using HLMV, which is available by default in your Team Fortress 2/bin folder (which is "above" your tf/ folder). | |||
== ExtAttr == | == ExtAttr == | ||
Line 55: | Line 74: | ||
Taunt [$SIGSEGV] //Taunt periodically | Taunt [$SIGSEGV] //Taunt periodically | ||
{ | { | ||
Duration 5 //Duration of a looping taunt (Default: 0.1) | Duration 5 //Duration of a looping taunt (Default: 0.1) | ||
Name "Taunt: Kazotsky Kick" //If set, uses this item taunt instead of default | Name "Taunt: Kazotsky Kick" //If set, uses this item taunt instead of default | ||
Line 68: | Line 84: | ||
VoiceCommand [$SIGSEGV] //Periodically uses voice commands | VoiceCommand [$SIGSEGV] //Periodically uses voice commands | ||
{ | { | ||
Type "Medic" //Type of voice command. Possible values: | Type "Medic" //Type of voice command. Possible values: | ||
//Medic | //Medic | ||
Line 104: | Line 117: | ||
ChangeAttributes [$SIGSEGV] //Periodically changes bot attributes, defined in EventChangeAttributes{} | ChangeAttributes [$SIGSEGV] //Periodically changes bot attributes, defined in EventChangeAttributes{} | ||
{ | { | ||
Name "Attr1" //Name of the bot attributes block listed in EventChangeAttributes{} | Name "Attr1" //Name of the bot attributes block listed in EventChangeAttributes{} | ||
} | } | ||
Line 119: | Line 129: | ||
// "build 0/1/2/3" - Build dispenser / teleporter entrance / sentry / teleporter exit | // "build 0/1/2/3" - Build dispenser / teleporter entrance / sentry / teleporter exit | ||
// "destroy 0/1/2/3" - Destroy dispenser / teleporter entrance / sentry / teleporter exit | // "destroy 0/1/2/3" - Destroy dispenser / teleporter entrance / sentry / teleporter exit | ||
} | } | ||
Line 197: | Line 204: | ||
} | } | ||
</syntaxhighlight>Alternatively, use "custom item model" as a [[List of custom attributes|custom attribute]]. The model has to be precached if it isn't part of the | </syntaxhighlight>Alternatively, use "custom item model" as a [[List of custom attributes|custom attribute]]. The model has to be precached if it isn't part of the current map. Double-check this if you end up with ERROR models. | ||
== FireWeapon == | |||
<syntaxhighlight> | |||
FireWeapon [$SIGSEGV] //Periodically fires weapon | |||
{ | |||
Duration 0.5 //How long should the button be pressed (Default: 0.1) | |||
Type "Secondary" // Type of fire input, Possible values: | |||
//Primary | |||
//Secondary | |||
//Special - MOUSE3 | |||
//Reload | |||
//Jump | |||
//Crouch - requires NoCrouchButtonRelease 1 in TFBot | |||
//Action | |||
} | |||
</syntaxhighlight>A FireWeapon{} block with <code>Type "Action"</code> can be paired with <code>ExtAttr SuppressCanteenUse</code> to time canteen usage. | |||
A FireWeapon{} block with <code>Type "Primary"</code> can be paired with <code>Attributes SuppressFire</code> to control when a bot attacks. | |||
== ItemColor == | |||
<syntaxhighlight> | |||
ItemColor [$SIGSEGV] //Set item color | |||
{ | |||
ItemName "The Gunboats" | |||
Red 255 | |||
Green 0 | |||
Blue 0 | |||
} | |||
</syntaxhighlight>Note: global keyvalues may not work in this block. | |||
== AddCond == | |||
<syntaxhighlight> | |||
AddCond [$SIGSEGV] //Adds conditions to bots | |||
{ | |||
Name "TF_COND_REPROGRAMMED" // Condition to apply. | |||
//Index 43 //Condition index can be used instead | |||
Delay 3 // Delay before the condition activates (Default: 0) | |||
Duration 99 // Duration of the condition effect (Default: -1 - infinite duration) | |||
} | |||
</syntaxhighlight>Note that the default Delay value is 0. | |||
Available condition values and names can be found on the [https://wiki.teamfortress.com/wiki/Cheats#addcond TF2 wiki]. | |||
== DamageAppliesCond == | |||
<syntaxhighlight> | |||
DamageAppliesCond [$SIGSEGV] //Adds conditions to players on hit | |||
{ | |||
Name "TF_COND_URINE" // Condition to apply. | |||
//Index 43 //Condition index can be used instead | |||
Duration 3 // Duration of the condition effect (Default: -1 - infinite duration) | |||
} | |||
</syntaxhighlight>Available condition values and names can be found on the [https://wiki.teamfortress.com/wiki/Cheats#addcond TF2 wiki]. Alternatively, use the "add cond on hit" set of [[List of custom attributes|custom attributes]], which can be specified per weapon. | |||
== Stripping items == | |||
<syntaxhighlight> | |||
StripItemSlot 1 [$SIGSEGV] //If set, weapon in specified slot is stripped | |||
//Valid loadout positions: | |||
//0 - LOADOUT_POSITION_PRIMARY | |||
//1 - LOADOUT_POSITION_SECONDARY | |||
//2 - LOADOUT_POSITION_MELEE | |||
//3 - LOADOUT_POSITION_UTILITY | |||
//4 - LOADOUT_POSITION_BUILDING | |||
//5 - LOADOUT_POSITION_PDA | |||
//6 - LOADOUT_POSITION_PDA2 | |||
StripItem "Zombie Spy" [$SIGSEGV] // Remove item by name. This can be used to remove cosmetics including zombie cosmetics | |||
</syntaxhighlight> | |||
== FireInput == | |||
<syntaxhighlight> | |||
FireInput [$SIGSEGV] // Fires an input to an entity. Target !self and !activator refer to target the bot this block is on. | |||
{ | |||
Target "random_color_case*" //Entity name to use | |||
Action "PickRandom" //Input to fire | |||
Param "" //Parameter to use | |||
} | |||
</syntaxhighlight>Keep in mind that <code>Repeats</code> defaults to 0, infinite. Specify it as 1 to only fire an input once. The bot will be considered the !activator. | |||
== Add- & RemoveAttribute == | |||
<syntaxhighlight> | |||
AddAttribute [$SIGSEGV] | |||
{ | |||
Item "TF_WEAPON_KNIFE" // Item name to which add the attribute, or Player for player attribute, or Active for active weapon | |||
Name "damage bonus" // Attribute name | |||
Value 2 // Attribute value | |||
} | |||
RemoveAttribute [$SIGSEGV] | |||
{ | |||
Item "TF_WEAPON_KNIFE" // Item name from which remove the attribute, or Player for player attribute, or Active for active weapon | |||
Name "damage bonus" // Attribute name | |||
} | |||
</syntaxhighlight>If multiple attributes should be added or removed at once, it may be preferable to use <code>EventChangeAttributes{}</code> with <code>ChangeAttributes{}</code> instead. | |||
== Message == | |||
<syntaxhighlight> | |||
Message //Displays message in the chat | |||
{ | |||
Name "{red}Hello!" //Message in the chat displayed | |||
} | |||
</syntaxhighlight>Text colour can also accept hex codes without #, such as <code>FF0000</code> for red. | |||
== Sequence == | |||
<syntaxhighlight> | |||
Sequence [$SIGSEGV] // Display a sequence animation with a name. Not every animation is supported | |||
{ | |||
Name "Run_MELEE" // Name of the sequence | |||
} | |||
</syntaxhighlight>Sequence names can be found using HLMV, which is available by default in your Team Fortress 2/bin folder (which is "above" your tf/ folder), or in the Hammer++ Model Browser tool. | |||
== WeaponSwitch == | |||
<syntaxhighlight> | |||
WeaponSwitch [$SIGSEGV] //Periodically switches weapon | |||
{ | |||
Type "Primary" // Weapon slot, possible values: | |||
//Primary | |||
//Secondary | |||
//Melee | |||
//PDA | |||
//Building | |||
} | |||
</syntaxhighlight> | |||
== Visual changes == | == Visual changes == |
Revision as of 11:30, 8 November 2023
Listed below are all of the custom keyvalues accepted in the TFBot{} block by our server mods. Examples of these additions can be found in the demonstrative SigMod popfile.
Global keyvalues for custom blocks
Various custom blocks accept a variety of keyvalues to specify when they should perform their action. The following keyvalues should be usable in all of these blocks:
Delay 10 //Time before the task starts (Default: 10)
Cooldown 1 //Time between each execution of the task (Default: 10)
Repeats 1 //How many times the bot should perform the task in total (Default: 0 - Infinite)
IfSeeTarget 1 //When set to 1, this task activates only when the bot can see a target (Default: 0 - Always activate)
IfNoTarget 1 //When set to 1, this task activates only when the bot does not have a target (Default: 0 - Always activate)
IfHealthBelow 100 //When set, the task activates only when the bot health is below specified value
IfHealthAbove 100 //When set, the task activates only when the bot health is above specified value
MaxTargetRange 150 //If set, the task activates only when the target is within specified units away
MinTargetRange 50 //If set, the task activates only when the target is more than specified units away
SpawnTemplate
SpawnTemplate [$SIGSEGV] //Spawn custom player template
{
Name "Sentry"
Bone "bip_head" //Bone name where the template should be attached to
//Some bone names are listed here:
//bip_head
//bip_spine_2 - used by flag
//bip_hand_L
//bip_hand_R
//weapon_bone_R
//weapon_bone_L
//bip_foot_L
//bip_foot_R
}
Allows you to spawn PointTemplates, which will automatically be parented on the bot this block is on. Does not support global keyvalues. Bone names can also be found using HLMV, which is available by default in your Team Fortress 2/bin folder (which is "above" your tf/ folder).
ExtAttr
Extra Attributes that can be applied to bots, akin to the vanilla Attributes keyvalue.
// Aim behavior.
MedicLookAtThreats //If the bot is a Medic: can turn around to look at threats
TargetStickies //Target and destroy stickies
IgnoreBuildings //Ignore buildings
IgnorePlayers //Ignore players (including bots)
IgnoreBots //Ignore bots
IgnoreRealPlayers //Ignore non-bot players
IgnoreNPC //Ignore NPCs such as Tanks, skeletons, and halloween bosses
// Attacking behavior.
AlwaysFireWeaponAlt //Always use secondary fire
SuppressCanteenUse //If set, the bot will not automatically activate canteens when looking at an enemy
JumpStomp //Try to jump over and stomp obstracles
// Engineer-only.
BuildDispenserAsTeleporter //Builds dispenser instead of teleporter
BuildDispenserAsSentryGun //Builds dispenser instead of sentry gun
// Misc.
DisableSpawnProtectionFix //Disables a fix where a medic activating ubercharge inside spawn will not be invulnerable when exiting spawn
Homing Rockets
HomingRockets [$SIGSEGV]
{
IgnoreDisguisedSpies 1 //Ignore Spies that are disguised?
IgnoreStealthedSpies 1 //Ignore Spies that are cloaked?
RocketSpeed 0.25 //Multiplier of rocket speed. 1 for default speed
TurnPower 90 //How fast should the rocket rotate to face the target
MaxAimError 360 //Max angle between rocket and the target
}
Despite the name, also allows other projectiles (such as arrows) to home in on enemies. Alternatively, use the "mod projectile heat" set of custom attributes.
Taunt
Taunt [$SIGSEGV] //Taunt periodically
{
Duration 5 //Duration of a looping taunt (Default: 0.1)
Name "Taunt: Kazotsky Kick" //If set, uses this item taunt instead of default
}
Note that "Name" requires the name of the item that you equip to use the taunt. This name can be found in items_game.txt
, with most newer taunts being prefixed with "Taunt: ", or having "Taunt" elsewhere in their name. Weapon-specific taunts can only be done if the bot is currently holding that weapon.
Voice Command
VoiceCommand [$SIGSEGV] //Periodically uses voice commands
{
Type "Medic" //Type of voice command. Possible values:
//Medic
//Help
//Go
//Move up
//Left
//Right
//Yes
//No
//Activate Charge
//Charge Ready
//Incoming
//Spy
//Thanks
//Jeers
//Battle cry
//Cheers
//Sentry here
//Dispenser here
//Teleporter here
//Good job
//Sentry ahead
//Positive
//Negative
//Nice shot
}
ChangeAttributes
ChangeAttributes [$SIGSEGV] //Periodically changes bot attributes, defined in EventChangeAttributes{}
{
Name "Attr1" //Name of the bot attributes block listed in EventChangeAttributes{}
}
Note that bots will automatically start out in any attributes block named "Default". Maps with a gate will force bots to change to their "RevertGateBotsBehavior" block, if they have one.
ClientCommand
ClientCommand [$SIGSEGV] // Executes client commands, also known as console commands
{
Name "build 0" // Name of the client command, notable examples:
// "build 0/1/2/3" - Build dispenser / teleporter entrance / sentry / teleporter exit
// "destroy 0/1/2/3" - Destroy dispenser / teleporter entrance / sentry / teleporter exit
}
WeaponResist
WeaponResist [$SIGSEGV] //Multiplies damage received from weapons listed below
{
"TF_WEAPON_KNIFE" 0.1
"TF_WEAPON_MINIGUN" 10
}
Accepts both weapon classnames (such as tf_weapon_flamethrower
applying to all regular flamethrowers) and individual weapon names.
Spell
Spell [$SIGSEGV] //Gives specified spell to bots.
{
Delay 1 //Time before the first spell charges are given (Default: 10)
Cooldown 5 //Time between each spell changes (Default: 10)
Repeats 12 //How many times should spell charges be given in total (Default: 0 - Infinite)
Charges 1 //How many spell charges to give every time the spell is given (Default: 1)
Limit 1 //How many spell charges the bot can store (Default: Same as charges given)
Type "All" //Spell name. Possible values:
//Fireball
//Ball O' Bats
//Healing Aura
//Pumpkin MIRV
//Superjump
//Invisibility
//Teleport
//Tesla Bolt
//Minify
//Summon Monoculus
//Meteor Shower
//Summon Skeletons
//Common
//Rare
//All
}
For bots to use Spells, they must have a Spellbook item equipped, and no WeaponRestrictions active.
Action
A defunct keyvalue in vanilla. Works correctly on servers with our mods.
Action FetchFlag [$SIGSEGV] //Overrides default bot AI. Possible values:
//Default - Default action
//FetchFlag - Uses generic bomb fetching AI, default action for most bots except Spy, Medic, Engineer or Mission bots
//EscortFlag - As above, but ignores bot escort limit
//PushToCapturePoint - Pushes to capture point (or hatch in MvM). Similar to BehaviorModfiers Push and its aliases.
//Mobber - Chases down random player targets
//Spy - Uses spy AI, teleports behind players, but does not use disguises or cloak.
//Sniper - Uses mission sniper AI
//SuicideBomber - Uses sentry buster AI, but targets players instead. Might crash servers
//Idle - Sit in spawn and wait
//Passive - Sit at spawn position, until an active threat is in vision
//Medic - Use medic AI
Custom weapon model
CustomWeaponModel [$SIGSEGV] //Sets custom weapon model
{
Slot 1 //Valid loadout positions:
//0 - LOADOUT_POSITION_PRIMARY
//1 - LOADOUT_POSITION_SECONDARY
//2 - LOADOUT_POSITION_MELEE
//3 - LOADOUT_POSITION_UTILITY
//4 - LOADOUT_POSITION_BUILDING
//5 - LOADOUT_POSITION_PDA
//6 - LOADOUT_POSITION_PDA2
Model "models/weapons/w_models/w_minigun.mdl"
}
Alternatively, use "custom item model" as a custom attribute. The model has to be precached if it isn't part of the current map. Double-check this if you end up with ERROR models.
FireWeapon
FireWeapon [$SIGSEGV] //Periodically fires weapon
{
Duration 0.5 //How long should the button be pressed (Default: 0.1)
Type "Secondary" // Type of fire input, Possible values:
//Primary
//Secondary
//Special - MOUSE3
//Reload
//Jump
//Crouch - requires NoCrouchButtonRelease 1 in TFBot
//Action
}
A FireWeapon{} block with Type "Action"
can be paired with ExtAttr SuppressCanteenUse
to time canteen usage.
A FireWeapon{} block with Type "Primary"
can be paired with Attributes SuppressFire
to control when a bot attacks.
ItemColor
ItemColor [$SIGSEGV] //Set item color
{
ItemName "The Gunboats"
Red 255
Green 0
Blue 0
}
Note: global keyvalues may not work in this block.
AddCond
AddCond [$SIGSEGV] //Adds conditions to bots
{
Name "TF_COND_REPROGRAMMED" // Condition to apply.
//Index 43 //Condition index can be used instead
Delay 3 // Delay before the condition activates (Default: 0)
Duration 99 // Duration of the condition effect (Default: -1 - infinite duration)
}
Note that the default Delay value is 0.
Available condition values and names can be found on the TF2 wiki.
DamageAppliesCond
DamageAppliesCond [$SIGSEGV] //Adds conditions to players on hit
{
Name "TF_COND_URINE" // Condition to apply.
//Index 43 //Condition index can be used instead
Duration 3 // Duration of the condition effect (Default: -1 - infinite duration)
}
Available condition values and names can be found on the TF2 wiki. Alternatively, use the "add cond on hit" set of custom attributes, which can be specified per weapon.
Stripping items
StripItemSlot 1 [$SIGSEGV] //If set, weapon in specified slot is stripped
//Valid loadout positions:
//0 - LOADOUT_POSITION_PRIMARY
//1 - LOADOUT_POSITION_SECONDARY
//2 - LOADOUT_POSITION_MELEE
//3 - LOADOUT_POSITION_UTILITY
//4 - LOADOUT_POSITION_BUILDING
//5 - LOADOUT_POSITION_PDA
//6 - LOADOUT_POSITION_PDA2
StripItem "Zombie Spy" [$SIGSEGV] // Remove item by name. This can be used to remove cosmetics including zombie cosmetics
FireInput
FireInput [$SIGSEGV] // Fires an input to an entity. Target !self and !activator refer to target the bot this block is on.
{
Target "random_color_case*" //Entity name to use
Action "PickRandom" //Input to fire
Param "" //Parameter to use
}
Keep in mind that Repeats
defaults to 0, infinite. Specify it as 1 to only fire an input once. The bot will be considered the !activator.
Add- & RemoveAttribute
AddAttribute [$SIGSEGV]
{
Item "TF_WEAPON_KNIFE" // Item name to which add the attribute, or Player for player attribute, or Active for active weapon
Name "damage bonus" // Attribute name
Value 2 // Attribute value
}
RemoveAttribute [$SIGSEGV]
{
Item "TF_WEAPON_KNIFE" // Item name from which remove the attribute, or Player for player attribute, or Active for active weapon
Name "damage bonus" // Attribute name
}
If multiple attributes should be added or removed at once, it may be preferable to use EventChangeAttributes{}
with ChangeAttributes{}
instead.
Message
Message //Displays message in the chat
{
Name "{red}Hello!" //Message in the chat displayed
}
Text colour can also accept hex codes without #, such as FF0000
for red.
Sequence
Sequence [$SIGSEGV] // Display a sequence animation with a name. Not every animation is supported
{
Name "Run_MELEE" // Name of the sequence
}
Sequence names can be found using HLMV, which is available by default in your Team Fortress 2/bin folder (which is "above" your tf/ folder), or in the Hammer++ Model Browser tool.
WeaponSwitch
WeaponSwitch [$SIGSEGV] //Periodically switches weapon
{
Type "Primary" // Weapon slot, possible values:
//Primary
//Secondary
//Melee
//PDA
//Building
}
Visual changes
UseBusterModel 1 [$SIGSEGV] //Use buster model
Skin 4 [$SIGSEGV] // Force the bot to use specified model skin
Misc. keyvalues
NoBombUpgrades 1 [$SIGSEGV] //If set, the bomb carrier will not upgrade over time
PainSound "=70|GoldPipe_MissionIntro.mp3" [$SIGSEGV] //Override pain sound. The value after = is sound level in DB, applicable for all custom mission sounds
DeathSound "GoldPipe_MissionIntro.mp3" [$SIGSEGV] //Override death sound.
DesiredAttackRange 100 [$SIGSEGV] // How close to the target the bot should want to move when trying to attack. For melee weapons, default is 100. For other weapons except sniper rifles, default is 500
MoveBehindEnemy 1 [$SIGSEGV] // Should the bot try to get behind the target, similar to how the Spy bot behaves. Instead of 1 you can also specify custom distance at which the bot will start strafing around the target (default: 0)
Additions to existing keyvalues
WeaponRestrictions now also supports PDAOnly and BuildingOnly.