Bots

From TF2 Wiki

Jump to: navigation, search

TF2 does include bots, however there is no AI code for them so they just spawn and do nothing. You can use them like puppets though, manipulating them to do things such as follow you around and fire their weapons. Below is a complete command list for bots and an example of how to use them.

Contents

Commands

TF2 comes with commands for using bots, some work and some don't. For clarity, the complete list is included.

Command Description

bot

This command will create a bot on the given team with the specified class and name.

Syntax
bot -team <teamname/number> -class <classname> -name <botname>
Parameters
-team teamname/number
Specifies the team name or number to assign the bot. Where name/number can be RED or 1, BLU or 0
-class classname
The classname of the class can be Demoman, Engineer, HeavyWeapons, Medic, Pyro, Scout, Soldier, Sniper, or Spy
-name botname
botname can be anything. If there is already someone with the same name, an incremental number (starting at 1) surrounded with parenthesis will be added to the beginning of the name. For example, joe, (1)joe, (2)joe, etc. If no name is given then the name will be "bot" followed by a number starting with 01; for example, the first bot will be bot01, the next bot02, and so on.
Example
bot -team red -class Engineer -name joe

bot_changeclass

Force all bots to change to the specified class. Does not seem to be implemented, nothing happens.

bot_changeteams

Make all bots change teams. This forces all the bots to switch teams. If a bot was on the RED team then it will now be on the BLU team and vice versa.

bot_command

Sends specified command on behalf of specified bot.

Syntax
bot_command <botname> <console command>
botname is the name or id of the bot to send the command to.
console command can be any of the ones listed in Scripting#Console_Commands.
Example
bot_command bot01 "voicemenu 0 0"

bot_defend

Set to a team number, and that team will all keep their combat shields raised. For instance, heavies will spin their miniguns.

bot_dontmove

Bots are prevented from moving.

bot_flipout

When on, this will make all the bots fire whatever weapon they currently have selected. Default is to use primary_fire, but if bot_forceattack2 (see below) is set to 1 then secondary_fire will be used instead.

Syntax
bot_flipout <0/1>
On when set to 1, off when set to 0
Example
bot_flipout 1

bot_forceattack2

This will make all the bots execute secondary_fire on whatever weapon they currently have selected when bot_flipout is set to 1.

Syntax
bot_forceattack2 <0/1>
Bot will use secondary_fire when set to 1, primary_fire when set to 0
Example
bot_forceattack2 1

bot_forceattackon

When firing, don't tap fire, hold it down. If this is set to 0 then the bot will act like they are continuously tapping the fire button (useful for the Pistol, but not for the Heavy's Minigun). If this is set to 1 then the bot will act as if it is holding down the fire button (useful for the Heavy).

Syntax
bot_forceattackon <0/1>
On when set to 1, off when set to 0
Example
bot_forceattackon 1

bot_forcefireweapon

Force bots with the specified weapon to fire. Does not seem to be implemented, nothing happens.

bot_kill

Kills the specified bot.

Syntax
bot_kill <bot name>
Makes the specified bot commit suicide.
Example
bot_kill bot01

bot_mimic

Bot uses usercmd of player by index. The bot will execute all keystrokes issued by a player, mimicking movements.

Syntax
bot_mimic <0/1>
On when set to 1, off when set to 0
Example
bot_mimic 1

bot_mimic_yaw_offset

Offsets the bots' yaw. The bots will face in a direction this angle from the player. By default this is set to 180 so that all bots will face the player. Setting this to 0 will face the bots in the same direction as the player.

Syntax
bot_mimic_yaw_offset <0-360>
Set the direction by specifying angle in degrees
Example
bot_mimic_yaw_offset 180

bot_randomnames

This will add text to bot names, apparently used for testing during development, some examples: "Yet more Bot names, medium size", "Another bot", "This is a medium Bot", "This is a super long bot name t"

Syntax
bot_randomnames <0/1>
On when set to 1, off when set to 0
Example
bot_randomnames 1

bot_refill

Refills all bots' Ammo counts, including Metal for Engineers.

Syntax: bot_refill

bot_saveme

This makes all the bots call for a Medic, equivalent to issuing bot_command <botname> "voicemenu 0 0" to every bot. Syntax: bot_saveme <0/1>

On when set to 1, off when set to 0

bot_selectweaponslot

This seems to affect only the first bot that was spawned, no other bots obey this command.

Syntax
bot_selectweaponslot <n>
Set n to weapon slot that bot should switch to.
Example
bot_selectweaponslot 1

bot_teleport

Teleports a specified bot to a given coordinate. Map coordinates of where you are standing can be found by typing Status in the console.

Syntax
bot_teleport <botname> <X> <Y> <Z> <Pitch> <Yaw> <Roll>
Where botname is the bot name or id to teleport.
X Y Z are the map coordinates.
Pitch Yaw Roll is the direction the bot should face.
Example
bot_teleport bot01 -4815 1385 -447 0 0 0

bot_whack

Deliver lethal damage from player to specified bot. This basically kills the bot with the currently selected weapon, probably used for testing during development.

Syntax
bot_whack <botname>
Where botname is the name of bot to "whack".
Example
bot_whack bot109


Useful aliases and binds

sv_lan 1

sv_cheats 1

mp_teams_unbalance_limit 0

alias +bot_shoot_primary "bot_flipout 1"

alias -bot_shoot_primary "bot_flipout 0"

alias +bot_shoot_secondary "bot_forceattack2 1;bot_flipout 1"

alias -bot_shoot_secondary "bot_flipout 0;bot_forceattack2 0"

bind n +bot_shoot_primary

bind m +bot_shoot_secondary

Example Scripts

  1. Create a server and load a map (Gravelpit works well as a map since there is just the one respawn room, or the achievement maps with the open spawn areas).
  2. Join as a BLU Engineer and stay in the respawn room.
  3. Bring down console and type:
    sv_cheats 1
    mp_teams_unbalance_limit 0
    bot -class Engineer
    bot_mimic_yaw_offset 0
    bot_mimic 1
    This will spawn a BLU Engineer bot by the name of "bot01" which will do what you do, including walking around and selecting/firing weapons. However, it will not build anything if you build it. You can make it select the build menu, but cannot actually select a menu item when you do. Thankfully, there is the BUILD command and the bot_command that can make the bot issue commands.
  4. Bring down console and type:
    bot_command bot01 "build 3"
    This will start the build process with the Engineer holding his toolbox, the bot should be seeing the blueprint now.
  5. Close the console and press your fire button - this will start the Sentry building. Keep pressing the fire button to make the bot hit the Sentry with his Wrench to build it faster, and if you want add Metal to it. If you want to increase the Sentry's level then you need to give the bot more Metal with the bot_refill console command.

Other examples

  1. The following will create a red medic and a red soldier who fire continously until they are out of ammo.

The medic ends up with a medigun set to heal any other player who passes them or an enemy spy. The soldier ends up bashing away with his mellee weapon unless he ends up above a supply of ammunition I which case he will continually fire rockets (good for deflection practice).

  1. sv_cheats 1
    mp_teams_unbalance_limit 0
    bot -team red -class medic
    bot -team red -class soldier
    bot_forceattackon 1
    bot_flipout 1
    sv_cheats 0
    retry


  1. The following will create a red sniper who continously scopes in and a red spy who cloaks and decloaks.

The retry after turning sv_cheats off gives you a clean session.

  1. sv_cheats 1
    mp_teams_unbalance_limit 0
    bot -team red -class sniper
    bot -team red -class spy
    bot_forceattack2 1
    bot_forceattackon 1
    bot_flipout 1
    sv_cheats 0
    retry
  1. The following gives you three red scouts and three red heavies.
  1. sv_cheats 1
    mp_teams_unbalance_limit 0
    bot -team red -class scout
    bot -team red -class scout
    bot -team red -class scout
    bot -team red -class heavyweapons
    bot -team red -class heavyweapons
    bot -team red -class heavyweapons
    sv_cheats 0
    retry

Personal tools