So I have this spell which a projectile bounces between players and puts them to sleep when hit, Every once and a while when they bounce a player will not be put to sleep, after many bug tests I have come to the conclusion that the dummy caster is not being created! So I added a loop to make the action be drawn out until the dummy caster was created and the target put to sleep but still no dummy caster was created, Just my bug finder flashing every 0.1 seconds because the exitwhen was never completed!
Please take a look at the code for this function and let me know what you think!
If you feel the rest of the trigger code is relevant let me know and ill post it!
Please take a look at the code for this function and let me know what you think!
JASS:
function Cast_Sleep takes unit Target, unit Caster returns nothing
local unit DCS // Dummy Caster
local integer AL = GetUnitAbilityLevel(Caster, 039;A01G039;) //ability level
loop
if(GetUnitAbilityLevel(Target, 039;B00J039;) > 0) then
loop
set DCS = CreateUnit(GetOwningPlayer(Caster),039;e001039;,GetUnitX(Target),GetUnitY(Target),270) // DCS = Dummy Caster Sleep
call UnitApplyTimedLife(DCS,039;BTLF039;,10)
call UnitAddAbility(DCS,039;A01H039;)
call SetUnitAbilityLevel(DCS,039;A01H039;,AL)
call SetUnitPathing(DCS,false)
call SetUnitInvulnerable(DCS,true)
call IssueTargetOrderById(DCS,OrderId("sleep"),Target)
exitwhen GetUnitAbilityLevel(Target, 039;B00I039;) > 0 or GetUnitState(Target, UNIT_STATE_LIFE)>0 == false
// BUG FILTER PLACED HERE!!
call TriggerSleepAction( 0.01 )
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIil\\AIilTarget.mdl", Target, "origin"))
endloop
exitwhen 1==1
endif
call TriggerSleepAction( 0.01 )
endloop
if(IsUnitType(Caster, UNIT_TYPE_HERO))then
call Everlasting_Horrors(Target)
endif
call Sleep_Damage(Target, Caster, DCS)
set DCS = null
set Caster = null
set Target = null
set AL = 0
endfunction
If you feel the rest of the trigger code is relevant let me know and ill post it!