• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Revive System

Status
Not open for further replies.
Level 7
Joined
Oct 16, 2010
Messages
194
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