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

Hero Revive Trigger

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
Hey, I copied a tutorial on how to create revive timer windows for dead heroes.

http://world-editor-tutorials.thehelper.net/revive.php

Heres my trigger:

  • Revive Hero
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Triggering unit) belongs to an ally of Player 9 (Gray)) Equal to True
      • ((Owner of (Dying unit)) slot status) Equal to Is playing
    • 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 = 45
      • 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_basecenter), true )
      • Custom script: call PanCameraToTimedLocForPlayer( GetOwningPlayer(OURHERO), GetUnitLoc(OURHERO), 0.60 )
      • Custom script: call DestroyTimerDialog(WINDOW)
Theres only one problem. The windows are displayed to every player. I only want a window to display for your own dead hero, not any1 elses. I dont know jass very well at all, but can somebody tell me what to change and how? Thanks.
 
After this line:
  • Custom script: set WINDOW = GetLastCreatedTimerDialogBJ()
Put:
  • Custom script: call TimerDialogDisplay( WINDOW, false )
Don't replace anything, just insert that line between the "set WINDOW" and "call TimerDialogDisplayForPlayer..."

And then it should work, hopefully. I assume that the timer dialogs are by default displayed, so you just need to make sure that you hide it for everyone else before you use the function to display it to the owning player.
 
Level 16
Joined
May 1, 2008
Messages
1,605
I know that problem is solved, but I just saw you trigger and was like "omg? why he doesn't use jass directly as using custom text", but well strange things happen the last days in hive anyway, so when you wanna use custom script then please do it correct:

  • Actions
    • Custom script: local unit OURHERO = GetTriggerUnit()
    • Custom script: local real HEROWAIT = 45
    • Custom script: local timerdialog WINDOW
    • Custom script: local timer OURTIMER
    • -------- - --------
    • Custom script: call TimerStart(OURTIMER,HEROWAIT,false,null)
    • Custom script: set WINDOW = CreateTimerDialog(OURTIMER)
    • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
    • Custom script: call TimerDialogDisplay(WINDOW,true)
    • Custom script: endif
    • Custom script: call PolledWait(HEROWAIT)
    • Custom script: call ReviveHero(OURHERO,GetRectCenterX(gg_rct_basecenter),GetRectCenterY(gg_rct_basecenter),true)
    • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
    • Custom script: call PanCameraToTimed(GetUnitX(OURHERO),GetUnitY(OURHERO),0.6)
    • Custom script: endif
    • Custom script: call PauseTimer(OURTIMER)
    • Custom script: call DestroyTimer(OURTIMER)
    • Custom script: call DestroyTimerDialog(WINDOW)
    • Custom script: set OURHERO = null
BJ's are fixed, also you have to pause the timer first before you destroy it (I read that once). Also the OUTHERO variable has to be set = null. But I don't know if you have to set the WINDOWS = null too, never read so far that its a leak :eek:
 
Last edited:
Status
Not open for further replies.
Top