• Reference
  • ECA
  • Multilayer Structure of Triggers

Multilayer Structure of Triggers

The logic of some complex games needs to be implemented through complex Trigger statements such as compound conditions and loops.

Sub-trigger

You can create a Sub-trigger in the Action of a Trigger. When the project logic runs to the location of the Sub-trigger, the project logic enters the Sub-trigger process, that is, it judges the Event and Condition of the Trigger in turn and then runs the Action of the Sub-trigger. After running the Sub-trigger, you can run the next Action in the Trigger. You only need to right-click the action and select New Sub-trigger to create a new Sub-trigger.

E23

After the Sub-trigger is run, the unit will be moved to the corresponding point.

E24

Variable Scope of a Sub-trigger

Global Variables can be valid within the scope of any Trigger and its Sub-triggers. Local Variables can be valid within the scope of the current Trigger and its Sub-triggers. Sub-trigger Local Variables can be valid within only the scope of the current Sub-trigger.

E25

If variable B is declared inside a Sub-trigger, you can use B inside the Sub-trigger and cannot use it outside the Sub-trigger.

E26

Process Statement - Compound Condition

You can use Compound Condition statements to execute complex logic.

E27

  • Perform the setting that an action can be executed only when all conditions are met.

The statement below indicates that if A is equal to 1 AND B is equal to 1, the Unit will be moved to the Point, where A and B are local variables of the integer type.

E28

  • Perform the setting that an action is executed when any condition is met.

The statement below indicates that if the integer A is equal to 1 OR the integer B is equal to 1, the Unit will be moved to the set Point.

E29

  • Perform the setting that an action is executed when none of the conditions is met.

The statement below indicates that if the integer A is NOT equal to 1 AND the integer B is NOT equal to 1, the Unit will be moved to the set Point.

E30

  • Perform the setting that event A is triggered if conditions are met and event B is triggered if conditions are not met.

The statement below indicates that if A is equal to 1, the Unit will be moved to the set Point A; otherwise, the Unit is moved to Point B.

E31

Loop

You can use a loop to make a set of trigger statements run repeatedly.

  • Execute Action an Integer Number of Times

An action is repeatedly executed with the Specified Integer Variable as the number of execution times.

E32

For example, the statement below indicates that three Sparta Units that belong to Player 1 are created at Point A, with the Unit facing the 180° direction, where Point A is a local variable of point.

E33

  • Repeat Action when Condition Met

A loop lasts an infinite number of times until the set condition is met.

E34

For example, the statement below indicates that if A is equal to 1, a Sparta Unit that belongs to Player 1 is created at Point A, with the unit facing the 180° direction.

E35

Timer

Timers can be used to process the game logic related to time.

  • Run Single Timer

An Action is executed after the Timer runs once.

E36

For example, the statement below indicates that the Unit is moved to Point A 3 seconds later, where Point A is a point local variable.

E37

  • Run Looped Timer

The Timer runs circularly and the Action is executed after each running.

E38

For example, the statement below indicates that the Unit is moved to Point A every 3 seconds.

Note: You can select True and execute the Action immediately (as shown below) or select False and execute the first action 3 seconds later.

E39

  • Run Count Timer

A Timer that stays for a fixed time and a fixed number of times in the process.

E40

For example, the statement below indicates that the Unit is moved to Point A every 3 seconds and the Action is executed immediately 3 times in total.

E41

Unit Group

A Unit Group is a collection of one or more Units, reserving the way units operate. You can directly perform repeated operations on a unit group.

  • Pick Unit in Unit Group to Perform Action

An action is executed for each Unit in a Unit Group.

E42

For example, the statement below indicates that all Units at Point A in Unit Group AA are resurrected, where AA is a local variable of Unit Group and Point A is a local variable of Point.

E43

Player Group

A Player Group is a collection of one or more players. You can directly operate on all players in a player group.

  • Pick Player in Player Group to Perform Action

The set Action takes effect on all players in the player group.

E44

For example, the statement below indicates that a Sparta Unit is created at Point A and is assigned to each player in Player Group BB, with the unit facing the 180° angle, where BB is a local variable of Player Group and Point A is a local variable of Point.

E45

Mover

A Mover can add motion effects for Units or Particles, for example, moving along a straight line and tracking a unit. It is a common function to create ability and particle.

E46

You can set the Direction, Distance, Initial Speed, and Acceleration of the Mover. You can also achieve these effects through Trigger during the operation of the Mover.

Direction: Movement direction of the linear Mover.

Distance: Maximum distance for the Mover effect.

Initial Speed: Initial speed when the Mover is released.

Acceleration: Acceleration after the Mover is released.

Optional Parameters: Click 【Parameter List】 to set other parameters.

E47

E48

E49