• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Countdown Timer to revive multiple heros at once

Status
Not open for further replies.
Level 5
Joined
Nov 14, 2012
Messages
43
  • DeathTimerActivate
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
      • (Owner of (Dying unit)) Not equal to Neutral Hostile
    • Actions
      • Set DeathMui = (DeathMui + 1)
      • Set DeathInteger = (DeathInteger + 1)
      • Set DeathON[DeathInteger] = 1
      • Set DeathUnit[DeathInteger] = (Dying unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of DeathUnit[DeathInteger]) Less than or equal to 15
        • Then - Actions
          • Set DeathTime[DeathInteger] = 5.00
        • Else - Actions
          • Set DeathTime[DeathInteger] = ((Real((Hero level of DeathUnit[DeathInteger]))) / 3.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of DeathUnit[DeathInteger]) Equal to Player 1 (Red)
        • Then - Actions
          • Set DeathText[DeathInteger] = Player 1 Revive
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of DeathUnit[DeathInteger]) Equal to Player 2 (Blue)
            • Then - Actions
              • Set DeathText[DeathInteger] = Player 2 Revive
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of DeathUnit[DeathInteger]) Equal to Player 3 (Teal)
                • Then - Actions
                  • Set DeathText[DeathInteger] = Player 3 Revive
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Owner of DeathUnit[DeathInteger]) Equal to Player 4 (Purple)
                    • Then - Actions
                      • Set DeathText[DeathInteger] = Player 4 Revive
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Owner of DeathUnit[DeathInteger]) Equal to Player 5 (Yellow)
                        • Then - Actions
                          • Set DeathText[DeathInteger] = Player 5 Revive
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Owner of DeathUnit[DeathInteger]) Equal to Player 6 (Orange)
                            • Then - Actions
                              • Set DeathText[DeathInteger] = Player 6 Revive
                            • Else - Actions
      • Set DeathTimer[DeathInteger] = (Last started timer)
      • Countdown Timer - Create a timer window for DeathTimer[DeathInteger] with title DeathText[DeathInteger]
      • Set DeathWindow[DeathInteger] = (Last created timer window)
      • Countdown Timer - Change the color of the title for DeathWindow[DeathInteger] to (100.00%, 80.00%, 20.00%) with 0.00% transparency
      • Countdown Timer - Start DeathTimer[DeathInteger] as a One-shot timer that will expire in DeathTime[DeathInteger] seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DeathMui Equal to 1
        • Then - Actions
          • Trigger - Turn on DeathTimerLoop <gen>
        • Else - Actions
  • DeathTimerLoop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DeathLoop) from 1 to DeathInteger, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for DeathTimer[DeathLoop]) Equal to 0.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeathON[DeathLoop] Equal to 1
                • Then - Actions
                  • Set DeathON[DeathLoop] = 0
                  • Set DeathMui = (DeathMui - 1)
                  • Countdown Timer - Destroy DeathWindow[DeathLoop]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (DeathUnit[DeathLoop] belongs to an ally of Player 7 (Green)) Equal to True
                    • Then - Actions
                      • Hero - Instantly revive DeathUnit[DeathLoop] at (Center of T1Revive <gen>), Hide revival graphics
                      • Special Effect - Create a special effect at (Center of T1Revive <gen>) using Abilities\Spells\Items\AIda\AIdaCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                      • Hero - Instantly revive DeathUnit[DeathLoop] at (Center of T2Revive <gen>), Hide revival graphics
                      • Special Effect - Create a special effect at (Center of T2Revive <gen>) using Abilities\Spells\Items\AIda\AIdaCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DeathMui Equal to 0
                    • Then - Actions
                      • Set DeathInteger = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
My problem is when more than 1 hero die. When 1 hero dies there are no problems, but when another dies with a timer still left from the 1st hero reviving I run into issues. Ask if u want details on the issues, and I appreciate any help!
 
Last edited:
Level 8
Joined
Jan 28, 2016
Messages
486
I think the last If-Then-Else statement where you turn off the trigger should be on its own. I'm not entirely sure though so you may want to wait until someone else can confirm (or deny) this.

Additionally, you can remove all those ITE statements in the first trigger and replace them with one in a loop (see below). While I was at it, I fixed the location leaks in the revive actions of the second trigger; nothing major.

  • DeathTimerActivate
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
      • (Owner of (Dying unit)) Not equal to Neutral Hostile
    • Actions
      • Set DeathMui = (DeathMui + 1)
      • Set DeathInteger = (DeathInteger + 1)
      • Set DeathON[DeathInteger] = 1
      • Set DeathUnit[DeathInteger] = (Dying unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of DeathUnit[DeathInteger]) Less than or equal to 15
        • Then - Actions
          • Set DeathTime[DeathInteger] = 5.00
        • Else - Actions
          • Set DeathTime[DeathInteger] = ((Real((Hero level of DeathUnit[DeathInteger]))) / 3.00)
      • For each (Integer TempInteger) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of DeathUnit[DeathInteger]) Equal to (Player(TempInteger))
            • Then - Actions
              • Set DeathText[DeathInteger] = (Set Player + ((String(TempInteger)) + Revive))
            • Else - Actions
      • Set DeathTimer[DeathInteger] = (Last started timer)
      • Countdown Timer - Create a timer window for DeathTimer[DeathInteger] with title DeathText[DeathInteger]
      • Set DeathWindow[DeathInteger] = (Last created timer window)
      • Countdown Timer - Change the color of the title for DeathWindow[DeathInteger] to (100.00%, 80.00%, 20.00%) with 0.00% transparency
      • Countdown Timer - Start DeathTimer[DeathInteger] as a One-shot timer that will expire in DeathTime[DeathInteger] seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DeathMui Equal to 1
        • Then - Actions
          • Trigger - Turn on DeathTimerLoop <gen>
        • Else - Actions
  • DeathTimerLoop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DeathLoop) from 1 to DeathInteger, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for DeathTimer[DeathLoop]) Equal to 0.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeathON[DeathLoop] Equal to 1
                • Then - Actions
                  • Set DeathON[DeathLoop] = 0
                  • Set DeathMui = (DeathMui - 1)
                  • Countdown Timer - Destroy DeathWindow[DeathLoop]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (DeathUnit[DeathLoop] belongs to an ally of Player 7 (Green)) Equal to True
                    • Then - Actions
                      • Set TempLoc = (Center of T1Revive <gen>)
                      • Hero - Instantly revive DeathUnit[DeathLoop] at TempLoc, Hide revival graphics
                      • Special Effect - Create a special effect at TempLoc using Abilities\Spells\Items\AIda\AIdaCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_TempLoc)
                    • Else - Actions
                      • Set TempLoc = (Center of T2Revive <gen>)
                      • Hero - Instantly revive DeathUnit[DeathLoop] at TempLoc, Hide revival graphics
                      • Special Effect - Create a special effect at TempLoc using Abilities\Spells\Items\AIda\AIdaCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_TempLoc)
                • Else - Actions
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DeathMui Equal to 0
        • Then - Actions
          • Set DeathInteger = 0
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Level 8
Joined
Jan 28, 2016
Messages
486
I can't help but to think that you're approaching your goal from the wrong direction.
What do you want to do, specifically?

Well if it's an AoS type of map where each player is in control of only one hero (hence MPI), he would be better off implementing the GUI revival system in the DotA Template from World Editor Tutorials. I posted the triggers in a similar thread as well if you don't want to download the map. My last post there also explains a common problem when importing these revival triggers into one's own map.
 
Level 5
Joined
Nov 14, 2012
Messages
43
Interesting to know

I think the last If-Then-Else statement where you turn off the trigger should be on its own. I'm not entirely sure though so you may want to wait until someone else can confirm (or deny) this.

Additionally, you can remove all those ITE statements in the first trigger and replace them with one in a loop (see below). While I was at it, I fixed the location leaks in the revive actions of the second trigger; nothing major.

  • DeathTimerActivate
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
      • (Owner of (Dying unit)) Not equal to Neutral Hostile
    • Actions
      • Set DeathMui = (DeathMui + 1)
      • Set DeathInteger = (DeathInteger + 1)
      • Set DeathON[DeathInteger] = 1
      • Set DeathUnit[DeathInteger] = (Dying unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of DeathUnit[DeathInteger]) Less than or equal to 15
        • Then - Actions
          • Set DeathTime[DeathInteger] = 5.00
        • Else - Actions
          • Set DeathTime[DeathInteger] = ((Real((Hero level of DeathUnit[DeathInteger]))) / 3.00)
      • For each (Integer TempInteger) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of DeathUnit[DeathInteger]) Equal to (Player(TempInteger))
            • Then - Actions
              • Set DeathText[DeathInteger] = (Set Player + ((String(TempInteger)) + Revive))
            • Else - Actions
      • Set DeathTimer[DeathInteger] = (Last started timer)
      • Countdown Timer - Create a timer window for DeathTimer[DeathInteger] with title DeathText[DeathInteger]
      • Set DeathWindow[DeathInteger] = (Last created timer window)
      • Countdown Timer - Change the color of the title for DeathWindow[DeathInteger] to (100.00%, 80.00%, 20.00%) with 0.00% transparency
      • Countdown Timer - Start DeathTimer[DeathInteger] as a One-shot timer that will expire in DeathTime[DeathInteger] seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DeathMui Equal to 1
        • Then - Actions
          • Trigger - Turn on DeathTimerLoop <gen>
        • Else - Actions
  • DeathTimerLoop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DeathLoop) from 1 to DeathInteger, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for DeathTimer[DeathLoop]) Equal to 0.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeathON[DeathLoop] Equal to 1
                • Then - Actions
                  • Set DeathON[DeathLoop] = 0
                  • Set DeathMui = (DeathMui - 1)
                  • Countdown Timer - Destroy DeathWindow[DeathLoop]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (DeathUnit[DeathLoop] belongs to an ally of Player 7 (Green)) Equal to True
                    • Then - Actions
                      • Set TempLoc = (Center of T1Revive <gen>)
                      • Hero - Instantly revive DeathUnit[DeathLoop] at TempLoc, Hide revival graphics
                      • Special Effect - Create a special effect at TempLoc using Abilities\Spells\Items\AIda\AIdaCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_TempLoc)
                    • Else - Actions
                      • Set TempLoc = (Center of T2Revive <gen>)
                      • Hero - Instantly revive DeathUnit[DeathLoop] at TempLoc, Hide revival graphics
                      • Special Effect - Create a special effect at TempLoc using Abilities\Spells\Items\AIda\AIdaCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_TempLoc)
                • Else - Actions
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DeathMui Equal to 0
        • Then - Actions
          • Set DeathInteger = 0
          • Trigger - Turn off (This trigger)
        • Else - Actions

I wasn't sure if there was a leak when using regions as points so thanks for answering that for me, and I don't quite follow what you mean when you say that turning the trigger off action should be in it's own trigger.

Well if it's an AoS type of map where each player is in control of only one hero (hence MPI), he would be better off implementing the GUI revival system in the DotA Template from World Editor Tutorials. I posted the triggers in a similar thread as well if you don't want to download the map. My last post there also explains a common problem when importing these revival triggers into one's own map.

Thank you but I'd like to make my own, unless I cannot fix my problem. This is my 1st time using countdown timers as well. You are right though; I am trying to make a map where each player controls a hero.

I can't help but to think that you're approaching your goal from the wrong direction.
What do you want to do, specifically?

To revive a hero once the hero dies for a "Hero Arena" kind of map that my friend is working on. But there also needs to be a countdown timer showing how long until the hero is revived. I also have a simple equation for how long they should be dead for.
 
Last edited:
Level 8
Joined
Jan 28, 2016
Messages
486
I wasn't sure if there was a leak when using regions as points so thanks for answering that for me, and I don't quite follow what you mean when you say that turning the trigger off action should be in it's own trigger.

I meant move the last If-Then-Else statement in your second trigger outside of the loop but that's not going to fix the problem.

Evident-Pain said:
Thank you but I'd like to make my own, unless I cannot fix my problem. This is my 1st time using countdown timers as well. You are right though; I am trying to make a map where each player controls a hero.

Fair enough. I found a solution to your problem though which involves minimal alterations to your original triggers. By the way, you did quite a good job considering it's your first time with timers.

I looked through your triggers again and realised that your setting DeathTimer to the last started timer, set up your timer window and then start DeathTimer. I didn't think this would work when I replicated your triggers but for whatever reason, it did. I then realised that as soon as another hero died, the DeathTimer gets over-written and both timers restart based on the latest one. For example:
  • Hero 1 (Level 30) dies and DeathTimer[1] starts at 10 seconds.
  • Hero 1 (Level 15) dies and DeathTimer[2] starts at 5 seconds.
  • However Hero 2 dies 3 seconds after Hero 1 and last started timer is over-written.
  • DeathTimer[1] is now reset to countdown from 5 seconds from the moment Hero 2 dies.
It got worse when three or more heroes would die; they would usually revive instantly except for the first two. I tweaked the triggers slightly and implemented some of my own advice from that thread I posted.
I then remembered a similar issue when trying to implement these triggers in a map of my own. The ReviveTimers variable needs to have the array size set to 12 because with timer arrays, only the first two are initialised by default as explained by Spartipilo and Maker in this thread.

  • DeathTimerActivate
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Not equal to Neutral Hostile
    • Actions
      • Set DeathMui = (DeathMui + 1)
      • Set DeathInteger = (DeathInteger + 1)
      • Set DeathOn[DeathInteger] = 1
      • Set DeathUnit[DeathInteger] = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of DeathUnit[DeathInteger]) Less than or equal to 15
        • Then - Actions
          • Set DeathTime[DeathInteger] = 5.00
        • Else - Actions
          • Set DeathTime[DeathInteger] = ((Real((Hero level of DeathUnit[DeathInteger]))) / 3.00)
      • For each (Integer TempInteger) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of DeathUnit[DeathInteger]) Equal to (Player(TempInteger))
            • Then - Actions
              • Set DeathText[DeathInteger] = (Player + ((String(TempInteger)) + Revive))
            • Else - Actions
      • Countdown Timer - Start DeathTimer[DeathInteger] as a One-shot timer that will expire in DeathTime[DeathInteger] seconds
      • Countdown Timer - Create a timer window for DeathTimer[DeathInteger] with title DeathText[DeathInteger]
      • Set DeathWindow[DeathInteger] = (Last created timer window)
      • Countdown Timer - Change the color of the title for DeathWindow[DeathInteger] to (100.00%, 80.00%, 20.00%) with 0.00% transparency
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DeathMui Equal to 1
        • Then - Actions
          • Trigger - Turn on Test2 <gen>
        • Else - Actions
  • DeathTimerLoop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DeathLoop) from 1 to DeathInteger, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for DeathTimer[DeathLoop]) Equal to 0.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeathOn[DeathLoop] Equal to 1
                • Then - Actions
                  • Set DeathOn[DeathLoop] = 0
                  • Set DeathMui = (DeathMui - 1)
                  • Countdown Timer - Destroy DeathWindow[DeathLoop]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (DeathUnit[DeathLoop] belongs to an ally of Player 7 (Green)) Equal to True
                    • Then - Actions
                      • Set Location = (Center of T1Revive <gen>)
                      • Hero - Instantly revive DeathUnit[DeathLoop] at Location, Hide revival graphics
                      • Special Effect - Create a special effect at (Center of T1Revive <gen>) using Abilities\Spells\Items\AIda\AIdaCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_Location)
                    • Else - Actions
                      • Set Location = (Center of T2Revive <gen>)
                      • Hero - Instantly revive DeathUnit[DeathLoop] at Location, Hide revival graphics
                      • Special Effect - Create a special effect at (Center of T1Revive <gen>) using Abilities\Spells\Items\AIda\AIdaCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_Location)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DeathMui Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
 
Level 5
Joined
Nov 14, 2012
Messages
43
I meant move the last If-Then-Else statement in your second trigger outside of the loop but that's not going to fix the problem.



Fair enough. I found a solution to your problem though which involves minimal alterations to your original triggers. By the way, you did quite a good job considering it's your first time with timers.

I looked through your triggers again and realised that your setting DeathTimer to the last started timer, set up your timer window and then start DeathTimer. I didn't think this would work when I replicated your triggers but for whatever reason, it did. I then realised that as soon as another hero died, the DeathTimer gets over-written and both timers restart based on the latest one. For example:
  • Hero 1 (Level 30) dies and DeathTimer[1] starts at 10 seconds.
  • Hero 1 (Level 15) dies and DeathTimer[2] starts at 5 seconds.
  • However Hero 2 dies 3 seconds after Hero 1 and last started timer is over-written.
  • DeathTimer[1] is now reset to countdown from 5 seconds from the moment Hero 2 dies.
It got worse when three or more heroes would die; they would usually revive instantly except for the first two. I tweaked the triggers slightly and implemented some of my own advice from that thread I posted.


  • DeathTimerActivate
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Owner of (Triggering unit)) Not equal to Neutral Hostile
    • Actions
      • Set DeathMui = (DeathMui + 1)
      • Set DeathInteger = (DeathInteger + 1)
      • Set DeathOn[DeathInteger] = 1
      • Set DeathUnit[DeathInteger] = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of DeathUnit[DeathInteger]) Less than or equal to 15
        • Then - Actions
          • Set DeathTime[DeathInteger] = 5.00
        • Else - Actions
          • Set DeathTime[DeathInteger] = ((Real((Hero level of DeathUnit[DeathInteger]))) / 3.00)
      • For each (Integer TempInteger) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of DeathUnit[DeathInteger]) Equal to (Player(TempInteger))
            • Then - Actions
              • Set DeathText[DeathInteger] = (Player + ((String(TempInteger)) + Revive))
            • Else - Actions
      • Countdown Timer - Start DeathTimer[DeathInteger] as a One-shot timer that will expire in DeathTime[DeathInteger] seconds
      • Countdown Timer - Create a timer window for DeathTimer[DeathInteger] with title DeathText[DeathInteger]
      • Set DeathWindow[DeathInteger] = (Last created timer window)
      • Countdown Timer - Change the color of the title for DeathWindow[DeathInteger] to (100.00%, 80.00%, 20.00%) with 0.00% transparency
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DeathMui Equal to 1
        • Then - Actions
          • Trigger - Turn on Test2 <gen>
        • Else - Actions
  • DeathTimerLoop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DeathLoop) from 1 to DeathInteger, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for DeathTimer[DeathLoop]) Equal to 0.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeathOn[DeathLoop] Equal to 1
                • Then - Actions
                  • Set DeathOn[DeathLoop] = 0
                  • Set DeathMui = (DeathMui - 1)
                  • Countdown Timer - Destroy DeathWindow[DeathLoop]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (DeathUnit[DeathLoop] belongs to an ally of Player 7 (Green)) Equal to True
                    • Then - Actions
                      • Set Location = (Center of T1Revive <gen>)
                      • Hero - Instantly revive DeathUnit[DeathLoop] at Location, Hide revival graphics
                      • Special Effect - Create a special effect at (Center of T1Revive <gen>) using Abilities\Spells\Items\AIda\AIdaCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_Location)
                    • Else - Actions
                      • Set Location = (Center of T2Revive <gen>)
                      • Hero - Instantly revive DeathUnit[DeathLoop] at Location, Hide revival graphics
                      • Special Effect - Create a special effect at (Center of T1Revive <gen>) using Abilities\Spells\Items\AIda\AIdaCaster.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_Location)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DeathMui Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
            • Else - Actions
Sorry for late reply, but the site was down. I just have a few questions about the solution you gave me. I'm actually really surprised to finally see a variable with an array higher than 1; I will have to check out that thread. I also don't know how you came up with "player(tempinteger)" and "(player + string(tempinteger) + Revive))". I would really appreciate if you could help me out but I'm just very grateful for my revive to FINALLY be working =)
 
Level 8
Joined
Jan 28, 2016
Messages
486
About the timer array:
It's a bit confusing to explain in detail but I'll give it shot.

Let's say you create a timer array with a size of 12; one for each player. When you start the game, it will create each timer using a loop using the jass function CreateTimer(). Unfortunately there is no GUI equivalent to actually create timers; only to start them. When you use the action 'Timer Start,' it needs an existing timer to make it work. For example, if you had your timer array set to 1 and then tried to start Timer[2], the action won't find one because it wasn't created at the start of the game; it stopped making them at 1. Hence the action would fail and you'd get some weird shit going on.

Hopefully that made sense. I found this thread while writing this up which probably explains it better and has a solution using custom scripts: Countdown timer variables can't use array?.

I also took this screenshot to show how the game sets up globals but it's in Jass. Might help visualise what's happening though.

full


About the TempInteger:
In the Player Conditions, there is a function in the drop-down menu that's called "Conversion - Convert Player Index to Player" which takes an integer value and gives you a player in return (see below). For instance, if you set it 1 it would refer to Player 1 (Red). Set it to 2 and it would refer to Player 2 (Blue), etc. I set it to TempInteger which loops through all the players (from 1 to 12) to find the owner of the dying unit and when found, set the DeathString to display: "Player " + String(TempInteger) + " Revive" where Player and Revive were just typed up (including the spaces) and TempInteger was converted from an integer to a string. The screenshots below should explain it.


full


full


full

 
Level 5
Joined
Nov 14, 2012
Messages
43
About the timer array:
It's a bit confusing to explain in detail but I'll give it shot.

Let's say you create a timer array with a size of 12; one for each player. When you start the game, it will create each timer using a loop using the jass function CreateTimer(). Unfortunately there is no GUI equivalent to actually create timers; only to start them. When you use the action 'Timer Start,' it needs an existing timer to make it work. For example, if you had your timer array set to 1 and then tried to start Timer[2], the action won't find one because it wasn't created at the start of the game; it stopped making them at 1. Hence the action would fail and you'd get some weird shit going on.

Hopefully that made sense. I found this thread while writing this up which probably explains it better and has a solution using custom scripts: Countdown timer variables can't use array?.

I also took this screenshot to show how the game sets up globals but it's in Jass. Might help visualise what's happening though.

full


About the TempInteger:
In the Player Conditions, there is a function in the drop-down menu that's called "Conversion - Convert Player Index to Player" which takes an integer value and gives you a player in return (see below). For instance, if you set it 1 it would refer to Player 1 (Red). Set it to 2 and it would refer to Player 2 (Blue), etc. I set it to TempInteger which loops through all the players (from 1 to 12) to find the owner of the dying unit and when found, set the DeathString to display: "Player " + String(TempInteger) + " Revive" where Player and Revive were just typed up (including the spaces) and TempInteger was converted from an integer to a string. The screenshots below should explain it.


full


full


full

I believe you explained it well; I believe I have an idea what is going on, although I'm a amateur at Jass. Everything I know with wc3 editor was all done with a lot of trial and error. Thank you for showing me where you converted a variable into a player number; that will come in handy!
 
Status
Not open for further replies.
Top