SMUnlimited / AMAI

Advanced Melee Artificial Intelligence Mod For Warcraft 3
Other
211 stars 34 forks source link

SleepInCombatAM like have bug #398

Closed jzy-chitong56 closed 1 month ago

jzy-chitong56 commented 1 month ago

set u is if (lastcaptainx != 0 and lastcaptainy != 0) then In fact, this condition is almost 100% met, which means that it will be reset every time the loop is repeated. I think we need to add self-locking here and only reacquire when U is null or dead

if (lastcaptainx != 0 and lastcaptainy != 0) and (u == null or not UnitAlive(u)) then


call TeleportCaptain(lastcaptainx, lastcaptainy) maybe need check Combat

if not CaptainInCombat(true) then
  call TeleportCaptain(lastcaptainx, lastcaptainy)
endif

if (u != null and (not CaptainInCombat(true) or CaptainRetreating() or CaptainIsHome())) then It seems that the parentheses are written in the wrong position here. Is the original intention

not CaptainInCombat(true)
not CaptainRetreating() 
not CaptainIsHome()
jzy-chitong56 commented 1 month ago

TeleportCaptain maybe need check Retreating

        if not CaptainInCombat(true) and not CaptainRetreating() then
          call TeleportCaptain(lastcaptainx, lastcaptainy)
        endif
SMUnlimited commented 1 month ago

No unless true retreat control is engaged (which is picked up by earlier exitwhen) its fine in this case as it should stay around by design to pick up items.