I have a trigger that basically says the following...
A Unit Dies
Wait 60 seconds
Revive unit at place of dying units death.
I know that using Dying Unit after a 60 second wait is a bad idea so I replaced the reference of Dying unit to a local unit variable.
Even when using a local unit variable only about half of the dying units are being revived.
This is the custom text of the trigger...
A Unit Dies
Wait 60 seconds
Revive unit at place of dying units death.
I know that using Dying Unit after a 60 second wait is a bad idea so I replaced the reference of Dying unit to a local unit variable.
Even when using a local unit variable only about half of the dying units are being revived.
This is the custom text of the trigger...
JASS:
function Trig_Respawn_Copy_Func003Func002C takes nothing returns boolean
if ( ( GetOwningPlayer(GetDyingUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) ) ) then
return true
endif
if ( ( GetOwningPlayer(GetDyingUnit()) == Player(PLAYER_NEUTRAL_PASSIVE) ) ) then
return true
endif
return false
endfunction
function Trig_Respawn_Copy_Func003Func003C takes nothing returns boolean
if ( not ( GetHeroLevel(GetDyingUnit()) <= 4 ) ) then
return false
endif
if ( not ( GetRandomInt(1, 8) == 1 ) ) then
return false
endif
return true
endfunction
function Trig_Respawn_Copy_Func003Func004C takes nothing returns boolean
if ( not ( GetHeroLevel(GetDyingUnit()) <= 8 ) ) then
return false
endif
if ( not ( GetHeroLevel(GetDyingUnit()) > 4 ) ) then
return false
endif
if ( not ( GetRandomInt(1, 8) == 1 ) ) then
return false
endif
return true
endfunction
function Trig_Respawn_Copy_Func003Func005C takes nothing returns boolean
if ( not ( GetHeroLevel(GetDyingUnit()) <= 15 ) ) then
return false
endif
if ( not ( GetHeroLevel(GetDyingUnit()) > 8 ) ) then
return false
endif
if ( not ( GetRandomInt(1, 8) == 1 ) ) then
return false
endif
return true
endfunction
function Trig_Respawn_Copy_Func003Func006C takes nothing returns boolean
if ( not ( GetHeroLevel(GetDyingUnit()) <= 25 ) ) then
return false
endif
if ( not ( GetHeroLevel(GetDyingUnit()) > 15 ) ) then
return false
endif
if ( not ( GetRandomInt(1, 8) == 1 ) ) then
return false
endif
return true
endfunction
function Trig_Respawn_Copy_Func003Func007C takes nothing returns boolean
if ( not ( GetHeroLevel(GetDyingUnit()) > 25 ) ) then
return false
endif
if ( not ( GetRandomInt(1, 8) == 1 ) ) then
return false
endif
return true
endfunction
function Trig_Respawn_Copy_Func003Func016C takes nothing returns boolean
if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_Respawn_Copy_Func003C takes nothing returns boolean
if ( not Trig_Respawn_Copy_Func003Func002C() ) then
return false
endif
if ( not ( GetUnitTypeId(GetDyingUnit()) != 039;H009039; ) ) then
return false
endif
return true
endfunction
function Trig_Respawn_Copy_Actions takes nothing returns nothing
local unit DIED
set DIED = GetDyingUnit()
if ( Trig_Respawn_Copy_Func003C() ) then
set DIED = GetDyingUnit()
if ( Trig_Respawn_Copy_Func003Func003C() ) then
call CreateItemLoc( ChooseRandomItemExBJ(1, ITEM_TYPE_ANY), GetUnitLoc(GetDyingUnit()) )
else
endif
if ( Trig_Respawn_Copy_Func003Func004C() ) then
call CreateItemLoc( ChooseRandomItemExBJ(2, ITEM_TYPE_ANY), GetUnitLoc(GetDyingUnit()) )
else
endif
if ( Trig_Respawn_Copy_Func003Func005C() ) then
call CreateItemLoc( ChooseRandomItemExBJ(3, ITEM_TYPE_ANY), GetUnitLoc(GetDyingUnit()) )
else
endif
if ( Trig_Respawn_Copy_Func003Func006C() ) then
call CreateItemLoc( ChooseRandomItemExBJ(4, ITEM_TYPE_ANY), GetUnitLoc(GetDyingUnit()) )
else
endif
if ( Trig_Respawn_Copy_Func003Func007C() ) then
call CreateItemLoc( ChooseRandomItemExBJ(GetRandomInt(5, 8), ITEM_TYPE_ANY), GetUnitLoc(GetDyingUnit()) )
else
endif
set udg_Bounty = ( GetRandomInt(1, 2) * ( GetHeroLevel(GetDyingUnit()) * GetHeroLevel(GetKillingUnitBJ()) ) )
call AdjustPlayerStateBJ( udg_Bounty, GetOwningPlayer(GetKillingUnitBJ()), PLAYER_STATE_RESOURCE_GOLD )
call CreateTextTagLocBJ( ( I2S(udg_Bounty) + "!" ), GetUnitLoc(GetDyingUnit()), 0, 10, 100.00, 100, 0.00, 0.00 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 64, 90 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 4 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 5 )
call TriggerSleepAction( 90.00 )
if ( Trig_Respawn_Copy_Func003Func016C() ) then
call ReviveHeroLoc( DIED, GetUnitLoc(DIED), false )
call SetHeroLevelBJ( DIED, ( udg_AvgLevel[2] / udg_AvgLevel[1] ),false)
else
call CreateNUnitsAtLoc( 1, GetUnitTypeId(DIED), GetOwningPlayer(DIED), GetUnitLoc(DIED), GetUnitFacing(DIED))
call RemoveUnit( DIED)
endif
else
endif
set DIED = null
endfunction