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

Heri Death Timer

Status
Not open for further replies.
Level 3
Joined
Sep 29, 2012
Messages
37
When a hero dies, the timer shows to everybody.



  • Revive Hero Resistance
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
          • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
          • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
          • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
          • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
    • 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 = ( GetHeroLevel(OURHERO) * 5 )
      • 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 ReviveHeroLoc(OURHERO, GetRectCenter(gg_rct_Spawn_Resistance), true)
      • Custom script: call SetUnitFacingTimed( OURHERO, 270.00, 0 )
      • Custom script: call SelectUnitAdd( OURHERO )
      • Custom script: call PanCameraToTimedLocForPlayer( GetOwningPlayer(OURHERO), GetUnitLoc(OURHERO), 0.60 )
      • Custom script: call DestroyTimerDialog(WINDOW)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You are using local variable, not GetLocalPlayer() function, that's why.

It should be;
  • Custom script: if GetLocalPlayer() == YourPlayer then
  • -------- ACTIONS HERE --------
  • Custom script: endif
YourPlayer in this case is GetTriggerPlayer()
 
Level 3
Joined
Sep 29, 2012
Messages
37
Is this correct?


  • Revive Hero Resistance
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
          • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
          • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
          • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
          • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
    • Actions
      • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
      • 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 = ( GetHeroLevel(OURHERO) * 5 )
      • 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 ReviveHeroLoc(OURHERO, GetRectCenter(gg_rct_Spawn_Resistance), true)
      • Custom script: call SetUnitFacingTimed( OURHERO, 270.00, 0 )
      • Custom script: call SelectUnitAdd( OURHERO )
      • Custom script: call PanCameraToTimedLocForPlayer( GetOwningPlayer(OURHERO), GetUnitLoc(OURHERO), 0.60 )
      • Custom script: call DestroyTimerDialog(WINDOW)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Put this at the end of the line;
  • Custom script: endif
Don't forget to null them too !

  • Custom script: set WINDOW = null
  • Custom script: set OURTIMER= null
  • Custom script: set OURHERO = null
And do you know that you can declare a local variable + initialize in one single line ?

Example;
  • Custom script: local unit OURHERO = GetDyingUnit()
 
Level 3
Joined
Sep 29, 2012
Messages
37
Anybody can help me with these? When a hero dies, everybody can see the death timer but i dont want it to be like that, i want it to be only the dying player to see it.


  • Revive Hero Resistance
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
          • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
          • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
          • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
          • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
    • 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 = ( GetHeroLevel(OURHERO) * 5 )
      • 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 ReviveHeroLoc(OURHERO, GetRectCenter(gg_rct_Spawn_Resistance), true)
      • Custom script: call SetUnitFacingTimed( OURHERO, 270.00, 0 )
      • Custom script: call SelectUnitAdd( OURHERO )
      • Custom script: call PanCameraToTimedLocForPlayer( GetOwningPlayer(OURHERO), GetUnitLoc(OURHERO), 0.60 )
      • Custom script: call DestroyTimerDialog(WINDOW)
      • Custom script: set WINDOW = null
      • Custom script: set OURTIMER= null
      • Custom script: set OURHERO = null
      • Custom script: endif
 
Status
Not open for further replies.
Top