Karawasa
Element Tower Defense
- Reaction score
- 38
In Element TD there are these Undead creeps that have reincarnation. When they revive, I need certain things done to get them working. I register them when they spawn:
This detects when they resurrect, and then I do the following:
The bug lies with TriggerSleepAction() in my opinion. Resurrected Undead creeps will rarely and randomly not receive the order to move, but all the actions prior to TriggerSleepAction() work fine.
Any help would be much appreciated.
JASS:
function SpawnCreep takes integer j returns nothing
local unit u
local real hp
if i > 0 then
set u = CreateUnit(udg_CreepPlayers[j],udg_Spawns[udg_Level - 1],udg_SpawnX[j],udg_SpawnY[j],270.)
//call SetUnitUserData( u, GetConvertedPlayerId(GetEnumPlayer()) )
set udg_CreepOwner[GetUnitIndex(u)] = Player(j)
call UnitAddAbility(u,udg_Spawn_HP[udg_Level - 1])
set hp = ((udg_Difficulty[j]-1)*.125)+.50
call SetWidgetLife(u,GetUnitState(u,UNIT_STATE_MAX_LIFE)*hp)
call SetUnitMaxState(u,UNIT_STATE_MAX_LIFE,GetWidgetLife(u))
call SetUnitLifePercentBJ(u,100.)
call SetUnitAbilityLevel(u,039;A00V039;,udg_Difficulty[j])
call SetUnitAbilityLevel(u,039;A01R039;,udg_Level)
if udg_Extreme_Mode_On == true then
call UnitAddAbility(u,039;A03N039;)
endif
if IsUnitType(u, UNIT_TYPE_UNDEAD) == true then
call TriggerRegisterUnitLifeEvent( gg_trg_Undead_Reincarnate, u, GREATER_THAN_OR_EQUAL, 0.405 )
endif
if IsUnitType(u, UNIT_TYPE_MECHANICAL) == true then
call TriggerRegisterUnitManaEvent( gg_trg_Mechanical_Activate, u, GREATER_THAN_OR_EQUAL, 12.00 )
call SetUnitState(u,UNIT_STATE_MANA,GetRandomReal(0.,12.))
endif
call IssuePointOrder(u,"move",udg_LeakX[j],udg_LeakY[j])
set u = null
endif
endfunction
This detects when they resurrect, and then I do the following:
JASS:
function Trig_Undead_Reincarnate_Conditions takes nothing returns boolean
if GetUnitAbilityLevel(GetTriggerUnit(),039;A00U039;) == 0 then
return false
endif
return true
endfunction
function Trig_Undead_Reincarnate_Actions takes nothing returns nothing
local unit u
local integer i
set i = GetPlayerId(udg_CreepOwner[GetUnitUserData(GetTriggerUnit())])
set u = GetTriggerUnit()
call UnitRemoveAbility(u,039;A00U039;)
call SetUnitLifePercentBJ(u,33.33)
call TriggerSleepAction(0.0)
call IssuePointOrder(u,"move",udg_LeakX<i>,udg_LeakY<i>)
set u = null
endfunction
//===========================================================================
function InitTrig_Undead_Reincarnate takes nothing returns nothing
set gg_trg_Undead_Reincarnate = CreateTrigger()
call TriggerAddCondition( gg_trg_Undead_Reincarnate, Condition( function Trig_Undead_Reincarnate_Conditions ) )
call TriggerAddAction( gg_trg_Undead_Reincarnate, function Trig_Undead_Reincarnate_Actions )
endfunction
</i></i>
The bug lies with TriggerSleepAction() in my opinion. Resurrected Undead creeps will rarely and randomly not receive the order to move, but all the actions prior to TriggerSleepAction() work fine.
Any help would be much appreciated.