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

[JASS] Revive System

Status
Not open for further replies.
Level 7
Joined
Oct 16, 2010
Messages
193
Hi can someone help me fix this trigger. I converted the trigger into custom text and then typed this code in. Then when i tested it, it didnt work.

JASS:
function Trig_Revive_Unit takes nothing returns nothing
    local timerdialog Reswindow
    local integer Herowait
    local timer Restimer
    local unit Reshero
    local location Resloc = GetUnitLoc(gg_unit_n001_0006)
    set Reshero = GetDyingUnit()
    set Herowait = ( 60 )
    set Restimer = CreateTimer()
    call StartTimerBJ( Restimer, false, (I2R(Herowait) ))
    call CreateTimerDialogBJ( Restimer, GetPlayerName(GetOwningPlayer(Reshero)) )
    set Reswindow = GetLastCreatedTimerDialogBJ()
    call TimerDialogDisplayForPlayerBJ( true, Reswindow, GetOwningPlayer(Reshero) )
    call PolledWait (Herowait)
    call ReviveHeroLoc (Reshero, Resloc, true)
    call PanCameraToTimedLocForPlayer( GetOwningPlayer(Reshero), Resloc, 0.60 )
    call DestroyTimerDialog(Reswindow)
    call RemoveLocation (Resloc)
endfunction
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
Try this:

JASS:
function ReviveUnit takes nothing returns nothing
    local timer Restimer = CreateTimer()
    local timerdialog Reswindow = CreateTimerDialog(Restimer)
    local unit Reshero = GetTriggerUnit()
    local integer Herowait = 60
    local real x = GetUnitX(gg_unit_n001_0006)
    local real y = GetUnitY(gg_unit_n001_0006)
    
    call TimerDialogSetTitle(Reswindow, "You respawn in:")
    
    if GetLocalPlayer() == GetTriggerPlayer() then
        call TimerDialogDisplay(Reswindow, true)
    endif
    
    call TimerStart(Restimer, Herowait, false, null)
    call PolledWait(Herowait)
    call ReviveHero(Reshero, x, y, true)
    
    if GetLocalPlayer() == GetTriggerPlayer() then
        call PanCameraToTimed(x, y, 0.6)
    endif
    
    call DestroyTimerDialog(Reswindow)
    set Reswindow = null
    call DestroyTimer(Restimer)
    set Restimer = null
    set Reshero = null    
endfunction

This worked for me.
 
Status
Not open for further replies.
Top