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

Problem with reviving trigger

Status
Not open for further replies.
Level 5
Joined
Oct 20, 2019
Messages
60
Hello

I have some triggers for reviving heroes that does not work as intended and i could need some help to locate the problem and hopefully fix it

The problems that i've encountered so far is that if theres multiple heroes dead at the same time, then they will all revive at the same time when the shortest revive timer expires (so it seems atleast), also only one timer window gets destroyed if theres multiple up at the same time

The triggers are supposed to function for two teams, each has 1-5 players in it, up to 10 players total and i hope you see what i would like to accomplish with these triggers

Thank you for your help

  • Hero Revival Part 1
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set VariableSet HeroRevivalInteger = (Player number of (Owner of (Triggering unit)))
      • Set VariableSet HeroToRevive[HeroRevivalInteger] = (Triggering unit)
      • Set VariableSet HeroReviveTimeFactor = 3.00
      • Unit Group - Add HeroToRevive[HeroRevivalInteger] to RevivableHeroesGroup
      • Set VariableSet HeroReviveTime = (((Real((Hero level of HeroToRevive[HeroRevivalInteger]))) x HeroReviveTimeFactor) + 7.00)
      • Countdown Timer - Start HeroRevivalTimer[HeroRevivalInteger] as a One-shot timer that will expire in HeroReviveTime seconds
      • Countdown Timer - Create a timer window for HeroRevivalTimer[HeroRevivalInteger] with title (Name of HeroToRevive[HeroRevivalInteger])
      • Set VariableSet HeroRevivalTimerWindow[HeroRevivalInteger] = (Last created timer window)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of HeroToRevive[HeroRevivalInteger]) is in PlayerGroupLeft.) Equal to True
        • Then - Actions
          • Player Group - Pick every player in PlayerGroupLeft and do (Countdown Timer - Show HeroRevivalTimerWindow[HeroRevivalInteger] for (Picked player))
        • Else - Actions
          • Player Group - Pick every player in PlayerGroupRight and do (Countdown Timer - Show HeroRevivalTimerWindow[HeroRevivalInteger] for (Picked player))

  • Hero Revival Part 2
    • Events
      • Time - HeroRevivalTimer[1] expires
      • Time - HeroRevivalTimer[2] expires
      • Time - HeroRevivalTimer[3] expires
      • Time - HeroRevivalTimer[4] expires
      • Time - HeroRevivalTimer[5] expires
      • Time - HeroRevivalTimer[6] expires
      • Time - HeroRevivalTimer[7] expires
      • Time - HeroRevivalTimer[8] expires
      • Time - HeroRevivalTimer[9] expires
      • Time - HeroRevivalTimer[10] expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in RevivableHeroesGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for HeroRevivalTimer[(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 PlayerGroupLeft.) Equal to True
                • Then - Actions
                  • Unit Group - Remove (Picked unit) from RevivableHeroesGroup.
                  • Player Group - Pick every player in PlayerGroupLeft and do (Countdown Timer - Hide HeroRevivalTimerWindow[HeroRevivalInteger] for (Picked player))
                  • Countdown Timer - Destroy HeroRevivalTimerWindow[HeroRevivalInteger]
                  • Set VariableSet HeroReviveLocationLeft = (Center of Respawn Dead Hero 1 to 5 <gen>)
                  • Hero - Instantly revive (Picked unit) at HeroReviveLocationLeft, Show revival graphics
                  • Unit - Set mana of (Picked unit) to 100.00%
                  • Camera - Pan camera for (Owner of (Picked unit)) to HeroReviveLocationLeft over 1.00 seconds
                  • Custom script: call RemoveLocation(udg_HeroReviveLocationLeft)
                • Else - Actions
                  • Unit Group - Remove (Picked unit) from RevivableHeroesGroup.
                  • Player Group - Pick every player in PlayerGroupRight and do (Countdown Timer - Hide HeroRevivalTimerWindow[HeroRevivalInteger] for (Picked player))
                  • Countdown Timer - Destroy HeroRevivalTimerWindow[HeroRevivalInteger]
                  • Set VariableSet HeroReviveLocationRight = (Center of Respawn Dead Hero 6 to 10 <gen>)
                  • Hero - Instantly revive (Picked unit) at HeroReviveLocationRight, Show revival graphics
                  • Unit - Set mana of (Picked unit) to 100.00%
                  • Camera - Pan camera for (Owner of (Picked unit)) to HeroReviveLocationRight over 1.00 seconds
                  • Custom script: call RemoveLocation(udg_HeroReviveLocationRight)
            • Else - Actions
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,456
I left out the Timer Window stuff:
  • Hero Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set VariableSet PN = (Player number of (Triggering player))
      • Countdown Timer - Start HeroRevivalTimer[PN] as a One-shot timer that will expire in 5.00 seconds
  • Revive Timer
    • Events
      • Time - HeroRevivalTimer[1] expires
      • Time - HeroRevivalTimer[2] expires
      • Time - HeroRevivalTimer[3] expires
      • Time - HeroRevivalTimer[4] expires
      • Time - HeroRevivalTimer[5] expires
      • Time - HeroRevivalTimer[6] expires
      • Time - HeroRevivalTimer[7] expires
      • Time - HeroRevivalTimer[8] expires
      • Time - HeroRevivalTimer[9] expires
      • Time - HeroRevivalTimer[10] expires
    • Conditions
    • Actions
      • For each (Integer Revive_Loop) from 1 to 10, do (Actions)
        • Loop - Actions
          • Custom script: if GetExpiredTimer() == udg_HeroRevivalTimer[udg_Revive_Loop] then
          • Set VariableSet PN = Revive_Loop
          • Custom script: endif
      • Hero - Instantly revive Hero[PN] at (Center of (Playable map area)), Hide revival graphics
Variables:
PN = Integer
Revive_Loop = Integer

I recommend storing each player's Hero as a variable if you don't already. This removes the need for HeroToRevive.

There's no need for the Unit Group/Pick Every Unit function.
 
Status
Not open for further replies.
Top