Technomancer
New Member
- Reaction score
- 14
Here's the code, moves my flying frog or whatever to wherever:
Normally it'd be obvious to destroy this timer but it's attached to another object in a table elsewhere, however, I know I'll NEVER be using this particular timer again, so how should I go about destroying the leak? I don't want a leak every time someone fires a projectile, especially if I'm trying to make a projectile based map.
Also I just wanted to check my syntax; the unit destroys itself on contact with an enemy, so if I call up the unit later and it's gone, I'll get a null pointer correct? (I just pulled that out of my ass)
JASS:
function Projectile_Move takes nothing returns nothing
local timer t = GetExpiredTimer()
local string s = GetAttachmentTable(t)
local trigger trig
local string strig
local real ang = GetTableReal(s, "ang")
local unit u = GetTableUnit(s, "u")
if (u == null) then
PauseTimer(t) //DestroyTimer(t) ????
else
call SetUnitPosition(u, GetUnitX(u) + 30 * Cos(ang * bj_DEGTORAD), GetUnitY(u) + 30 * Sin(ang * bj_DEGTORAD) )
endif
endfunction
Normally it'd be obvious to destroy this timer but it's attached to another object in a table elsewhere, however, I know I'll NEVER be using this particular timer again, so how should I go about destroying the leak? I don't want a leak every time someone fires a projectile, especially if I'm trying to make a projectile based map.
Also I just wanted to check my syntax; the unit destroys itself on contact with an enemy, so if I call up the unit later and it's gone, I'll get a null pointer correct? (I just pulled that out of my ass)