Bot controller: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with "{{tf2 point|bot_controller}} == Entity description == An entity used to create a bot, and then issue commands to it. ==Keyvalues== {{KV|Name|string|The targetname that othe...")
 
m (add missing internal names)
 
(10 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{tf2 point|bot_controller}}
{{LanguageBar}}
{{CD|CTFBotController|nolink=1|file1=tf_bot_temp.cpp}}
{{this is a|point entity|game=Team Fortress 2|name=bot_controller}}


== Entity description ==
An entity used to create a bot, and then issue commands to it.
An entity used to create a bot, and then issue commands to it.


==Keyvalues==
== Keyvalues ==
{{KV|Name|string|The [[targetname]] that other entities refer to this entity by.}}
{{KV Targetname}}
{{KV|Team|choices|Team}}
{{KV|Team|intn=teamnum|choices|The team of the bot.}}
:* 1 : Spectator
:* 2 : Red
:* 2 : Red
:* 3 : Blue
:* 3 : Blue
{{KV|Class|choices|The class the bot will spawn as.}}
{{KV|Class|intn=bot_class|choices|The class the bot will spawn as.}}
:* 0 : Random
:* 0 : Random
:* 1 : Scout
:* 1 : Scout
Line 20: Line 22:
:* 8 : Spy
:* 8 : Spy
:* 9 : Engineer
:* 9 : Engineer
{{KV|Name of the bot.|string|most likely the name displayed in-game}}
{{KV|Name of the bot.|intn=bot_name|string|The name of the bot.}}


==Inputs==
== Inputs ==
{{IO|Kill|Removes this entity from the world.}}
{{I|CreateBot|Create the bot for this controller.}}
{{IO|KillHierarchy|Removes this entity and all its children from the world.}}
{{I|RespawnBot|Force the bot to respawn.}}
{{IO|AddOutput|Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.<br/>Format: <code><key> <value></code><br/>Format: <code><output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite></code>|param=string}}
{{I|AddCommandMoveToEntity|Add a command to the bot's queue, telling it to move to the specified entity.|param=target_destination}}
{{IO|FireUser1|to=FireUser4|Fire the <code>OnUser</code> outputs; see [[User Inputs and Outputs]].}}
{{I|AddCommandAttackEntity|Add a command to the bot's queue, telling it to attack the specified entity.|param=target_destination}}
{{IO|CreateBot|Create the bot for this controller.}}
{{I|AddCommandSwitchWeapon|Add a command to the bot's queue, telling it to switch to the specified weapon slot.|param=integer}}
{{IO|RespawnBot|Force the bot to respawn.}}
{{I|AddCommandDefend|Add a command to the bot's queue, telling it to defend the position it's standing at. The parameter specifies the distance from the point that the Bot is allowed to move to fight enemies.|param=float}}
{{IO|AddCommandMoveToEntity|Add a command to the bot's queue, telling it to move to the specified entity.|param=target_destination}}
{{I|SetIgnoreHumans|Set whether or not the Bot should ignore human players. 1 {{=}} ignore, 0 {{=}} don't ignore.|param=integer}}
{{IO|AddCommandAttackEntity|Add a command to the bot's queue, telling it to attack the specified entity.|param=target_destination}}
{{I|PreventMovement|Set whether or not the Bot is allowed to move. 1 {{=}} prevent movement, 0 {{=}} allow movement.|param=integer}}
{{IO|AddCommandSwitchWeapon|Add a command to the bot's queue, telling it to switch to the specified weapon slot.|param=integer}}
{{I|ClearQueue|Clear the bot's command queue.}}
{{IO|AddCommandDefend|Add a command to the bot's queue, telling it to defend the position it's standing at. The parameter specifies the distance from the point that the Bot is allowed to move to fight enemies.|param=float}}
{{IO|SetIgnoreHumans|Set whether or not the Bot should ignore human players. 1 {{Template:=}} ignore, 0 {{Template:=}} don't ignore.|param=integer}}
{{IO|PreventMovement|Set whether or not the Bot is allowed to move. 1 {{Template:=}} prevent movement, 0 {{Template:=}} allow movement.|param=integer}}
{{IO|ClearQueue|Clear the bot's command queue.}}


==Outputs==
== Outputs ==
{{IO|OnUser1|to=OnUser4|These Outputs each fire in response to the firing of the like-numbered <code>FireUser1</code> to <code>FireUser4</code> Input; see [[User Inputs and Outputs]].}}
{{O|OnCommandFinished|Sent when a command is finished.}}
{{IO|OnForceRespawn|Sent when the entity respawns the players.}}

Latest revision as of 08:21, 18 December 2024

English (en)Translate (Translate)
C++ Class hierarchy
CTFBotController
CPointEntity
CBaseEntity
C++ tf_bot_temp.cpp

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

An entity used to create a bot, and then issue commands to it.

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 (teamnum) <choices>
The team of the bot.
  • 1 : Spectator
  • 2 : Red
  • 3 : Blue
Class (bot_class) <choices>
The class the bot will spawn as.
  • 0 : Random
  • 1 : Scout
  • 2 : Sniper
  • 3 : Soldier
  • 4 : Demoman
  • 5 : Medic
  • 6 : Heavy
  • 7 : Pyro
  • 8 : Spy
  • 9 : Engineer
Name of the bot. (bot_name) <string>
The name of the bot.

Inputs

CreateBot
Create the bot for this controller.
RespawnBot
Force the bot to respawn.
AddCommandMoveToEntity <targetnameRedirectInput/string>
Add a command to the bot's queue, telling it to move to the specified entity.
AddCommandAttackEntity <targetnameRedirectInput/string>
Add a command to the bot's queue, telling it to attack the specified entity.
AddCommandSwitchWeapon <integerRedirectInput/integer>
Add a command to the bot's queue, telling it to switch to the specified weapon slot.
AddCommandDefend <floatRedirectInput/float>
Add a command to the bot's queue, telling it to defend the position it's standing at. The parameter specifies the distance from the point that the Bot is allowed to move to fight enemies.
SetIgnoreHumans <integerRedirectInput/integer>
Set whether or not the Bot should ignore human players. 1 = ignore, 0 = don't ignore.
PreventMovement <integerRedirectInput/integer>
Set whether or not the Bot is allowed to move. 1 = prevent movement, 0 = allow movement.
ClearQueue
Clear the bot's command queue.

Outputs

OnCommandFinished
Sent when a command is finished.