Level Editor/Scripting/Testing

From TeamSpec Wiki
Revision as of 03:46, 20 October 2026 by TeamSpecBot (talk | contribs) (Level Editor: testing a gamemode)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 beside TeamSpec.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 tagged server too, because it runs there. print works 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_died calls api.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.

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