When Switch Turn Off
Fires when the switch changes to the OFF state.
Introduction
When Switch Turn Off is an event in the Switch group of World Events. It fires when the switch changes to the OFF state. When it fires, the event hands one value to your script: Player, the player who interacted with the switch. Like every event, it does nothing by itself. It waits for the right moment, then runs all the actions connected to it. This event belongs to the Switch component. Open the Switch component guide to see everything the component itself can do. Every OFF completes an ON: this event pairs with When Switch Turns On so both directions of the switch have their own reactions - lights going dark, doors closing, machines stopping. Zone-based alternatives live in When Trigger Entered , and the component wiring is covered in the Object Logic guide. When Switch Turn Off event in the World Editor Image The When Switch Turn Off event in the Script Editor. caption
Parameters
Player the player who flipped the switch to OFF Parameter Description
How to Access
How to Access - Event When Switch Turn Off
How to Use
Select the object, press Propertie (the blue equalizer icon) in the bottom action menu, and scroll to the bottom of the properties panel. Press Add Component and pick the Switch component; its block stacks below the existing properties with the When Switch Turn Off event inside it. The component has exactly two events, When Switch Turn On and When Switch Turn Off : On fires when the switch is flipped on, Off fires when it is flipped off. Press the + button below the event to add a script, then press Edit on that script to open the script editor and build the actions that should run when the event fires. Press Play and flip the switch off, then check that the actions run.
Example
When switch turn off by Player: Execute Player, Player.Controlled Character.Character.Respawn when-switch-turn-off-example.png Respawns the flipping player when the switch turns off. caption
Common Uses
Close a door that opened when the switch turned on Stop a machine that runs while the switch is on Reset mechanisms back to their idle state
Tip
Toggles that need both states (lamps, doors) pair When Switch Turn On with When Switch Turn Off.