1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Revive Timer Does not go away

Discussion in 'World Editor Help Zone' started by CroMoX, Jan 15, 2012.

  1. CroMoX

    CroMoX

    Joined:
    Jan 20, 2011
    Messages:
    478
    Resources:
    3
    Maps:
    3
    Resources:
    3
    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.
     
  2. mckill2009

    mckill2009

    Joined:
    Mar 10, 2009
    Messages:
    4,696
    Resources:
    34
    Maps:
    5
    Spells:
    27
    JASS:
    2
    Resources:
    34
    coz of the wait...you should use a separate trigger with an event Timer expires...
     
  3. shadowvzs

    shadowvzs

    Joined:
    Nov 13, 2006
    Messages:
    1,803
    Resources:
    2
    Spells:
    2
    Resources:
    2
    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!
     

    Attached Files:

  4. SunTzu7387

    SunTzu7387

    Joined:
    Mar 28, 2009
    Messages:
    66
    Resources:
    0
    Resources:
    0
    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)
     
  5. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,174
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    ^Cleaned up the trigger a bit:
    Trig
    • 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