scope CD initializer init
private function ResetNow takes nothing returns boolean
call UnitResetCooldown(GetFilterUnit())
return false
endfunction
private function ResetCooldown takes nothing returns boolean
call GroupEnumUnitsInRect(bj_lastCreatedGroup, bj_mapInitialPlayableArea, function ResetNow)
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_ENDCAST)
call TriggerAddCondition(t, Condition(function ResetCooldown))
set t = null
endfunction
endscope
scope CD initializer init
private function ResetCooldown takes nothing returns boolean
call UnitResetCooldown(GetTriggerUnit())
return false
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_ENDCAST)
call TriggerAddCondition(t, Condition(function ResetCooldown))
set t = null
endfunction
endscope
yeah a global group will work but timer needs to be destroyed also...
function Callrestore takes nothing returns nothing
call UnitResetCooldown(GetEnumUnit())
call GroupRemoveUnit(udg_CDgroup, GetEnumUnit())
endfunction
function Callback takes nothing returns nothing
call ForGroup(udg_CDgroup, function Callrestore)
endfunction
function GetUnit takes nothing returns boolean
if udg_ModeEnabled then
call GroupAddUnit(udg_CDgroup, GetTriggerUnit())
call TimerStart(udg_timer, 0.00, false, function Callback)
endif
return false
endfunction
function InitTrig_ResetCooldown takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_ENDCAST)
call TriggerAddCondition(t, Condition(function GetUnit))
set t = null
endfunction
Don't use "null" as an argument in registered event (or any boolexpr). Create a function that returns true; for some odd reason, it creates a permanent leak otherwise. It is more preferable if it has anything but "null".
I am aware of how Blizzard stated that in the 1.24 patch, but there are some people still claiming it was never changed. I will have a look at this a bit more, if needed.