Level Editor/Scripting/Reference/GamemodeBotScript
The base class of bot.gd: the script starts with extends GamemodeBotScript.
The base class of a map's bot.gd: what the mode tells its bots to do.
This script runs on the server next to server.gd and works through the very same api, so it sees exactly the match the rules are running. Give bots their jobs here and keep the rules in server.gd: a point scored from this file is a rule nobody will find.
A bot is told its job, never its movement. With no orders it hunts whoever is nearest and wanders when there is nobody.
See Level Editor/Scripting/Reference for every class, and Level Editor/Scripting/Reference/Sandbox for the rest of GDScript a script may use.
Properties
api
bot.gdEverything this script can do goes through api. See GamemodeServerApi.
Everything this script can do: the server script's own GamemodeServerApi.
Hooks
_start
bot.gdThe map is live, and the server script's _start has already run. Look up the zones and positions your orders use here, once.
void_tick
bot.gdEvery server tick, after the rules have run for that tick. Orders do not expire and giving the same order again costs nothing, so decide every bot's job on an interval and give it every time.
delta:floatReturns:void
_player_joined
bot.gdA player joined, after the server script gave them a team. api.is_bot says whether it is a bot; this is the place for api.bot_set_skill.
entity_id:intReturns:void
_player_spawned
bot.gdA player came back to life after dying. Not called for the first spawn after joining; that is _player_joined.
entity_id:intReturns:void
_player_died
bot.gdA player died. Drop whatever you were tracking about them. When they respawn is the server script's decision, so there is no respawn time here.
entity_id:intkiller_id:intReturns:void
_player_left
bot.gdA player left the match for good. Forget anything you kept about them.
entity_id:intReturns:void
_entity_damaged
bot.gdA boss took damage, after the server script heard about it. Rebalance the defense here: api.entity_health reads what it has left.
entity:intamount:floatattacker:intReturns:void
_entity_died
bot.gdA boss died, after the server script heard about it.
entity:intkiller:intReturns:void