Bot generator: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Despite having some code to support it, setting the team to spectator will prevent bots from joining)
(-added class hierarchy, cleanup)
Line 1: Line 1:
{{LanguageBar}}
{{CD|CTFBotGenerator|file1=tf_bot_generator.cpp}}
{{this is a|point entity|game=Team Fortress 2|name=bot_generator}}
{{this is a|point entity|game=Team Fortress 2|name=bot_generator}}


==Entity description==
{{ent|bot_generator}} generates bots.
{{ent|bot_generator}} generates bots.


==Keyvalues==
== Keyvalues ==
{{KV Targetname}}
{{KV|Team|intn=team|choices|Which team this generator is for.}}
{{KV|Team|intn=team|choices|Which team this generator is for.}}
<!--doesn't seem to use the same values as other ent's Team KVs. Technically, the team KV supports more values than this, but they're just aliases for other values -fiend-->
<!--doesn't seem to use the same values as other ent's Team KVs. Technically, the team KV supports more values than this, but they're just aliases for other values -fiend-->
Line 51: Line 53:
{{KV|Don't spawn bots unless triggered|intn=spawnOnlyWhenTriggered|bool|If this is set, you must use the SpawnBot input to have any bots spawn.}}
{{KV|Don't spawn bots unless triggered|intn=spawnOnlyWhenTriggered|bool|If this is set, you must use the SpawnBot input to have any bots spawn.}}


{{KV BaseEntity}}
== Flags ==
 
==Flags==
{{Fl|1|Spawned Bots Ignore Enemy Scouts}}
{{Fl|1|Spawned Bots Ignore Enemy Scouts}}
{{Fl|2|Spawned Bots Ignore Enemy Soldiers}}
{{Fl|2|Spawned Bots Ignore Enemy Soldiers}}
Line 66: Line 66:
{{Fl|1024|Spawned Bots Ignore Scenario Goals}}
{{Fl|1024|Spawned Bots Ignore Scenario Goals}}


==Inputs==
== Inputs ==
{{IO|SetSuppressFire|Set whether spawned TFBots should attack.|param=bool|}}
{{I|SetSuppressFire|Set whether spawned TFBots should attack.|param=bool|}}
{{IO|SetDisableDodge|Set whether spawned TFBots should dodge.|param=bool}}
{{I|SetDisableDodge|Set whether spawned TFBots should dodge.|param=bool}}
{{IO|SetDifficulty|Change the skill level of spawned TFBots.|param=integer}}
{{I|SetDifficulty|Change the skill level of spawned TFBots.|param=integer}}
{{IO|CommandGoToActionPoint|Commands all bots spawned by this generator to go to the specified {{ent|bot_action_point}}.|param=target}}
{{I|CommandGoToActionPoint|Commands all bots spawned by this generator to go to the specified {{ent|bot_action_point}}.|param=target}}
{{IO|SetAttentionFocus|All bots spawned by this generator will focus exclusively on this entity. If the entity is a {{ent|bot_action_point}}, entities within that point's radius will be attended to.|param=target}}
{{I|SetAttentionFocus|All bots spawned by this generator will focus exclusively on this entity. If the entity is a {{ent|bot_action_point}}, entities within that point's radius will be attended to.|param=target}}
{{IO|ClearAttentionFocus|Remove attention focus restrictions from bots spawned by this generator.
{{I|ClearAttentionFocus|Remove attention focus restrictions from bots spawned by this generator.
{{note|Despite claiming to require a target, the input does not use it or require it.}}|param=target}}
{{note|Despite claiming to require a target, the input does not use it or require it.}}|param=target}}
{{IO|SpawnBot|Attempt to spawn a bot within the rules specified.}}
{{I|SpawnBot|Attempt to spawn a bot within the rules specified.}}
{{IO|RemoveBots|Force remove any bots this entity spawned.
{{I|RemoveBots|Force remove any bots this entity spawned.
{{bug|Appears to only remove half of the bots spawned?}}}}
{{bug|Appears to only remove half of the bots spawned?}}}}
{{I TFTeam}}
{{I TFTeam}}
{{I EnableDisable}}
{{I EnableDisable}}
{{I BaseEntity}}


==Outputs==
== Outputs ==
{{IO|OnSpawned|Sent when the bot generator has spawned a TFBot,}}
{{O|OnSpawned|Sent when the bot generator has spawned a TFBot,}}
{{IO|OnExpended|Sent when the bot generator has reached its limit of the bots it can create.}}
{{O|OnExpended|Sent when the bot generator has reached its limit of the bots it can create.}}
{{IO|OnBotKilled|Sent when a bot associated with this bot generator is killed.}}
{{O|OnBotKilled|Sent when a bot associated with this bot generator is killed.}}
{{O BaseEntity}}

Revision as of 14:54, 25 September 2024

English (en)Translate (Translate)
C++ Class hierarchy
CTFBotGenerator
CPointEntity
CBaseEntity
C++ tf_bot_generator.cpp

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

bot_generator generates bots.

Keyvalues

Name (targetname) <string>[ Edit ]
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 <booleanRedirectInput/boolean>
Set whether spawned TFBots should attack.
SetDisableDodge <booleanRedirectInput/boolean>
Set whether spawned TFBots should dodge.
SetDifficulty <integerRedirectInput/integer>
Change the skill level of spawned TFBots.
CommandGoToActionPoint <targetnameRedirectInput/string>
Commands all bots spawned by this generator to go to the specified bot_action_point.
SetAttentionFocus <targetnameRedirectInput/string>
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 <targetnameRedirectInput/string>
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 ?]
SetTeam <integerRedirectInput/integer>
Changes the entity's team.

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.