AMAI
AMAI copied to clipboard
BuildMovePeonZeppelin bug
https://github.com/SMUnlimited/AMAI/blob/96800f004d3a1ba2d891fa9cbfacaa840401f420/common.eai#L9577
set build_zeppelin = GetUnusedZeppelinNearUnit(peon)
// Disabled just in case
set build_zeppelin = null
if build_zeppelin == null then
call Trace("No Zeppelin found for transporting peon")
return false
endif
**if build_zeppelin == null then**
but build_zeppelin is null now , set build_zeppelin = null
function BuildMovePeonZeppelin takes unit peon, unit target returns boolean
if build_zeppelin == null or not UnitAlive(build_zeppelin) then
set build_zeppelin = GetUnusedZeppelinNearUnit(peon)
// Disabled just in case
set build_zeppelin = null
if build_zeppelin == null then
call Trace("No Zeppelin found for transporting peon")
return false
endif
call GroupAddUnit(unit_zepplin_move, build_zeppelin)
endif
if IsUnitInTransport(peon, build_zeppelin) then
if DistanceBetweenUnits(build_zeppelin, target) > 300 then
call IssuePointOrder(build_zeppelin, "move", GetUnitX(target), GetUnitY(target))
else
call IssueTargetOrder(build_zeppelin, "unload", peon)
endif
else
if DistanceBetweenUnits(peon, target) < 400 then
call GroupRemoveUnit(unit_zepplin_move, build_zeppelin)
set build_zeppelin = null
return true
else
call IssueTargetOrder(peon, "smart", build_zeppelin)
endif
endif
return false
endfunction