Trinitycore: Core/EscortAI: Creatures with EscortAI can't change between walking and running mode [$5 bounty]

Created on 22 Jan 2018  路  12Comments  路  Source: TrinityCore/TrinityCore

Description:

Creatures with EscortAI are stuck in Walk Mode, maybe only the ones that use script_waypoint, not sure about how wide is the problem.

At least part of the problem seems to be here: https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp#L474
By the time this function is called, the variable _running still has the default value, not the one selected by the script. And just changing the order from the calls, to properly initilize the _running variable first, doesn't seem to fix it, because then, creature will always run and ignore SetRun(false) or me->SetWalk(true).

Current behaviour:

Creatures ignore script changes, apparently they are all stucked in Walk mode.

Expected behaviour:

Creatures should obey the script calls to change between walking and running.

Steps to reproduce the problem:

(I know that this is a bad example, due to old/bad script, but it's enough to prove the point)

  1. .go xyz 1912 1286 143 595
  2. Talk to Arthas(26499) and observe he will perform the whole event walking, disregarding several script calls do SetRun(true);

Branch(es): 3.3.5

TC rev. hash/commit: https://github.com/TrinityCore/TrinityCore/commit/514c847881a9fff504e90f1186a1209c0b8a3674

Branch-3.3.5a Comp-Core Sub-Movement bounty

Most helpful comment

Confirm the issue with the Quest light of dawn, but for Arthas on COS the issue looks to be fixed, he's able to switch between run and walk.

All 12 comments

Does this solve the issue? The affected script should use SetRun(bool) and not me->setWalk(bool).

diff --git src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 504226a2c2..14bb77dc71 100644
--- src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -354,12 +354,17 @@ void EscortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false */,

 void EscortAI::SetRun(bool on)
 {
-    if (on && !_running)
+    if (on || !_running)
+    {
         me->SetWalk(false);
-    else if (!on && _running)
+        _running = true;
+    }
+    else if (!on || _running)
+    {
         me->SetWalk(true);
+        _running = false;
+    }

-    _running = on;
 }

 void EscortAI::SetEscortPaused(bool on)

It doesn't work 馃樋
I think _running is being updated correctly already, but the scripts doesn't react to it.
Theory is that whathever speed is set when this line is called, will be maintened for the whole script, completely ignoring the speed change calls.
node.moveType = _running ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK;

did you replace the calls to SetRun(true/false) as well?

I'm testing the patch will report my findings.

yeah its a mistake, @sirikfoll 's point is correct

previous code called MovePoint on each node, so the run boolean did apply
ref https://github.com/TrinityCore/TrinityCore/blob/00329fe9a505c437af0b7591d8321bf3b77ad7fb/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp#L267

thinking what the best approach can be..

whats the quest ID? His quest is not appearing?

edit:
Someone who has the quest active check the ID value in DB please lol.

Any news on this? maybe create a bounty?

Mby @Treeston can take a look?

This is a really bad problem, as it has broken most of the dungeon/raid encounters that use escort_ai

@Treeston this issue is not fixed as well
Reproduce = Quest light of dawn Dk starting zone
See as darion mograine still walking instead of running
https://github.com/TrinityCore/TrinityCore/commit/121346f1f9d058079e662ce77c63f1d13b13517f did not fix this

Confirm the issue with the Quest light of dawn, but for Arthas on COS the issue looks to be fixed, he's able to switch between run and walk.

@Treeston re-open this issue please, as it has not been fixed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DDuarte picture DDuarte  路  3Comments

Keader picture Keader  路  3Comments

Rushor picture Rushor  路  3Comments

Rushor picture Rushor  路  3Comments

Teppic1 picture Teppic1  路  3Comments