• 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.

24

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.

25

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.

26

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.

27

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

28

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.

29

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.

30

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.

31

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.

32

Add New Hero Abilities

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

33

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.

34

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

35