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

[General] Issue Unit Target Order "revive" not working

Status
Not open for further replies.
Level 8
Joined
Jul 25, 2006
Messages
177
JASS:
function Trig_Hero_Kill_Conditions takes nothing returns boolean
    return IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true
endfunction

function Trig_Hero_Kill_Actions takes nothing returns nothing
    local unit killer = GetKillingUnit()
    local unit dead = GetTriggerUnit()
    local integer KillID = GetPlayerId(GetOwningPlayer(killer))
    local integer DeadID = GetPlayerId(GetOwningPlayer(dead))
    local integer bounty = GetHeroLevel(dead) * 15 + 35
    call TextTagSolo("+" +I2S(bounty), dead, Player(KillID), 0, 9, 40, 40, 100, 0)
    call SetPlayerState(Player(KillID), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(Player(KillID), PLAYER_STATE_RESOURCE_GOLD) + bounty)
    call DisplayTimedTextToForce( bj_FORCE_ALL_PLAYERS, 5., PlayerStringName[KillID]+ " has slain " + PlayerStringName[DeadID] + " for |cFF6262FF" + I2S(bounty) +"|r æther!" )
    call TriggerSleepAction(5.0)
    call BJDebugMsg( GetUnitName(PlayerShrine[DeadID]))
    call BJDebugMsg( GetUnitName(dead))
    call IssueTargetOrder( PlayerShrine[DeadID], "revive", dead )
    set killer = null
    set dead = null
endfunction

//===========================================================================
function InitTrig_Hero_Kill takes nothing returns nothing
    set gg_trg_Hero_Kill = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Hero_Kill, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Hero_Kill, Condition( function Trig_Hero_Kill_Conditions ) )
    call TriggerAddAction( gg_trg_Hero_Kill, function Trig_Hero_Kill_Actions )
endfunction

Not sure whats wrong but everything works in this trigger except the issued order for revive. The BJDebug does print the right units to the screen so the variables are correctly set. The unit that revives does have Can Revive Heroes set to true. Am i missing something on the reviving unit? I could manually revive the hero at the PlayerShrine but this order is not working.

Found the fix, have to wait 7 seconds after the hero dies to give this order because there is a delay before the unit becomes revivable in the 'altar'. Wonder if there is a way to edit the delay?
 
Last edited by a moderator:
Status
Not open for further replies.
Top