- Joined
- Jan 24, 2015
- Messages
- 26
I have a script where, after casting an ability a unit should continuously spray fire in front of them until they either die or ( this isn't implemented yet ) the ability times out. However,
this excerpt of code works perfectly fine, except it only loops once; only one dummy unit is created and it only casts the breath of fire variant once. Can I not use PolledWaits inside of loops? I can remove the exitwhen condition and it will still only loop once, so I'm not entirely sure what else the cause could be.
JASS:
function Trig_Ignis_Fatuus_JASS_Conditions takes nothing returns boolean
local unit caster = GetSpellAbilityUnit()
local player owner = GetOwningPlayer(caster)
local unit dummy
local integer ability_level = GetUnitAbilityLevel(caster, 'A01R')
if(GetSpellAbilityId() == 'A01R') then
loop
exitwhen GetUnitState(caster, UNIT_STATE_LIFE) <= 0.0
set dummy = CreateUnit(owner, 'h003', GetUnitX(caster), GetUnitY(caster), GetUnitFacing(caster))
call UnitApplyTimedLife(dummy, 'BTFL', 0.5)
call UnitAddAbility(dummy, 'A01S')
call SetUnitAbilityLevel(dummy, 'A01S', ability_level)
call IssuePointOrder(dummy, "breathoffire", GetUnitX(dummy) + (1.0 * Sin(GetUnitFacing(dummy) * bj_DEGTORAD)), GetUnitY(dummy) + (1.0 * Sin(GetUnitFacing(dummy) * bj_DEGTORAD)))
call PolledWait(0.2)
endloop
endif
return false
set caster = null
set owner = null
set dummy = null
endfunction
this excerpt of code works perfectly fine, except it only loops once; only one dummy unit is created and it only casts the breath of fire variant once. Can I not use PolledWaits inside of loops? I can remove the exitwhen condition and it will still only loop once, so I'm not entirely sure what else the cause could be.