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

Revive Timer Does not go away

Status
Not open for further replies.
Level 10
Joined
Jan 20, 2011
Messages
492
Hey guys, I was trying to make a revive timer and I did successfully, but when I had a friend test the map with me we both died and the timers both popped up. Fine so far, but once we revived the Timers were still up there, and that was not suppose to happen. They were on 0.00 and every time we died it would go up to 30, but would get to 0.00 and stay on that, until we died.

The way I wanted it to be was once we die it pops up for the 30 seconds then disappears until someone dies again.

Scripting;
  • Hero Revive
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Dying unit)) Equal to Player 7 (Green)
        • Then - Actions
        • Else - Actions
          • Countdown Timer - Start Revive as a One-shot timer that will expire in 30.00 seconds
          • Countdown Timer - Create a timer window for Revive with title (Name of (Owner of (Triggering unit)))
          • Countdown Timer - Show (Last created timer window)
          • Wait 30.00 seconds
          • Countdown Timer - Destroy (Last created timer window)
Help with it would be much appreciated.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Hey guys, I was trying to make a revive timer and I did successfully, but when I had a friend test the map with me we both died and the timers both popped up. Fine so far, but once we revived the Timers were still up there, and that was not suppose to happen. They were on 0.00 and every time we died it would go up to 30, but would get to 0.00 and stay on that, until we died.

The way I wanted it to be was once we die it pops up for the 30 seconds then disappears until someone dies again.

Scripting;
  • Hero Revive
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Dying unit)) Equal to Player 7 (Green)
        • Then - Actions
        • Else - Actions
          • Countdown Timer - Start Revive as a One-shot timer that will expire in 30.00 seconds
          • Countdown Timer - Create a timer window for Revive with title (Name of (Owner of (Triggering unit)))
          • Countdown Timer - Show (Last created timer window)
          • Wait 30.00 seconds
          • Countdown Timer - Destroy (Last created timer window)
Help with it would be much appreciated.

ur problem is u destroy last created but since during 30second was created more than 1 timer than only the last is destroyed rest no.

my advice do Array for timer, window, unit, a simple unit group

i made a demo map for u

anyway trigger is here
  • Dieing Hero
    • Events
      • Unit - A unit owned by Player 1 (Red) Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set CustomValue = (Custom value of (Triggering unit))
      • Custom script: set udg_DeathTimer[udg_CustomValue]=CreateTimer()
      • Countdown Timer - Start DeathTimer[CustomValue] as a One-shot timer that will expire in 10.00 seconds
      • Countdown Timer - Create a timer window for DeathTimer[CustomValue] with title (Name of (Triggering unit))
      • Set DeathTimerWindow[CustomValue] = (Last created timer window)
      • Set DeadUnit[CustomValue] = (Triggering unit)
      • Trigger - Add to Expired Timer <gen> the event (Time - DeathTimer[CustomValue] expires)
      • Unit Group - Add (Triggering unit) to DeadUnitGroup
  • Expired Timer
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DeadUnitGroup and do (Actions)
        • Loop - Actions
          • Set CustomValue = (Custom value of (Picked unit))
          • Custom script: if udg_DeathTimer[udg_CustomValue] == GetExpiredTimer() then
          • Set Point = (Position of DeadUnit[CustomValue])
          • Hero - Instantly revive DeadUnit[CustomValue] at Point, Show revival graphics
          • Camera - Pan camera for (Owner of DeadUnit[CustomValue]) to Point over 0.00 seconds
          • Custom script: call RemoveLocation(udg_Point)
          • Countdown Timer - Destroy DeathTimerWindow[CustomValue]
          • Countdown Timer - Pause DeathTimer[CustomValue]
          • Custom script: call DestroyTimer(udg_DeathTimer[udg_CustomValue])
          • Custom script: endif
Unit Indexer Needed!
 

Attachments

  • timer.w3x
    22.6 KB · Views: 65
Level 4
Joined
Mar 28, 2009
Messages
66
This works for me. Hope it helps. The timer will be destroyed in this one. remember Input wherever you want in "get_rect_centerx..." that is the location of a region. IDk if u wanna revive em at a region or what so ya thats just what I did for my map. If you wanna change that just change the 3rd to last line where it sais "revive Hero (OUR Hero). Also I put the wait timer in there for 30 seconds in the variable HeroWait.

  • Events
    • Unit - A unit Dies
  • Conditions
    • ((Triggering unit) is A Hero) Equal to True
    • (Owner of (Dying unit)) Equal to Player 7 (Green)
  • Actions
    • Custom script: local timerdialog WINDOW
    • Custom script: local integer HEROWAIT
    • Custom script: local timer OURTIMER
    • Custom script: local unit OURHERO
    • Custom script: set OURHERO = GetDyingUnit()
    • Custom script: set HEROWAIT = ( 30 )
    • Custom script: set OURTIMER = CreateTimer()
    • Custom script: call StartTimerBJ( OURTIMER, false, ( I2R(HEROWAIT) ))
    • Custom script: call CreateTimerDialogBJ( OURTIMER, GetPlayerName(GetOwningPlayer(OURHERO)) )
    • Custom script: set WINDOW = GetLastCreatedTimerDialogBJ()
    • Custom script: call TimerDialogDisplayForPlayerBJ( true, WINDOW, GetOwningPlayer(OURHERO) )
    • Custom script: call PolledWait( HEROWAIT )
    • Custom script: call ReviveHero(OURHERO,GetRectCenterX(gg_rct_whever you want),GetRectCenterY(gg_rct_wherever you want),true)
    • Custom script: call PanCameraToTimedLocForPlayer( GetOwningPlayer(OURHERO), GetUnitLoc(OURHERO), 0.60 )
    • Custom script: call DestroyTimerDialog(WINDOW)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
^Cleaned up the trigger a bit:
  • Events
    • Unit - A unit Dies
  • Conditions
    • ((Triggering unit) is A Hero) Equal to True
    • (Owner of (Dying unit)) Equal to Player 7 (Green)
  • Actions
    • Custom script: local timerdialog WINDOW
    • Custom script: local real HEROWAIT = 30
    • Custom script: local timer OURTIMER = CreateTimer()
    • Custom script: local unit OURHERO = GetDyingUnit()
    • Custom script: call TimerStart(OURTIMER, HEROWAIT, false, null)
    • Custom script: call CreateTimerDialogBJ(OURTIMER, GetPlayerName(GetTriggerPlayer())
    • Custom script: set WINDOW = bj_lastCreatedTimerDialog
    • Custom script: call TimerDialogDisplayForPlayerBJ(true, WINDOW, GetTriggerPlayer(OURHERO))
    • Custom script: call PolledWait(HEROWAIT)
    • Custom script: call ReviveHero(OURHERO,GetRectCenterX(gg_rct_whever you want),GetRectCenterY(gg_rct_wherever you want),true)
    • Custom script: call PanCameraToTimedLocForPlayer( GetOwningPlayer(OURHERO), GetUnitLoc(OURHERO), 0.60 )
    • Custom script: call DestroyTimerDialog(WINDOW)
    • Custom script: call DestroyTimer(OURTIMER)
    • Custom script: set OURTIMER = null
    • Custom script: set OURHERO = null
    • Custom script: set WINDOW = null
 
Status
Not open for further replies.
Top