Level Editor/Entities/Logic entities

From TeamSpec Wiki
Revision as of 03:45, 20 October 2026 by TeamSpecBot (talk | contribs) (Level Editor: Logic Relay, Timer and Counter page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Logic entities
Made with Functional > Logic Relay, Logic Timer, Logic Counter
What it is Invisible points that pass triggers on, fire on a timer, or count
In the game Yes, it is exported with the map

Logic entities are invisible points that wire a map's behaviour together with outputs, without a script:

  • A Logic Relay passes a trigger on to its outputs: a name to hang several outputs on, and a switch in the middle of a chain.
  • A Logic Timer fires its outputs every few seconds, or at random times.
  • A Logic Counter counts what its inputs add and fires its outputs at its limits.

Placing one

  1. Choose Functional > Logic Relay, Logic Timer or Logic Counter.
  2. Click anywhere to place it (where it stands does not matter to the game; put it near what it controls so you can find it).
  3. Rename it in the scene tree: other entities' outputs reach it by its name.
  4. Set it and its outputs in the inspector.

In the scene tree each one's row shows its kind and how many outputs it fires.

Logic Relay

Setting Type Default What it does
Starts Disabled Check box Off It ignores Trigger until something sends it Enable.
  • Event: OnTrigger (the relay was triggered; the activator is the trigger's).
  • Inputs: Trigger (fire OnTrigger, unless disabled), Enable, Disable (ignore Trigger; outputs already waiting on their delay still fire), Toggle, CancelPending (drop every output of this relay still waiting on its delay).

Logic Timer

Setting Type Default What it does
Interval Seconds, 0.02 or more 1.0 Time between fires.
Random Check box Off Wait a random time between Interval Min and Interval Max each time, instead of Interval.
Interval Min Seconds 1.0 Shortest random wait.
Interval Max Seconds 2.0 Longest random wait.
Starts Disabled Check box Off It waits for Enable before it starts.
  • Event: OnTimer (the interval ran out, or the timer took FireTimer).
  • Inputs: Enable (start it), Disable (stop it), Toggle, FireTimer (fire OnTimer now, and start the interval again if it runs), RefireTime (parameter: seconds between fires; starts the interval again if it runs).

Logic Counter

Setting Type Default What it does
Start Value Number 0 Its value when the map starts.
Minimum Number 0 The lowest it goes.
Maximum Number 0 The highest it goes. The same value as Minimum means no limits.
Starts Disabled Check box Off It ignores Add, Subtract and SetValue until something sends it Enable.
  • Events: OutValue (the value changed; an output of it with no parameter passes the value along), OnHitMin and OnHitMax (it reached a limit).
  • Inputs: Add, Subtract and SetValue (parameter: the amount or the new value), Enable, Disable.

Example: three switches unlock a hatch

  1. Make three buttons, each with Wait below 0 (once a match).
  2. Place a Logic Counter named Switches with Minimum 0 and Maximum 3.
  3. On each button: output OnPressed → Switches, Add, 1.
  4. On the counter: output OnHitMax → Hatch, Unlock, where Hatch is a locked door.

In a script

_logic_event(entity, event, activator) hears every relay, timer, counter and button event; api.counter_value reads a counter; api.fire_input sends any input. Give each logic entity its own name: outputs reach only the first of two with the same name.

Related pages

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