that's most of it i missed a bit of the begining the "call_ function or something like that (i'm not very experienced in JASS) but i want to be able to remove the position based off of something like that.
Or is there an easier way to clean up locations that i only use once?
PolarProjectionBJ returns a loction which you HAVE to store in a variable and so do GetUnitLoc. You HAVE to store them in a variable, then use them, and then remove them.. Like this:
function SomeFunc takes nothing returns nothing
local location l = GetUnitLoc(gg_unit_U000_0051)
local location p = PolarProjectionBJ(l, 60.00, GetUnitFacing(gg_unit_U000_0051) - 135)
call SetUnitPositionLocFacingBJ(udg_Sentinel[1], p, GetUnitFacing(gg_unit_U000_0051)+180)
call RemoveLocation(l) // removes the location sp it won't leak
set l = null // nullyfies the var, so it doesn't leak
call RemoveLocation(p)
set p = null
endfunction
You don't really have to use paranthesis in this function.
Could i simply make a point variable for the whole thing(ie set Point[1] equal to positoin of X unit ofset by X towards X degrees balh blah blah....), move the unit to that point, and remove the point to clean it up?
Why is it leaky? PolarProjection itself produes leak. GetUnitLoc(cast) produces leak. GetUnitLoc(targ) produces leak. To avoid all the leaks, you need to add the custom code: Remove(PolarProjection). But unfortunately in this case, you will refer to the GetUnitLoc(targ) and GetUnitLoc(cast) ONCE AGAIN. Sooo... Remove these too, but only once you removed the polar projection. Got it by here? Hope so...
Ok, forcefully moving an unit while you remove the polar projection, position, etc. is leakless. But if you forget to remove only one such position you will realize that in the end it will leak, by freezing your computer slowly.