call SaveUnitHandle(com, NEUTRAL_GUARDS, i, u)
nearest_neutral[nn] will change , nn is different units
but every time it is stored, it starts from the same cell -- call SaveUnitHandle(com, NEUTRAL_GUARDS, i, u) , NEUTRAL_GUARDS, i no change but nn change
expansion_creeps is new table, com not
function GetCreepGuardGroup takes integer nn returns nothing
local integer i = 0
local unit u = null
local group g = null
if nearest_neutral[nn] != null then
set g = CreateGroup()
set g = CheckCreepsByRadius(g, nearest_neutral[nn], 750)
loop
set u = FirstOfGroup(g)
exitwhen u == null
set i = i + 1
call SaveUnitHandle(com, NEUTRAL_GUARDS, i, u)
call GroupRemoveUnit(g, u)
endloop
call SaveInteger(com, NEUTRAL_GUARDS, 0, i) // Store size in first element
endif
endfunction
can give a exit mechanism to reduce detection frequency
if tempnear == 0 and LoadInteger(t, current_expansion_creeps, 0) != 0 then
call SaveInteger(t, current_expansion_creeps, 0, 0)
endif
call SaveUnitHandle(com, NEUTRAL_GUARDS, i, u)
nearest_neutral[nn] will change , nn is different units but every time it is stored, it starts from the same cell --call SaveUnitHandle(com, NEUTRAL_GUARDS, i, u)
,NEUTRAL_GUARDS, i
no change but nn changeexpansion_creeps is new table, com not
can give a exit mechanism to reduce detection frequency