trigger event||doc135355

September 20, 2022

Trigger

Ready to be deprecated, replaced by BindableEvent

Introduction

Triggers, certain key actions during the game will trigger triggers, such as the player logging into the game, the generation of an entity object, and the entry of an object into an area. Therefore, if we need to monitor the triggering of a certain behavior, we need to register the handler function in the trigger when the behavior is triggered, and we can also customize the monitoring and triggering of a certain behavior.


Common fixed key behaviors

In the game, when certain conditions are met, some specific triggers are automatically triggered, and the creator can use these specific triggers to achieve some functions. Such as:


Function

void CheckTriggers (  config cfg,  string name,  variant context  )

Trigger the event and specify the object, the global event will be triggered regardless of whether the object is specified or not

void CheckTriggersOnly (  config cfg,  string name,  variant context  )

Trigger the event and specify the object, the global event will not be triggered

void RegisterHandler (  config cfg,  string name,  function handler  )

Register the processing callback function that triggers the event (override)

function addHandler (  config cfg,  string name,  function handler  )

Add a processing callback function (call chain) for template trigger events