function Trig_Hero_dying_Func001001 takes nothing returns boolean
return ( IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == true )
endfunction
function Trig_Hero_dying_Func001002 takes nothing returns boolean
return ( IsUnitType(GetDyingUnit(), UNIT_TYPE_SUMMONED) == false )
endfunction
function Trig_Hero_dying_Conditions takes nothing returns boolean
if ( not GetBooleanAnd( Trig_Hero_dying_Func001001(), Trig_Hero_dying_Func001002() ) ) then
return false
endif
return true
endfunction
function Trig_Hero_dying_Actions takes nothing returns nothing
local unit u = GetDyingUnit()
local integer utype=GetUnitTypeId(u)
local real ang = GetUnitFacing(u)
local integer herolv = GetHeroLevel(u)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
call TriggerSleepAction( 60.00 )
call RemoveUnit(u)
set u = CreateUnit(GetTriggerPlayer(),utype,x,y,ang)
if herolv > 1 then
call SetHeroLevel(u,herolv,false)
endif
set u = null
endfunction
//===========================================================================
function InitTrig_Hero_dying takes nothing returns nothing
set gg_trg_Hero_dying = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_dying, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Hero_dying, Condition( function Trig_Hero_dying_Conditions ) )
call TriggerAddAction( gg_trg_Hero_dying, function Trig_Hero_dying_Actions )
endfunction