TFBot

From SigMod
Jump to navigation Jump to search

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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
}

Allows rockets (but no other projectiles) to home in on enemies. For making most projectiles home in on enemies, use the "mod projectile heat" set of custom attributes.

Taunt[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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_flamethrowerapplying to all regular flamethrowers) and individual weapon names.

Spell[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

ItemColor [$SIGSEGV] //Set item color
{
	ItemName "The Gunboats"
	Red 255
	Green 0
	Blue 0
}

Note: global keyvalues may not work in this block.

AddCond[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

WeaponSwitch [$SIGSEGV]  //Periodically switches weapon
{
	Type "Primary" // Weapon slot, possible values:
		//Primary
		//Secondary
		//Melee
		//PDA
		//Building
}

Visual changes[edit | edit source]

UseBusterModel 1 [$SIGSEGV] //Use buster model

Skin 4 [$SIGSEGV] // Force the bot to use specified model skin

Misc. keyvalues[edit | edit source]

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[edit | edit source]

WeaponRestrictions now also supports PDAOnly and BuildingOnly.