Each cycle, triggers are evaluated player by player from P1 to P8, and within a player from the top of the file down. Not knowing this order is how you end up with bugs you cannot reproduce.
Say one trigger adds one to a counter and another fires when that counter hits 120. With the adder above, both happen in the same cycle; with it below, the second fires a cycle late.
Trigger { -- 이 트리거가 위에 있으면 같은 사이클에 발동된다
players = {P8},
conditions = {
Always();
},
actions = {
SetDeaths(P8, Add, 1, "SpawnTimer");
PreserveTrigger();
},
}
Trigger {
players = {P8},
conditions = {
Deaths(P8, AtLeast, 120, "SpawnTimer");
},
actions = {
SetDeaths(P8, SetTo, 0, "SpawnTimer");
CreateUnit(1, "Zerg Zergling", "Spawn Point", P8);
PreserveTrigger();
},
}If A writes a value and B reads it in the same cycle, the order of those two triggers is the specification. Re-sorting your trigger file later will silently change behaviour.
Keep interdependent triggers next to each other, and leave a comment saying why they are in that order.
