bot_generator

From Valve Developer Community
Jump to navigation Jump to search
English (en)Translate (Translate)
Class hierarchy
CTFBotGenerator
CPointEntity
CBaseEntity
tf_bot_generator.cpp

bot_generator is a point entity available in Team Fortress 2 Team Fortress 2.

bot_generator generates bots.

Note.pngNote:This entity requires special consideration if used in the Mann vs Machine gamemode. Most notably, it will remove all bot attributes on bot spawn (Disable Dodge, both ActionOnDeath values, Retain Buildings, and Suppress Fire). You will need to manually re-apply these flags after the bot has spawned using VScript. See This page for the relevant values.

Keyvalues

Name (targetname) <string>
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Team (team) <choices>
Which team this generator is for.
  • auto : Any
  • red : Red
  • blue : Blue
Class (class) <choices>
Pick the class to spawn. Picking a specific class will override bot_roster restrictions.
  • auto : Any
  • scout : Scout
  • sniper : Sniper
  • soldier : Soldier
  • demoman : Demoman
  • medic : Medic
  • heavyweapons : Heavy
  • pyro : Pyro
  • spy : Spy
  • engineer : Engineer
Count (count) <integer>
The maximum number of bots to spawn from this generator.
Note.pngNote:values <= 0 will cause an infinite amount of bots to spawn.
Max Active (maxActive) <integer>
Maximum number of bots from this generator that can be active at once from this generator.
Interval (interval) <float>
Number of seconds between bots spawning from this generator.
Action Point (action_point) <targetname>
Set this to have the bot travel to a specific bot_action_point upon spawning if the proper Spawn Command to be set.
Initial Command (initial_command) <choices>
Command the bot should execute upon spawning. No command is executed if left blank
  • goto action point : Go to specified Action Point
  • taunt : Taunt
  • despawn : Leave the game
  • cloak : If Spy, Cloak
  • uncloak : If Spy, Uncloak
  • attack sentry at next action point : Attack sentry gun at next action point
  • disguise : If Spy, Disguse
Suppress Fire (suppressFire) <boolean>
Setting this to Yes will make the bots not attack.
Disable Dodging (disableDodge) <boolean>
Setting this to Yes will prevent the bots from making erratic movements in an effort to dodge.
Action on Death (actionOnDeath) <integer>
When a bot dies, it will do one of these.
  • 0 : Respawn as usual
  • 1 : Remove self
  • 2 : Move to Spectator team
Move to Spectator Team on Death? (spectateOnDeath) <boolean> Obsolete
Deprecated.
This has been superseded by "Action on Death", and is no longer functional.
Use Team Spawn Point (useTeamSpawnPoint) <boolean>
Setting this to Yes will make the bots spawn from an info_player_teamspawn instead of this generator.
Retain Buildings After Disconnect (retainBuildings) <boolean>
If set, any buildings (sentries, sappers, etc) built by bots from this generator will not be destroyed when their owners are removed.
Difficulty (difficulty) <choices>
Set the generated bots' difficulty to this value.
  • -1 : Default
  • 0 : Easy
  • 1 : Normal
  • 2 : Hard
  • 3 : Expert
Don't spawn bots unless triggered (spawnOnlyWhenTriggered) <boolean>
If this is set, you must use the SpawnBot input to have any bots spawn.

Flags

Spawned Bots Ignore Enemy Scouts : [1]
Spawned Bots Ignore Enemy Soldiers : [2]
Spawned Bots Ignore Enemy Pyros : [4]
Spawned Bots Ignore Enemy Demomen : [8]
Spawned Bots Ignore Enemy Heavies : [16]
Spawned Bots Ignore Enemy Medics : [32]
Spawned Bots Ignore Enemy Engineers : [64]
Spawned Bots Ignore Enemy Snipers : [128]
Spawned Bots Ignore Enemy Spies : [256]
Spawned Bots Ignore Enemy Sentry Guns : [512]
Spawned Bots Ignore Scenario Goals : [1024]

Inputs

SetSuppressFire <boolean>
Set whether spawned TFBots should attack.
SetDisableDodge <boolean>
Set whether spawned TFBots should dodge.
SetDifficulty <integer>
Change the skill level of spawned TFBots.
CommandGoToActionPoint <targetname>
Commands all bots spawned by this generator to go to the specified bot_action_point.
SetAttentionFocus <targetname>
All bots spawned by this generator will focus exclusively on this entity. If the entity is a bot_action_point, entities within that point's radius will be attended to.
ClearAttentionFocus <targetname>
Remove attention focus restrictions from bots spawned by this generator.
Note.pngNote:Despite claiming to require a target, the input does not use it or require it.
SpawnBot
Attempt to spawn a bot within the rules specified.
RemoveBots
Force remove any bots this entity spawned.
Icon-Bug.pngBug:Appears to only remove half of the bots spawned?  [todo tested in?]

TFTeam:

SetTeam <integer>
Changes the entity's Team keyvalue.

EnableDisable:

Enable / Disable
Enable/disable this entity from performing its task. It might also disappear from view.

Outputs

OnSpawned
Sent when the bot generator has spawned a TFBot,
OnExpended
Sent when the bot generator has reached its limit of the bots it can create.
OnBotKilled
Sent when a bot associated with this bot generator is killed.