Team Fortress 2 Bots
TF2 does include bots, however there is no AI code for them. What does this mean? Why your bots will be nothing more than mindless statues without intelligence! Luckily, various commands let you use them like obedient minions at your will! You can manipulate them to do things such as follow you around and fire their weapons. Below is a complete command list for bots as well as some examples on how to use them.
List of Commands
TF2 comes with commands for using bots, some work and some don't....
| Command | Description |
bot |
This command will create a bot on the given team with the specified class and name.
|
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.
|
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.
|
bot_forceattack2 |
This will make all the bots execute secondary_fire on whatever weapon they currently have selected when
|
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).
|
bot_forcefireweapon |
Force bots with the specified weapon to fire. Does not seem to be implemented, nothing happens. |
bot_kill |
Kills the specified bot.
|
bot_mimic |
Bot uses usercmd of player by index. The bot will execute all keystrokes issued by a player, mimicking movements.
|
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.
|
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"
|
bot_refill |
Refills all bots' Ammo counts, including Metal for Engineers. Syntax: |
bot_saveme |
This makes all the bots call for a Medic, equivalent to issuing
|
bot_selectweaponslot |
This seems to affect only the first bot that was spawned, no other bots obey this command.
|
bot_teleport |
Teleports a specified bot to a given coordinate. Map coordinates of where you are standing can be found by typing
|
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.
|
Useful aliases and binds
sv_lan 1sv_cheats 1mp_teams_unbalance_limit 0alias +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_primarybind m +bot_shoot_secondary
Example Script
- 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).
- Join as a BLU Engineer and stay in the respawn room.
- Bring down console and type:
-
- sv_cheats 1
- mp_teams_unbalance_limit 0
- bot -class Engineer
- bot_mimic_yaw_offset 0
- bot_mimic 1
- sv_cheats 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_commandthat can make the bot issue commands.
-
- Bring down console and type:
-
- bot_command bot01 "build 3"
- 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.
-
- 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_refillconsole command.
Example Script 2
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 melee weapon unless he ends up above a supply of ammunition - in which case he will continually fire rockets (good for deflection practice).
- 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
- mp_teams_unbalance_limit 0
Example Script 3
The following will create a red sniper who continously scopes in and a red spy who cloaks and decloaks.