From 3c2b0483673acf8460f36c38b802d4bfc5ddfbca Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Sat, 10 Feb 2024 18:12:30 +0200 Subject: [PATCH] Attempt to continue moving towards enemy when in water. If our current or last action was AI_ACTION_SEEK_OPPONENT. The AI tends to flipflop between jumping into water, swimming a certain distance and then "panic" because they're in the water and then try to reach the closest land tile. Which is often right where they entered the water. Adding a bit of decision momentum with this change should help with that. --- TacticalAI/DecideAction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TacticalAI/DecideAction.cpp b/TacticalAI/DecideAction.cpp index cf9ba2fa..680b9c30 100644 --- a/TacticalAI/DecideAction.cpp +++ b/TacticalAI/DecideAction.cpp @@ -10599,7 +10599,7 @@ ActionType DecideActionStuckInWaterOrGas(SOLDIERTYPE *pSoldier, BOOLEAN ubCanMov DebugAI(AI_MSG_TOPIC, pSoldier, String("[Decide action if stuck in water or gas]")); // when in deep water, move to closest opponent - if (ubCanMove && (bInDeepWater || bInWater) && !pSoldier->aiData.bNeutral && pSoldier->aiData.bOrders == SEEKENEMY) + if (ubCanMove && (bInDeepWater || bInWater) && !pSoldier->aiData.bNeutral && (pSoldier->aiData.bOrders == SEEKENEMY || pSoldier->aiData.bAction == AI_ACTION_SEEK_OPPONENT || pSoldier->aiData.bLastAction == AI_ACTION_SEEK_OPPONENT)) { // find closest reachable opponent, excluding opponents in deep water BOOLEAN fClimbDummy;