Level Editor/Scripting/Reference/GamemodeBotScript

From TeamSpec Wiki
Jump to navigation Jump to search

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

api: GamemodeServerApi
Property · Available to bot.gd

Everything this script can do goes through api. See GamemodeServerApi.

Everything this script can do: the server script's own GamemodeServerApi.

Hooks

_start

_start() -> void
Hook · Available to bot.gd

The map is live, and the server script's _start has already run. Look up the zones and positions your orders use here, once.

Returns: void

_tick

_tick(_delta: float) -> void
Hook · Available to bot.gd

Every 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.

Parameters
  • delta: float
    Returns: void

_player_joined

_player_joined(_entity_id: int) -> void
Hook · Available to bot.gd

A 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.

Parameters
  • entity_id: int
    Returns: void

_player_spawned

_player_spawned(_entity_id: int) -> void
Hook · Available to bot.gd

A player came back to life after dying. Not called for the first spawn after joining; that is _player_joined.

Parameters
  • entity_id: int
    Returns: void

_player_died

_player_died(_entity_id: int, _killer_id: int) -> void
Hook · Available to bot.gd

A 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.

Parameters
  • entity_id: int
  • killer_id: int
    Returns: void

_player_left

_player_left(_entity_id: int) -> void
Hook · Available to bot.gd

A player left the match for good. Forget anything you kept about them.

Parameters
  • entity_id: int
    Returns: void

_entity_damaged

_entity_damaged(_entity: int, _amount: float, _attacker: int) -> void
Hook · Available to bot.gd

A boss took damage, after the server script heard about it. Rebalance the defense here: api.entity_health reads what it has left.

Parameters
  • entity: int
  • amount: float
  • attacker: int
    Returns: void

_entity_died

_entity_died(_entity: int, _killer: int) -> void
Hook · Available to bot.gd

A boss died, after the server script heard about it.

Parameters
  • entity: int
  • killer: int
    Returns: void
TeamSpec Level Editor
Basics Getting started · Interface · Viewport and camera · Selecting and hiding · Keyboard shortcuts · Settings · Map Config · Troubleshooting
Menus File · Edit · View · Tools · Functional
Panels Scene tree · Inspector · Materials · Props · Snapping · UV editor · Displacement · Terrain
Tools Move, Rotate and Scale · Box · Sphere · Cylinder · Prism · Stairs · Spiral Stairs · Spiral Tower · Arch · Path Brush · Plane · Terrain · Clip · Duplicate · Ruler and Cordon · Edit Vertex and Edge · Edit Face · Loop Cut · Material Brush · Vertex Color Brush · Displacement · Prop Path
Entities Brush · Zone · Group · Mirror Node · Prop · Spawn Point · Supply Pickup · World Boundary · Lights · Water · Sounds · Anchor Platform · Payload Track · Boss Spawn · Map Marker · World Text · Decal · Door · Button · Logic entities · 3D Skybox · Nav Region
Workflows Your first map · Brushes and CSG · Materials and UVs · Lighting and lightmaps · Bots and navigation · Mirrored maps · Outputs and logic · Custom assets · Playtesting · Exporting and publishing · Importing Source maps
Scripting Overview · Server rules · Client HUD · Bots · Teams and spawning · Zones · Pickups · Payload tracks · Map entities · Sandbox limits · Testing · King of the Hill · Team Deathmatch · API reference · What a script may use