Level Editor/Entities/Logic entities: Difference between revisions
Jump to navigation
Jump to search
TeamSpecBot (talk | contribs) Level Editor: Logic Relay, Timer and Counter page |
TeamSpecBot (talk | contribs) American spelling |
||
| Line 5: | Line 5: | ||
| exported = yes | | exported = yes | ||
}} | }} | ||
'''Logic entities''' are invisible points that wire a map's | '''Logic entities''' are invisible points that wire a map's behavior together with [[Level Editor/Workflows/Outputs and logic|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 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 Timer''' fires its outputs every few seconds, or at random times. | ||
Latest revision as of 04:44, 20 October 2026
| 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 behavior 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
- Choose Functional > Logic Relay, Logic Timer or Logic Counter.
- 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).
- Rename it in the scene tree: other entities' outputs reach it by its name.
- 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
- Make three buttons, each with Wait below 0 (once a match).
- Place a Logic Counter named
Switcheswith Minimum 0 and Maximum 3. - On each button: output OnPressed → Switches, Add, 1.
- On the counter: output OnHitMax → Hatch, Unlock, where
Hatchis 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.