Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BuildExpansionJob need to avoid conflicts in zeppelin control #340

Open
jzy-chitong56 opened this issue Jul 23, 2024 · 0 comments
Open

BuildExpansionJob need to avoid conflicts in zeppelin control #340

jzy-chitong56 opened this issue Jul 23, 2024 · 0 comments

Comments

@jzy-chitong56
Copy link
Contributor

when send call IssueImmediateOrder(u, "stop") or call IssuePointOrderById(u, old_id[racial_expansion], x, y)

need to avoid conflicts in zeppelin control -- check IsUnitLoaded(u)

	if GetUnitCurrentOrder(u) == old_id[racial_expansion] or IsUnitLoaded(u) then
           ...
           call TQAddUnit2Job(RMax(d / 200 , 3), BUILD_EXPANSION, 0, u, expansion)

Because BuildMovePeonZeppelin(expansion_peon, current_expansion, w) is not a percentage guarantee for unLoaded, you may notice that sometimes it is uninstalled, but peon will go back and Loaded zeppelin again

The following code can effectively avoid this situation
At the same time, there is also a fallback setting to prevent StartExpansionAM from being unable to recover zeppelin after exiting prematurely due to other circumstances

if (w or f) and TownCountDone(neutral_zeppelin) > 0 then
      if build_zeppelin == null or not UnitAlive(build_zeppelin) then
        if build_zeppelin != null then
          call GroupRemoveUnit(unit_zepplin_move, build_zeppelin)
        endif
        set build_zeppelin = GetUnusedZeppelinNearUnit(build_zeppelin, expansion_peon)
        if build_zeppelin == null then
          call Trace("AMAIStartexpa: No Zeppelin found for transporting peon")
        else
          call GroupAddUnit(unit_zepplin_move, build_zeppelin)
          call RemoveGuardPosition(build_zeppelin)
          call TQAddUnitJob(GetTimeToReachUnit(build_zeppelin, current_expansion) + GetTimeToReachUnit(build_zeppelin, expansion_peon) + 30, RESET_GUARD_POSITION, 50, build_zeppelin)  // Prevent failure and failure to recover midway
        endif
      endif
      if (w and build_zeppelin == null) then
        call Trace("AMAIStartexpa: Water expansion required waiting to create a zeppelin")
        return BUILT_SOME
      endif
      if build_zeppelin != null then
        if not BuildMovePeonZeppelin(expansion_peon, current_expansion, w) then
          call Trace("AMAIStartexpa: Expanding via a zeppelin")
          return BUILT_SOME
        endif
        call RemoveGuardPosition(expansion_peon)  //Prevent being controll away from mine
        call TQAddUnitJob(2, RESET_GUARD_POSITION, 50, expansion_peon)
        call IssuePointOrder(expansion_peon, "move", GetUnitX(current_expansion), GetUnitY(current_expansion))
      endif
    endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant