--Thanatos--
New Member
- Reaction score
- 33
JASS:
function Voodoo_Field_Registry takes nothing returns nothing
local timer VfTimer = GetExpiredTimer ()
local Voodoo_Field_Struct data = GetHandleInt (VfTimer,"data")
local unit caster = data.caster
local integer level = GetUnitAbilityLevel (caster,039;A02P039;)
local player owner = GetOwningPlayer (caster)
local unit target
local group targets
local unit dummy
if level > 0 and GetUnitAbilityLevel (caster,039;B01B039;) > 0 then
set targets = CreateGroup ()
call GroupEnumUnitsInRange (targets,GetWidgetX(caster),GetWidgetY(caster),900.,Voodoo_Field_GlobalFilter)
loop
set target = FirstOfGroup (targets)
exitwhen target == null
call GroupRemoveUnit (targets,target)
if GetUnitAbilityLevel (target,039;A02Q039;) <= 0 then
call UnitAddAbility (target,039;A02Q039;)
call UnitMakeAbilityPermanent (target,true,039;A02Q039;)
call TriggerRegisterUnitEvent (gg_trg_Voodoo_Field,target,EVENT_UNIT_DAMAGED)
endif
call BJDebugMsg("1")
call SetUnitAbilityLevel (target,039;A02Q039;,level)
call BJDebugMsg("2")
set dummy = CreateUnit (owner,039;h009039;,GetWidgetX(target),GetWidgetY(target),0.)
call UnitAddAbility (dummy,039;A02S039;)
call BJDebugMsg("3")
call SetUnitAbilityLevel (dummy,039;A02S039;,level)
call BJDebugMsg("4")
call IssueTargetOrderById (dummy,852209,target)
call BJDebugMsg("5")
call UnitApplyTimedLife (dummy,039;BTLF039;,5.)
call BJDebugMsg("6")
endloop
call DestroyGroup (targets)
call BJDebugMsg("Destroy")
endif
set VfTimer = null
set caster = null
set target = null
set targets = null
endfunction
This function is ran by a Timer with frequency of a second once.
The Game suddenly Exits after the BJDebugMsg("Destroy")
Anyone knows the reason?
EDIT: I realize the problem was on TriggerRegisterUnitEvent()
however, how to make it work?
EDIT Again: NVM I realized I made an infinite loop.