I can't find the leak of the code.Does anyone know where it needs to be changed?
Code:
udg_distance = 999999.00
hx = GetUnitX(gg_unit_Hblm_0001)
hy = GetUnitY(gg_unit_Hblm_0001)
local range = 512.00/5
local g = CreateGroup()
local b = true
for n=1,5 do
local bxp = Condition(function ()
if (GetFilterUnit() == gg_unit_Hblm_0001) then
return false
else
b = false
local u = GetFilterUnit()
local x = GetUnitX(u)
local y = GetUnitY(u)
local r = (hx-x)^2+(hy-y)^2
if (r < udg_distance) then
udg_distance = r
udg_unit = u
end
return true
end
end)
GroupEnumUnitsInRange(g, hx, hy, range*n, bxp)
DestroyBoolExpr(bxp)
if ( b == false ) then
break
end
end
DestroyGroup(g)
udg_distance = 999999.00