Level Editor/Scripting/Testing
Jump to navigation
Jump to search
To test a gamemode you run the map in TeamSpec and read what your scripts print. How to start the game from the editor is on Playtesting; this page is about checking the scripts.
Note: Set TeamSpec Executable Path in Settings first. Run and the playtest buttons need it.
Ways to run
- Run > Run (Console) is the best way to test scripts: it starts TeamSpec on a copy of the map with a console window (
TeamSpec.console.exe, when it is besideTeamSpec.exe) that shows everything the game prints. - Quick Playtest / Apply keeps the game open and sends your new scripts to it each time you apply. The status line reports every step, including why a change was refused. A script that steps outside the sandbox is refused like this, and the game keeps the last version that worked:
Playtest could not apply: Map validation failed: server.gd (server script): line 12: `OS` is not available to a server script; the current world is unchanged.
Reading the output
- api.log prints a line tagged with the map and the side:
[gamemode/mymap server] your message. The bot script's lines are taggedservertoo, because it runs there.printworks as well, without the tag. - When the map starts, the game prints the zones it found, for example
[gamemode] mymap: 3 zone(s)followed by their names. If a zone your script expects is missing from that line, check its Is Area box and its Trigger Name. - A player falling out of the world prints where it happened:
[left_world] entity 7 judged out of the world at (...).
Before you test
_player_diedcallsapi.respawn_in, unless nobody should come back.- Every counter the client script shows is declared in the server script's
_declare(), spelt the same way. - Your script compares
api.zone_label(zone)with names that match the zones' Trigger Name exactly, capitals and spaces included. - Every team you use has spawn points, and there is a World Boundary below the map. See Teams and spawning.
When the mode works, export it with File > Export to TeamSpec (.tsmap). See Exporting and publishing.