• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Trigger fails to work sometimes

Status
Not open for further replies.
Level 18
Joined
May 11, 2012
Messages
2,103
This trigger seems to fail to work sometimes. Any suggestions?

  • Shadow Blast End
    • Events
      • Time - ShadowBlast_Timer expires
    • Conditions
    • Actions
      • Trigger - Turn off Shadow Blast Loop <gen>
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set ShadowBlast_DummyPosition[(Integer A)] = (Position of ShadowBlast_Dummy[(Integer A)])
          • Special Effect - Create a special effect at ShadowBlast_DummyPosition[(Integer A)] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 400.00 of ShadowBlast_DummyPosition[(Integer A)]) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Shadow Blast for ShadowBlast_TrigUnit) Equal to 1
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) belongs to an enemy of (Owner of ShadowBlast_TrigUnit)) Equal to True
                  • ((Picked unit) is alive) Equal to True
                  • ((Picked unit) is dead) Equal to False
                • Then - Actions
                  • Unit - Cause ShadowBlast_TrigUnit to damage (Picked unit), dealing 150.00 damage of attack type Spells and damage type Normal
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Shadow Blast for ShadowBlast_TrigUnit) Equal to 2
                      • ((Picked unit) is A structure) Equal to False
                      • ((Picked unit) belongs to an enemy of (Owner of ShadowBlast_TrigUnit)) Equal to True
                      • ((Picked unit) is alive) Equal to True
                      • ((Picked unit) is dead) Equal to False
                    • Then - Actions
                      • Unit - Cause ShadowBlast_TrigUnit to damage (Picked unit), dealing 300.00 damage of attack type Spells and damage type Normal
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of Shadow Blast for ShadowBlast_TrigUnit) Equal to 3
                          • ((Picked unit) is A structure) Equal to False
                          • ((Picked unit) belongs to an enemy of (Owner of ShadowBlast_TrigUnit)) Equal to True
                          • ((Picked unit) is alive) Equal to True
                          • ((Picked unit) is dead) Equal to False
                        • Then - Actions
                          • Unit - Cause ShadowBlast_TrigUnit to damage (Picked unit), dealing 600.00 damage of attack type Spells and damage type Normal
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Level of Shadow Blast for ShadowBlast_TrigUnit) Equal to 4
                              • ((Picked unit) is A structure) Equal to False
                              • ((Picked unit) belongs to an enemy of (Owner of ShadowBlast_TrigUnit)) Equal to True
                              • ((Picked unit) is alive) Equal to True
                              • ((Picked unit) is dead) Equal to False
                            • Then - Actions
                              • Unit - Cause ShadowBlast_TrigUnit to damage (Picked unit), dealing 1200.00 damage of attack type Spells and damage type Normal
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Level of Shadow Blast for ShadowBlast_TrigUnit) Equal to 5
                                  • ((Picked unit) is A structure) Equal to False
                                  • ((Picked unit) belongs to an enemy of (Owner of ShadowBlast_TrigUnit)) Equal to True
                                  • ((Picked unit) is alive) Equal to True
                                  • ((Picked unit) is dead) Equal to False
                                • Then - Actions
                                  • Unit - Cause ShadowBlast_TrigUnit to damage (Picked unit), dealing 2400.00 damage of attack type Spells and damage type Normal
                                • Else - Actions
          • Custom script: call RemoveLocation(udg_ShadowBlast_DummyPosition[GetForLoopIndexA()])
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I hate how you code the ifs :(
You must learn to use arrays
Sometimes, math would be an even better option. The damage dealt here is 150 * 2level - 1. This can be simplified as 75 * 2level.
But since powers kinda suck in WC3, go for arrays :).

Also: don't use both "Is Alive equal to true" and "Is Dead equal to false". That's 2 times the same thing.
Always use "Is Dead equal to false" (unless you want him to be dead, then "If Dead equal to true" :D).

What Radamantus means: (probably)
  • Shadow Blast End
    • Events
      • Time - ShadowBlast_Timer expires
    • Conditions
    • Actions
      • Trigger - Turn off Shadow Blast Loop <gen>
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set ShadowBlast_DummyPosition[(Integer A)] = (Position of ShadowBlast_Dummy[(Integer A)])
          • Special Effect - Create a special effect at ShadowBlast_DummyPosition[(Integer A)] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 400.00 of ShadowBlast_DummyPosition[(Integer A)]) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) belongs to an enemy of (Owner of ShadowBlast_TrigUnit)) Equal to True
                  • ((Picked unit) is dead) Equal to False
                • Then - Actions
                  • Unit - Cause ShadowBlast_TrigUnit to damage (Picked unit), dealing ShadowBlast_Damage[Level of Shadow Blast for unit] damage of attack type Spells and damage type Normal
          • Custom script: call RemoveLocation(udg_ShadowBlast_DummyPosition[GetForLoopIndexA()])
 
Level 18
Joined
May 11, 2012
Messages
2,103
Sometimes, math would be an even better option. The damage dealt here is 150 * 2level - 1. This can be simplified as 75 * 2level.
But since powers kinda suck in WC3, go for arrays :).

Also: don't use both "Is Alive equal to true" and "Is Dead equal to false". That's 2 times the same thing.
Always use "Is Dead equal to false" (unless you want him to be dead, then "If Dead equal to true" :D).

What Radamantus means: (probably)
  • Shadow Blast End
    • Events
      • Time - ShadowBlast_Timer expires
    • Conditions
    • Actions
      • Trigger - Turn off Shadow Blast Loop <gen>
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set ShadowBlast_DummyPosition[(Integer A)] = (Position of ShadowBlast_Dummy[(Integer A)])
          • Special Effect - Create a special effect at ShadowBlast_DummyPosition[(Integer A)] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 400.00 of ShadowBlast_DummyPosition[(Integer A)]) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) belongs to an enemy of (Owner of ShadowBlast_TrigUnit)) Equal to True
                  • ((Picked unit) is dead) Equal to False
                • Then - Actions
                  • Unit - Cause ShadowBlast_TrigUnit to damage (Picked unit), dealing ShadowBlast_Damage[Level of Shadow Blast for unit] damage of attack type Spells and damage type Normal
          • Custom script: call RemoveLocation(udg_ShadowBlast_DummyPosition[GetForLoopIndexA()])


I'm posting back because it again doesn't works for all 4 loops, only the first one...
  • Shadow Blast End
    • Events
      • Time - ShadowBlast_Timer expires
    • Conditions
    • Actions
      • Trigger - Turn off Shadow Blast Loop <gen>
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set ShadowBlast_DummyPosition[(Integer A)] = (Position of ShadowBlast_Dummy[(Integer A)])
          • Special Effect - Create a special effect at ShadowBlast_DummyPosition[(Integer A)] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 400.00 of ShadowBlast_DummyPosition[(Integer A)]) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) belongs to an enemy of (Owner of ShadowBlast_TrigUnit)) Equal to True
                  • ((Picked unit) is dead) Equal to False
                • Then - Actions
                  • Unit - Cause ShadowBlast_TrigUnit to damage (Picked unit), dealing ShadowBlast_Damage[(Level of Shadow Blast for ShadowBlast_TrigUnit)] damage of attack type Spells and damage type Normal
                • Else - Actions
          • Custom script: call RemoveLocation(udg_ShadowBlast_DummyPosition[GetForLoopIndexA()])
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
It should work for the entire loop.
The only flaws I can see are minor ("ShadowBlast_DummyPosition" shouldn't be an array and you can combine the conditions with the unit-group pick).
That said, I am absolutely convinced the trigger itself works fine, on the condition that all variables are set up properly.

Where do you set the "ShadowBlast_Damage"? And the "ShadowBlast_Dummy"?
Another problem might be the "Integer A" loop you use: it's safer to use a variable loop.
 
Status
Not open for further replies.
Top