• Guides
  • Example Projects
  • Operation of Trigger Editor

Operation of Trigger Editor

The ECAs that should be written in Trigger Editor are those unrelated to the states of the unit or with complex structures, for example, monster refresh mechanism and level passing judgment.

Initialize a Game

Set the Camera to follow a unit, set the unit model for a player, and disable mouse-click selection and mouse-drag selection to prevent accidental click.


Monster Refresh Mechanism

Region Judgment

The core mechanism of monster refresh is: If the player enters the region of a game level and there are no remaining monsters on the field, the monsters at this game level should be refreshed.

The prerequisite for entering the region is that the player moves. Therefore, Unit moving is selected for the Event.


At the first level, no monsters are generated on the field. Therefore, it is only necessary to check whether the player enters the region of the level.


After the check shows that the player enters the region of the level, set the refresh time and number of monsters to be refreshed through a timer.


After monsters are generated, the region is removed and duplicate triggers are placed.


Monster Empty Judgment

The mechanism for emptying monsters is complex and cannot be written in Object Editor - Trigger. Therefore, you need to create a trigger in Trigger Editor. The prerequisite for emptying monsters is that the player kills monsters. Therefore, the Event should be set as below.


For Action, firstly you need to determine whether the killed unit is the corresponding enemy. Therefore, you need to create an IF statement as below.


When the Condition is met, each time after the Event is triggered, one enemy is killed, which means the total number of enemies is reduced by one.


Next, when the number of enemies in the first wave is equal to 0, it indicates that the enemies at this level are completely killed. Set the Boolean variable First wave is dead to True. In this way, when you need to determine whether the monsters need to be refreshed, you only need to determine the Boolean variables of the region and level.


Add New Hero Abilities

Similar to the previous, determine whether the Condition is met. If the condition is met, the Action is executed.


After an ability is added to a hero, clear feedback needs to be sent to the player as information. Therefore, you need to add a particle and a scene interface to inform the player that he/she has obtained a new ability.


After the number of abilities increases, the timer is removed and the variable is set to true to prevent duplicate operations.