SMUnlimited / AMAI

Advanced Melee Artificial Intelligence Mod For Warcraft 3
Other
192 stars 31 forks source link

GetCreepGuardGroup save unit maybe have some bug #310

Closed jzy-chitong56 closed 1 month ago

jzy-chitong56 commented 1 month ago

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
jzy-chitong56 commented 1 month ago

NeutralGuardedJob Not following logic

The order is reversed -- GetNeutralGuard and GetCreepGuardGroup