- Joined
- Nov 24, 2007
- Messages
- 55
So, I've looked over this code numerous times, and I was pretty sure it did not leak. However, whenever this Hero is used, and thus this ability, the game always crashes eventually, with an error of running out of memory or something like that. Which leads me to think this ability does leak, and I have just overlooked it somewhere, or something is going on. Here is the code:
and CleanTimer() is defined like this:
thanks.
JASS:
function Trig_Enter_The_Ring_BoxRemoval takes nothing returns nothing
local integer t = H2I(GetExpiredTimer())
local destructable nL = GetHandleDestructable(I2Timer(t), "nL")
local destructable nM = GetHandleDestructable(I2Timer(t), "nM")
local destructable nR = GetHandleDestructable(I2Timer(t), "nR")
local destructable sL = GetHandleDestructable(I2Timer(t), "sL")
local destructable sM = GetHandleDestructable(I2Timer(t), "sM")
local destructable sR = GetHandleDestructable(I2Timer(t), "sR")
local destructable wT = GetHandleDestructable(I2Timer(t), "wT")
local destructable wM = GetHandleDestructable(I2Timer(t), "wM")
local destructable wB = GetHandleDestructable(I2Timer(t), "wB")
local destructable eT = GetHandleDestructable(I2Timer(t), "eT")
local destructable eM = GetHandleDestructable(I2Timer(t), "eM")
local destructable eB = GetHandleDestructable(I2Timer(t), "eB")
call RemoveDestructable(nL)
call RemoveDestructable(nM)
call RemoveDestructable(nR)
call RemoveDestructable(sL)
call RemoveDestructable(sM)
call RemoveDestructable(sR)
call RemoveDestructable(wT)
call RemoveDestructable(wM)
call RemoveDestructable(wB)
call RemoveDestructable(eT)
call RemoveDestructable(eM)
call RemoveDestructable(eB)
set nL = null
set nM = null
set nR = null
set sL = null
set sM = null
set sR = null
set wT = null
set wM = null
set wB = null
set eT = null
set eM = null
set eB = null
call CleanTimer(I2Timer(t))
endfunction
function Trig_Enter_The_Ring_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer boxT = H2I(CreateTimer())
local real dbb = 150 // Distance Between Boxes
local real dfc = 250 // Distance From Caster
local real uX = GetUnitX(u)
local real uY = GetUnitY(u)
local destructable northL = CreateDestructable('B003', (uX-dbb), (uY+dfc), 270, 1, 0)
local destructable northM = CreateDestructable('B003', (uX), (uY+dfc), 270, 1, 1)
local destructable northR = CreateDestructable('B003', (uX+dbb), (uY+dfc), 270, 1, 0)
local destructable southL = CreateDestructable('B003', (uX-dbb), (uY-dfc), 90, 1, 0)
local destructable southM = CreateDestructable('B003', (uX), (uY-dfc), 90, 1, 1)
local destructable southR = CreateDestructable('B003', (uX+dbb), (uY-dfc), 90, 1, 0)
local destructable westT = CreateDestructable('B003', (uX-dfc), (uY+dbb), 0, 1, 0)
local destructable westM = CreateDestructable('B003', (uX-dfc), (uY), 0, 1, 1)
local destructable westB = CreateDestructable('B003', (uX-dfc), (uY-dbb), 0, 1, 0)
local destructable eastT = CreateDestructable('B003', (uX+dfc), (uY+dbb), 180, 1, 0)
local destructable eastM = CreateDestructable('B003', (uX+dfc), (uY), 180, 1, 1)
local destructable eastB = CreateDestructable('B003', (uX+dfc), (uY-dbb), 180, 1, 0)
local integer level = GetUnitAbilityLevel(u, 'A04Y')
// d&d part
local unit dummy = CreateUnit( GetOwningPlayer(u), 'h003', uX, uY, 0 )
call UnitAddAbility( dummy, 'A003' )
call IssuePointOrder( dummy, "deathanddecay", uX, uY )
call UnitApplyTimedLife( dummy, 'BTLF', (2+(level*2) ) )
// === DURATION OF DUMMY => level*3 ==> yields a 3/6/9 lifetime for channeling
call SetHandleHandle(I2Timer(boxT), "nL", northL)
call SetHandleHandle(I2Timer(boxT), "nM", northM)
call SetHandleHandle(I2Timer(boxT), "nR", northR)
call SetHandleHandle(I2Timer(boxT), "sL", southL)
call SetHandleHandle(I2Timer(boxT), "sM", southM)
call SetHandleHandle(I2Timer(boxT), "sR", southR)
call SetHandleHandle(I2Timer(boxT), "wT", westT)
call SetHandleHandle(I2Timer(boxT), "wM", westM)
call SetHandleHandle(I2Timer(boxT), "wB", westB)
call SetHandleHandle(I2Timer(boxT), "eT", eastT)
call SetHandleHandle(I2Timer(boxT), "eM", eastM)
call SetHandleHandle(I2Timer(boxT), "eB", eastB)
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl", u, "overhead" ) )
// === DURATION of BOXES ==> ( 3 + 3*lvl ) ==> yeilds 6/9/12
call TimerStart(I2Timer(boxT), ( 3 + (3*level) ) , false, function Trig_Enter_The_Ring_BoxRemoval )
set u = null
set dummy = null
set northL = null
set northM = null
set northR = null
set southL = null
set southM = null
set southR = null
set westT = null
set westM = null
set westB = null
set eastT = null
set eastM = null
set eastB = null
endfunction
and CleanTimer() is defined like this:
JASS:
function CleanTimer takes timer t returns nothing
call PauseTimer(t)
call FlushHandleLocals(t)
call DestroyTimer(t)
endfunction
thanks.