• 🏆 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!

[Trigger] Problem with revive system

Status
Not open for further replies.
Level 8
Joined
Mar 5, 2011
Messages
199
Hello!

I've been having a problem with these triggers. When multiple heroes dies, sometimes the revive window is not destroyed and it just stays at the game even if its timer is finished and it stacks with other countdown windows. What might be the prob?

  • Revive Hero
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit Group - Add (Triggering unit) to RevivableHeroes
      • Set TempReal = (((Real((Hero level of (Triggering unit)))) x Hero_Revive_Time) + 3.00)
      • Set PlayerNumber = (Player number of (Triggering player))
      • Countdown Timer - Start ReviveTimers[PlayerNumber] as a One-shot timer that will expire in TempReal seconds
      • Set ReviveTimers[PlayerNumber] = (Last started timer)
      • Countdown Timer - Create a timer window for ReviveTimers[PlayerNumber] with title Revive in
      • Set RevivableTimersWindows[PlayerNumber] = (Last created timer window)
      • Countdown Timer - Show RevivableTimersWindows[PlayerNumber] for (Owner of (Triggering unit))
  • Revive Hero Timer
    • Events
      • Time - ReviveTimers[3] expires
      • Time - ReviveTimers[4] expires
      • Time - ReviveTimers[5] expires
      • Time - ReviveTimers[6] expires
      • Time - ReviveTimers[8] expires
      • Time - ReviveTimers[9] expires
      • Time - ReviveTimers[10] expires
      • Time - ReviveTimers[11] expires
      • Time - ReviveTimers[12] expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy RevivableTimersWindows[PlayerNumber]
      • Unit Group - Pick every unit in RevivableHeroes and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for ReviveTimers[(Player number of (Owner of (Picked unit)))]) Less than 1.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Picked unit)) is in PlayersSentinel) Equal to True
                • Then - Actions
                  • Hero - Instantly revive (Picked unit) at (Center of Senti Spawn <gen>), Show revival graphics
                • Else - Actions
                  • Hero - Instantly revive (Picked unit) at (Center of Scourge Spawn <gen>), Show revival graphics
            • Else - Actions
  • Revive Hero Tavern
    • Events
      • Unit - A unit Finishes reviving
    • Conditions
      • ((Reviving Hero) is in RevivableHeroes) Equal to True
    • Actions
      • Unit Group - Remove (Reviving Hero) from RevivableHeroes
      • Camera - Pan camera for (Owner of (Reviving Hero)) to (Position of (Reviving Hero)) over 0.60 seconds
      • Selection - Select (Reviving Hero) for (Owner of (Reviving Hero))
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Nah Nichilus. Generic Unit Events understands "Triggering Player" as the "OWner of the Triggering Unit". It doesn't make any cange on "A unit dies" event. There must be something else bugging.

Go to Variable Editor, look for your timer array, and set it's default size to 12. This (and group) variable type requires you to set the size in order to initialize them from 0 to the index, else, it doesn't work.

Your triggers have some leaks.

You can merge the "End" trigger with the "Timer" trigger.


On "Timer" tab you start with this " Countdown Timer - Destroy RevivableTimersWindows[PlayerNumber]" and "Player number" is not set yet, so, it returns "null" or returns the last value saved on "Player Number". Besides, you may have several heroes with 1 sec remaining in the timer, which would bug everything.

This can be easily fixed with some pretty fast and easy jass scripts, but I don't have time right now. Basically you have to save the handle of the Window and of the unit on the timer, and once the timer expires, you load the window and destroy it, then load the Hero and revive it.
 
Status
Not open for further replies.
Top