First time it runs, everything is ok. But udg_TSp_Group[1] becomes corrupted. It returns all zero when ask to how many unit in udg_TSp_Group[1] . What's wrong?
JASS:
function Trig_Check_1 takes nothing returns nothing
local group g
local unit u
local location p
// Remove all diagonal neighbours and place them in Group 2
set g = udg_TSp_Group[1]
loop
set u = FirstOfGroup(g)
exitwhen u == null
set p = GetUnitLoc(u)
if ( DistanceBetweenPoints(udg_TSp_Point[1], p) >= 265.00 ) then
call GroupAddUnit(udg_TSp_Group[2], u)
call GroupRemoveUnit(udg_TSp_Group[1], u)
endif
call RemoveLocation( p )
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g = null
endfunction