• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Solved] Would these loops and Integer A conflict with each other?

Status
Not open for further replies.
Level 6
Joined
Feb 22, 2009
Messages
212
To make it simple, these 2 spells can summon multiple types of wards. Since multiple players can select this hero, they can all use these spells at the same time.

What I afraid is the Integer A would conflict with each other when the triggers were running.

  • Bless
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoning unit)) Equal to Shadow Hunter (Sogat)
      • (Unit-type of (Summoned unit)) Equal to Ward - War Drum
    • Actions
      • Set SummonedUnit[175] = (Summoned unit)
      • Set SummoningUnit[175] = (Summoning unit)
      • Set AbilityPointArray[175] = (Position of SummonedUnit[175])
      • Set AbilityArray[175] = Blessing Totem (Elite)
      • Unit - Set Armor of SummonedUnit[175] to ShadowHunterVar[(Level of AbilityArray[175] for SummoningUnit[175])]
      • Unit - Set Base Damage of SummonedUnit[175] to (Integer(ShadowHunterVar[((Level of AbilityArray[175] for SummoningUnit[175]) + 6)])) for weapon index: 1
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Blessing Totem (Elite) for SummoningUnit[175]) Equal to 2
        • Then - Actions
          • Set AbilityPointArray[176] = (AbilityPointArray[175] offset by 75.00 towards 90.00 degrees)
          • Unit - Create 1 Ward - Bloodlust for (Owner of SummoningUnit[175]) at AbilityPointArray[176] facing AbilityPointArray[175]
          • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
          • Custom script: call RemoveLocation (udg_AbilityPointArray[176])
        • Else - Actions
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Blessing Totem (Elite) for SummoningUnit[175]) Equal to 3
        • Then - Actions
          • For each (Integer A) from 1 to 2, do (Actions)
            • Loop - Actions
              • Set MathOp[175] = (180.00 x (Real((Integer A))))
              • Set MathOp[176] = (MathOp[175] - 90.00)
              • Set AbilityPointArray[176] = (AbilityPointArray[175] offset by 75.00 towards MathOp[176] degrees)
              • Unit - Create 1 Ward - Bloodlust for (Owner of SummoningUnit[175]) at AbilityPointArray[176] facing AbilityPointArray[175]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[176])
        • Else - Actions
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Blessing Totem (Elite) for SummoningUnit[175]) Equal to 4
        • Then - Actions
          • For each (Integer A) from 1 to 2, do (Actions)
            • Loop - Actions
              • Set MathOp[175] = (180.00 x (Real((Integer A))))
              • Set MathOp[176] = (MathOp[175] - 90.00)
              • Set AbilityPointArray[176] = (AbilityPointArray[175] offset by 75.00 towards MathOp[176] degrees)
              • Unit - Create 1 Ward - Bloodlust for (Owner of SummoningUnit[175]) at AbilityPointArray[176] facing AbilityPointArray[175]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[176])
          • For each (Integer A) from 1 to 2, do (Actions)
            • Loop - Actions
              • Set MathOp[177] = (180.00 x (Real((Integer A))))
              • Set AbilityPointArray[177] = (AbilityPointArray[175] offset by 75.00 towards MathOp[177] degrees)
              • Unit - Create 1 Ward - Bless for (Owner of SummoningUnit[175]) at AbilityPointArray[177] facing AbilityPointArray[175]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[177])
        • Else - Actions
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Blessing Totem (Elite) for SummoningUnit[175]) Equal to 5
        • Then - Actions
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • Set MathOp[175] = (144.00 x (Real((Integer A))))
              • Set MathOp[176] = (MathOp[175] - 72.00)
              • Set AbilityPointArray[176] = (AbilityPointArray[175] offset by 75.00 towards MathOp[176] degrees)
              • Unit - Create 1 Ward - Bloodlust for (Owner of SummoningUnit[175]) at AbilityPointArray[176] facing AbilityPointArray[175]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[176])
          • For each (Integer A) from 1 to 2, do (Actions)
            • Loop - Actions
              • Set MathOp[177] = (144.00 x (Real((Integer A))))
              • Set AbilityPointArray[177] = (AbilityPointArray[175] offset by 75.00 towards MathOp[177] degrees)
              • Unit - Create 1 Ward - Bless for (Owner of SummoningUnit[175]) at AbilityPointArray[177] facing AbilityPointArray[175]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[177])
        • Else - Actions
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Blessing Totem (Elite) for SummoningUnit[175]) Equal to 6
        • Then - Actions
          • Unit - Set level of Ward - War Drums for SummonedUnit[175] to 2
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • Set MathOp[175] = (144.00 x (Real((Integer A))))
              • Set MathOp[176] = (MathOp[175] - 72.00)
              • Set AbilityPointArray[176] = (AbilityPointArray[175] offset by 75.00 towards MathOp[176] degrees)
              • Unit - Create 1 Ward - Bloodlust for (Owner of SummoningUnit[175]) at AbilityPointArray[176] facing AbilityPointArray[175]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[176])
          • For each (Integer A) from 1 to 2, do (Actions)
            • Loop - Actions
              • Set MathOp[177] = (144.00 x (Real((Integer A))))
              • Set AbilityPointArray[177] = (AbilityPointArray[175] offset by 75.00 towards MathOp[177] degrees)
              • Unit - Create 1 Ward - Bless for (Owner of SummoningUnit[175]) at AbilityPointArray[177] facing AbilityPointArray[175]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[177])
        • Else - Actions
      • -------- ---------------------------------------------------------------------- --------
      • Custom script: call RemoveLocation (udg_AbilityPointArray[175])

  • Curse
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoning unit)) Equal to Shadow Hunter (Sogat)
      • (Unit-type of (Summoned unit)) Equal to Ward - Abolish Magic
    • Actions
      • Set SummonedUnit[180] = (Summoned unit)
      • Set SummoningUnit[180] = (Summoning unit)
      • Set AbilityPointArray[180] = (Position of SummonedUnit[180])
      • Set AbilityArray[180] = Cursing Ward (Elite)
      • Unit - Set Armor of SummonedUnit[180] to ShadowHunterVar[(Level of AbilityArray[180] for SummoningUnit[180])]
      • Unit - Add AbilityArray[((Level of AbilityArray[180] for SummoningUnit[180]) + 180)] to SummonedUnit[180]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Cursing Ward (Elite) for (Summoning unit)) Equal to 1
        • Then - Actions
          • Set AbilityPointArray[181] = (AbilityPointArray[180] offset by 50.00 towards 180.00 degrees)
          • Unit - Create 1 Ward - Abolish Magic for (Owner of SummoningUnit[180]) at AbilityPointArray[181] facing AbilityPointArray[180]
          • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
          • Unit - Set Armor of (Last created unit) to ShadowHunterVar[(Level of AbilityArray[180] for SummoningUnit[180])]
          • -------- Corruption passive --------
          • Unit - Add AbilityArray[((Level of AbilityArray[180] for SummoningUnit[180]) + 180)] to (Last created unit)
          • Custom script: call RemoveLocation (udg_AbilityPointArray[181])
        • Else - Actions
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Cursing Ward (Elite) for (Summoning unit)) Equal to 2
        • Then - Actions
          • Set AbilityPointArray[181] = (AbilityPointArray[180] offset by 80.00 towards 180.00 degrees)
          • Unit - Create 1 Ward - Abolish Magic for (Owner of SummoningUnit[180]) at AbilityPointArray[181] facing AbilityPointArray[180]
          • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
          • Unit - Set Armor of (Last created unit) to ShadowHunterVar[(Level of AbilityArray[180] for SummoningUnit[180])]
          • -------- Corruption passive --------
          • Unit - Add AbilityArray[((Level of AbilityArray[180] for SummoningUnit[180]) + 180)] to (Last created unit)
          • Custom script: call RemoveLocation (udg_AbilityPointArray[181])
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • Set MathOp[180] = (Real((Integer A)))
              • Set MathOp[181] = (MathOp[180] x 120.00)
              • Set AbilityPointArray[182] = (AbilityPointArray[180] offset by 50.00 towards MathOp[181] degrees)
              • Unit - Create 1 Ward - Curse for (Owner of SummonedUnit[180]) at AbilityPointArray[182] facing AbilityPointArray[180]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[182])
        • Else - Actions
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Cursing Ward (Elite) for (Summoning unit)) Equal to 3
        • Then - Actions
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • Set MathOp[180] = (Real((Integer A)))
              • Set MathOp[181] = (MathOp[180] x 120.00)
              • Set MathOp[182] = (MathOp[181] - 60.00)
              • Set AbilityPointArray[181] = (AbilityPointArray[180] offset by 80.00 towards MathOp[182] degrees)
              • Unit - Create 1 Ward - Abolish Magic for (Owner of SummoningUnit[180]) at AbilityPointArray[181] facing AbilityPointArray[180]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Unit - Set Armor of (Last created unit) to ShadowHunterVar[(Level of AbilityArray[180] for SummoningUnit[180])]
              • -------- Corruption passive --------
              • Unit - Add AbilityArray[((Level of AbilityArray[180] for SummoningUnit[180]) + 180)] to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[181])
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • Set MathOp[183] = (Real((Integer A)))
              • Set MathOp[184] = (MathOp[183] x 120.00)
              • Set AbilityPointArray[182] = (AbilityPointArray[180] offset by 50.00 towards MathOp[184] degrees)
              • Unit - Create 1 Ward - Curse for (Owner of SummonedUnit[180]) at AbilityPointArray[182] facing AbilityPointArray[180]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[182])
        • Else - Actions
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Cursing Ward (Elite) for (Summoning unit)) Equal to 4
        • Then - Actions
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • Set MathOp[180] = (Real((Integer A)))
              • Set MathOp[181] = (MathOp[180] x 120.00)
              • Set MathOp[182] = (MathOp[181] - 60.00)
              • Set AbilityPointArray[181] = (AbilityPointArray[180] offset by 80.00 towards MathOp[182] degrees)
              • Unit - Create 1 Ward - Abolish Magic for (Owner of SummoningUnit[180]) at AbilityPointArray[181] facing AbilityPointArray[180]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Unit - Set Armor of (Last created unit) to ShadowHunterVar[(Level of AbilityArray[180] for SummoningUnit[180])]
              • -------- Corruption passive --------
              • Unit - Add AbilityArray[((Level of AbilityArray[180] for SummoningUnit[180]) + 180)] to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[181])
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • Set MathOp[183] = (Real((Integer A)))
              • Set MathOp[184] = (MathOp[183] x 120.00)
              • Set AbilityPointArray[182] = (AbilityPointArray[180] offset by 50.00 towards MathOp[184] degrees)
              • Unit - Create 1 Ward - Curse for (Owner of SummonedUnit[180]) at AbilityPointArray[182] facing AbilityPointArray[180]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[182])
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • Set MathOp[185] = (Real((Integer A)))
              • Set MathOp[186] = (MathOp[185] x 120.00)
              • Set MathOp[187] = (MathOp[186] + 30.00)
              • Set AbilityPointArray[183] = (AbilityPointArray[180] offset by 40.00 towards MathOp[187] degrees)
              • Unit - Create 1 Ward - Slow for (Owner of SummonedUnit[180]) at AbilityPointArray[183] facing AbilityPointArray[180]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[183])
        • Else - Actions
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Cursing Ward (Elite) for (Summoning unit)) Equal to 5
        • Then - Actions
          • For each (Integer A) from 1 to 5, do (Actions)
            • Loop - Actions
              • Set MathOp[180] = (Real((Integer A)))
              • Set MathOp[181] = (MathOp[180] x 72.00)
              • Set AbilityPointArray[181] = (AbilityPointArray[180] offset by 80.00 towards MathOp[181] degrees)
              • Unit - Create 1 Ward - Abolish Magic for (Owner of SummoningUnit[180]) at AbilityPointArray[181] facing AbilityPointArray[180]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Unit - Set Armor of (Last created unit) to ShadowHunterVar[(Level of AbilityArray[180] for SummoningUnit[180])]
              • -------- Corruption passive --------
              • Unit - Add AbilityArray[((Level of AbilityArray[180] for SummoningUnit[180]) + 180)] to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[181])
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • Set MathOp[182] = (Real((Integer A)))
              • Set MathOp[183] = (MathOp[182] x 120.00)
              • Set AbilityPointArray[182] = (AbilityPointArray[180] offset by 50.00 towards MathOp[183] degrees)
              • Unit - Create 1 Ward - Curse for (Owner of SummonedUnit[180]) at AbilityPointArray[182] facing AbilityPointArray[180]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[182])
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • Set MathOp[184] = (Real((Integer A)))
              • Set MathOp[185] = (MathOp[184] x 120.00)
              • Set MathOp[186] = (MathOp[185] + 30.00)
              • Set AbilityPointArray[183] = (AbilityPointArray[180] offset by 40.00 towards MathOp[186] degrees)
              • Unit - Create 1 Ward - Slow for (Owner of SummonedUnit[180]) at AbilityPointArray[183] facing AbilityPointArray[180]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[183])
        • Else - Actions
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Cursing Ward (Elite) for (Summoning unit)) Equal to 6
        • Then - Actions
          • For each (Integer A) from 1 to 5, do (Actions)
            • Loop - Actions
              • Set MathOp[180] = (Real((Integer A)))
              • Set MathOp[181] = (MathOp[180] x 72.00)
              • Set AbilityPointArray[181] = (AbilityPointArray[180] offset by 80.00 towards MathOp[181] degrees)
              • Unit - Create 1 Ward - Abolish Magic for (Owner of SummoningUnit[180]) at AbilityPointArray[181] facing AbilityPointArray[180]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Unit - Set Armor of (Last created unit) to ShadowHunterVar[(Level of AbilityArray[180] for SummoningUnit[180])]
              • -------- Corruption passive --------
              • Unit - Add AbilityArray[((Level of AbilityArray[180] for SummoningUnit[180]) + 180)] to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[181])
          • For each (Integer A) from 1 to 4, do (Actions)
            • Loop - Actions
              • Set MathOp[182] = (Real((Integer A)))
              • Set MathOp[183] = (MathOp[182] x 90.00)
              • Set AbilityPointArray[182] = (AbilityPointArray[180] offset by 40.00 towards MathOp[183] degrees)
              • Unit - Create 1 Ward - Curse for (Owner of SummonedUnit[180]) at AbilityPointArray[182] facing AbilityPointArray[180]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[182])
          • For each (Integer A) from 1 to 4, do (Actions)
            • Loop - Actions
              • Set MathOp[185] = (Real((Integer A)))
              • Set MathOp[186] = (MathOp[185] x 120.00)
              • Set MathOp[187] = (MathOp[186] + 45.00)
              • Set AbilityPointArray[183] = (AbilityPointArray[180] offset by 40.00 towards MathOp[187] degrees)
              • Unit - Create 1 Ward - Slow for (Owner of SummonedUnit[180]) at AbilityPointArray[183] facing AbilityPointArray[180]
              • Unit - Add a 60.00 second Healing Ward expiration timer to (Last created unit)
              • Custom script: call RemoveLocation (udg_AbilityPointArray[183])
        • Else - Actions
      • Custom script: call RemoveLocation (udg_AbilityPointArray[180])
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,579
No, your two triggers will NEVER run at the same time in their current state. Your triggers are fine.

Understand that aside from special cases, no two triggers will ever happen at the same time. This goes for multiple instances of the same trigger as well.
For example, if you had a trigger with the "A unit dies" Event and 10 units died at the same time, that trigger would run 10 times, creating 10 instances of itself, each instance executing in an order determined by the game. Technically these triggers happen all at once, but in an organized way so that no trigger conflicts with another.

HOWEVER, here's what you need to be worried about. Some Actions can cause Events to run, for example, Killing a unit during a trigger can cause the "A unit dies" Event to run. Now depending on the type of Action/Event in question, this can cause another trigger to run DURING the execution of your first trigger. What happens here is that the two or more triggers meld together and form one single trigger. This is when issues can arise because they're no longer sequenced in an organized order, instead the Actions of the other triggers are inserted into the first trigger.

I want to reiterate, what I said here isn't ALWAYS true. It really depends on the Action/Event in question.

Here's an example of an Action/Event that can cause problems with one another:
  • First Trigger
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Paladin for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Variable Hero = (Last created unit)
      • Unit - Kill (Last created unit)
      • Game - Display to (All players) for 30.00 seconds the text: (Name of Hero)
  • Second Trigger
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set Variable Hero = No unit

Looking at the two triggers above, here is the end result:
  • Result
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Paladin for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Variable Hero = (Last created unit)
      • Unit - Kill (Last created unit)
      • Set Variable Hero = No unit
      • Game - Display to (All players) for 30.00 seconds the text: (Name of Hero)
The Actions of the second trigger were inserted directly into the first trigger. This insertion happened directly after the action that caused the second trigger to run (Kill Unit). Now you can see why this would be an issue, the Text Message isn't going to display the Name of Hero because Hero is set to No unit.


So how do you avoid this issue? It's simple, whenever you're making a trigger you should ask yourself which of these Actions can set off an Event?

The only action that I see in your triggers is Create Unit, which can potentially set off the "A unit Enters region" Event:
  • Unit - Create 1 whatever...

HOWEVER, in this particular case you don't have to worry about the Create unit action causing problems. The Create unit Action and the Enters region Event do not cause this combining effect to happen, both triggers will execute separately. But that's not always the case! Like my earlier example, some Actions/Events WILL cause this problematic combining effect to happen. It's inconsistent which is annoying but if you want to avoid bugs than you'll need to be aware of this potential issue.
 
Last edited:
Level 6
Joined
Feb 22, 2009
Messages
212
No, your two triggers will NEVER run at the same time in their current state. Your triggers are fine.

Understand that aside from special cases, no two triggers will ever happen at the same time. This goes for multiple instances of the same trigger as well.
For example, if you had a trigger with the "A unit dies" Event and 10 units died at the same time, that trigger would run 10 times, creating 10 instances of itself, each instance executing in an order determined by the game. Technically these triggers happen all at once, but in an organized way so that no trigger conflicts with another.

HOWEVER, here's what you need to be worried about. Some Actions can cause Events to run, for example, Killing a unit during a trigger can cause the "A unit dies" Event to run. Now depending on the type of Action/Event in question, this can cause another trigger to run DURING the execution of your first trigger. What happens here is that the two or more triggers meld together and form one single trigger. This is when issues can arise because they're no longer sequenced in an organized order, instead the Actions of the other triggers are inserted into the first trigger.

I want to reiterate, what I said here isn't ALWAYS true. It really depends on the Action/Event in question.

Here's an example of an Action/Event that can cause problems with one another:
  • First Trigger
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Paladin for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Variable Hero = (Last created unit)
      • Unit - Kill (Last created unit)
      • Game - Display to (All players) for 30.00 seconds the text: (Name of Hero)
  • Second Trigger
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set Variable Hero = No unit

Looking at the two triggers above, here is the end result:
  • Result
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit - Create 1 Paladin for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Variable Hero = (Last created unit)
      • Unit - Kill (Last created unit)
      • Set Variable Hero = No unit
      • Game - Display to (All players) for 30.00 seconds the text: (Name of Hero)
The Actions of the second trigger were inserted directly into the first trigger. This insertion happened directly after the action that caused the second trigger to run (Kill Unit). Now you can see why this would be an issue, the Text Message isn't going to display the Name of Hero because Hero is set to No unit.


So how do you avoid this issue? It's simple, whenever you're making a trigger you should ask yourself which of these Actions can set off an Event?

The only action that I see in your triggers is Create Unit, which can potentially set off the "A unit Enters region" Event:
  • Unit - Create 1 whatever...

HOWEVER, in this particular case you don't have to worry about the Create unit action causing problems. The Create unit Action and the Enters region Event do not cause this combining effect to happen, both triggers will execute separately. But that's not always the case! Like my earlier example, some Actions/Events WILL cause this problematic combining effect to happen. It's inconsistent which is annoying but if you want to avoid bugs than you'll need to be aware of this potential issue.
I never fully understand this issue. I always thought if the “unit dies” event triggers its co-respondent action wouldn’t the condition deter the trigger from happening?

Like if the unit dies event has a condition of the killing unit type being something, wouldn’t that stop the trigger from executing its actions?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,579
Of course, I figured that was self-explanatory but I see why my explanation could confuse you. I'm talking about cases where you aren't filtering everything with conditions.

Also, the Event still goes off which will change any Event Responses it uses. Triggering unit being the exception since it's more like a local variable than a global one. This is generally not an issue though.
 
Status
Not open for further replies.
Top