Essentials Series/Triggers: Difference between revisions

no edit summary
m (Seil moved page Triggers to Essentials Series/Triggers without leaving a redirect)
No edit summary
Line 3:
 
== Using Triggers ==
[[Industrial Park (level editor)|Industrial Park]] has three trigger [[../Asset Templates/|templates]]: one for sphere triggers, one for box triggers and one for cylinder triggers. You can also change the type of an already placed trigger, but this can result in a glitchy trigger (if you really need to change the type of an existing trigger, I would recommend placing a new trigger, copying over the links and the name and deleting the original one).
 
=== Sphere Triggers ===
Line 27:
* '''EnterCruise''' and '''ExitCruise''': similar to the ones above, but sent by the Cruise Bubble.
 
Other events commonly used with triggers are Enable and Disable. The EnabledOnStart and Persistent flags (explained in the [[../Dispatchers/]] page) are useful with triggers, because a disabled trigger does not send any events, and many times we want triggers to only function in some conditions.
 
A simple use case of this: you want to make a race against a timer. At the finish point, use two triggers: one which causes the player to win the race, and one which causes the player to lose it. Normally, both start disabled. When the race's timer starts, the win trigger is enabled. When the timer expires, it means the player lost. At this point, the win trigger should be disabled and the lose trigger enabled.
 
=== Source Check ===
Source Check is a field present in every [[../Links/|link]] and editable in the [[../Links/#Link List Editor|Link List Editor]]. This field is usually empty, but it works on any link, and is specially useful with triggers and the EnterEntity and ExitEntity events. This is because the Source Check filters which asset will trigger that link; the event will only be sent if the asset which sent it matches the Source Check. For example:
 
* Trigger TRIGGER_01 has a link which is EnterEntity => Run => TIMER_01, with nothing in the source check.