• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Why doesnt this trigger deal damage after "wait 3 seconds"

Status
Not open for further replies.
Level 2
Joined
Jun 1, 2017
Messages
25
^Title

  • Hail of arrows
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hail of Arrows
    • Actions
      • Unit - Create 1 Dummy Rain of arrows for Player 1 (Red) at (Target point of ability being cast) facing Default building facing degrees
      • Set HailOfArrows = (Units within 300.00 of (Position of (Last created unit)) matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False) and (((Matching unit) is alive) Equal to True)))
      • Unit Group - Pick every unit in HailOfArrows and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ranger has buff Focus Max ) Equal to True
              • (Level of Hail of Arrows for (Triggering unit)) Equal to 1
            • Then - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Ranger has buff Focus Max ) Equal to True
                  • (Level of Hail of Arrows for (Triggering unit)) Equal to 2
                • Then - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Ranger has buff Focus Max ) Equal to True
                      • (Level of Hail of Arrows for (Triggering unit)) Equal to 3
                    • Then - Actions
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Ranger has buff Focus Max ) Equal to True
                          • (Level of Hail of Arrows for (Triggering unit)) Equal to 4
                        • Then - Actions
                          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal
                          • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\NightElf\Starfall\StarfallTarget.mdl
                          • Wait 3.00 seconds
                          • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Undead\FrostArmor\FrostArmorDamage.mdl
                          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 9999999.00 damage of attack type Spells and damage type Normal
                        • Else - Actions
                          • Do nothing
      • Unit - Remove (Last created unit) from the game
      • Custom script: call DestroyGroup(udg_HailOfArrows)
  • [trigger]
 
make the group variable local and seperate the instant damage and the delayed damage in 2 loops. Loop the group 2 times. Once before the wait and once after the wait.

Add this as first Action, then multiple cast at the same time will be save even through wait.
  • Custom script: local group udg_HailOfArrows
 
Last edited:
Level 5
Joined
Jun 13, 2017
Messages
83
picking units is a loop, so it pick units 1 by 1, and do the action for the first unit before picking the second unit, so when you put wait in loop it pick first unit start the wait and it will not actually wait or the 3 second before picking second unit, when it pick second unit it will do the action again and start the wait. Every time it start the wait it will write it over the old wait. That's why the last picked unit should take the damage but not any of the picked units before.

This is how you should make it

  • if
    • (Ranger has buff Focus Max ) Equal to True
    • (Level of Hail of Arrows for (Triggering unit)) Equal to 4
  • then
    • set integerindex = integerindex+1
    • set Booleanvariable = true (make a Boolean variable, when it is true, the wait start after picking the group)
    • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal
    • set unitvariable[integerindex] = picked unit
    • set unitpoint[integerindex] = position of unitvariable[integerindex]
    • Special Effect - Create a special effect at (unitpoint) using Abilities\Spells\NightElf\Starfall\StarfallTarget.mdl
    • destroy last created special effect - or put it in variable to destroy it later so it doesn't leak
  • else
    • you dont need to put do nothing just leave it empty
  • now after the group
  • if
    • (Booleanvariable) equal to yes
  • then
    • set Booleanvariable = to false
    • Wait 3.00 seconds
    • for each integerloop from 1 to integer index
      • Special Effect - Create a special effect at (unitpoint[integerloop]) using Abilities\Spells\Undead\FrostArmor\FrostArmorDamage.mdl
      • Unit - Cause (triggering unit) to damage (unitvariable[integerloop]), dealing9999999.00 damage of attack type Spells and damage type Normal
      • call RemoveLocation(udg_unitpoint[udg_integerloop]) to remove all locations
    • Set integerindex= 0 After loop (if you put this in loop it will not work)


This should work here is what you need:
1- Boolean variable, start as false if the condition to deal damage started then set it to true
2- two integer variables, index and loop. Index increase for each picked unit, and loop will be for the loop after picking them to do the effect on all of the units
3- put the wait before loop not in the loop
4-set boolean to false again when damage start before or after loop
5- create point variable




Another way if you want it to be simple :
  • if
    • your condition
  • then
    • make group variable with the units you want in the group
    • wait 3 second
    • set boolean variable = true
  • else
  • leave empty
  • after first if/then/else start new if/then/else
  • if
    • boolean variable = true
  • then
    • set boolean variable = false
    • pick every unit in group variable and deal damage this time
 
Last edited:
Status
Not open for further replies.
Top