Trinitycore: [3.3.5/Master] Game/AI: SMART_ACTION_JUMP_TO_POS should resume path when reached jump location

Created on 7 Jan 2017  路  11Comments  路  Source: TrinityCore/TrinityCore

Description: smart script action SMART_ACTION_JUMP_TO_POS .

Current behaviour: don't resume path when reached jump location.

Expected behaviour: should resume path when reached jump location.

Steps to reproduce the problem:

  1. Get the Escape from Silverbrook quest for example.
  2. Sit on a ducal's horse.
  3. When ducal's horse reached jump location waypoint path isn't resuming.

Branch(es): 3.3.5 / master

TC rev. hash/commit: https://github.com/TrinityCore/TrinityCore/commit/b1fa8ff028fbb7469ef93f5c5612869ec9ba37ae

TDB version: TDB335.62

Operating system: Linux

Branch-3.3.5a Branch-master Comp-Core Sub-Waypoints

Most helpful comment

@xinef1 you are right, without unit->GetMotionMaster()->Initialize(); it works fine, but I have new behaviour: creature returns back at jump point after jump and continues move by path.

All 11 comments

Edit: unneded as of now, escorts are on idle slot but this should be applied in other cases (point movement for eg.)

 src/server/game/AI/SmartScripts/SmartScript.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 2c35bea..a31bc00 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -2034,7 +2034,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
             {
                 if (Creature* creature = (*itr)->ToCreature())
                 {
-                    creature->GetMotionMaster()->Clear();
+                    // do not clear all movement generators, MoveJump is set to controlled slot so other generators won't be updated anyway
+                    //creature->GetMotionMaster()->Clear();
                     creature->GetMotionMaster()->MoveJump(e.target.x, e.target.y, e.target.z, 0.0f, (float)e.action.jump.speedxy, (float)e.action.jump.speedz); // @todo add optional jump orientation support?
                 }
             }

@xinef1 isn't working

Ignore my previous comments, escorts are put at idle slots so clear doesnt affect them (which is bad and should be moved to active). Problem comes from EffectMovementGenerator::Finalize and precisely - unit->GetMotionMaster()->Initialize(); Don't know who uncommented that but this is very bad. At most top generator should be reset.

@xinef1 you are right, without unit->GetMotionMaster()->Initialize(); it works fine, but I have new behaviour: creature returns back at jump point after jump and continues move by path.

The escort change should never utilize existing waypoint movement generator, this creates huge poop and was not done properly. Sometimes internal counter is used, sometimes id returned from spline. There are a lot of errors, people without enough knowledge shouldn't make so huge changes.

Any news?

Fix

diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 4d23ba1..c318a0d 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -2039,12 +2039,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
             for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
             {
                 if (Creature* creature = (*itr)->ToCreature())
-                {
-                    creature->GetMotionMaster()->Clear();
                     creature->GetMotionMaster()->MoveJump(e.target.x, e.target.y, e.target.z, 0.0f, (float)e.action.jump.speedxy, (float)e.action.jump.speedz); // @todo add optional jump orientation support?
-                }
             }
-            /// @todo Resume path when reached jump location
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
index cfe0095..bdde022 100755
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
@@ -142,8 +142,6 @@ void EffectMovementGenerator::Finalize(Unit* unit)
     {
         if (Unit* victim = unit->GetVictim())
             unit->GetMotionMaster()->MoveChase(victim);
-        else
-            unit->GetMotionMaster()->Initialize();

Care to make a PR for that fix, @Eliminationzx ? :-)

@tkrokli , sure.

@tkrokli, can you make a PR?

OK, sure, as long as you are prepared to answer questions about how the changes work. :-)
(I will be using your git name/address as author, since you are the source of that code)


[edit] I found your git user in commit https://github.com/TrinityCore/TrinityCore/commit/37b2f590b6d63f230c755f932c2dd356c265486f (I presume it is still valid for your current user).
Oh BTW: I will refer to your tests in-game for validation of the PR (my local build + your tests in-game).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

funjoker picture funjoker  路  3Comments

Lopfest picture Lopfest  路  3Comments

Tatara902 picture Tatara902  路  3Comments

chilito picture chilito  路  3Comments

daddycaddy picture daddycaddy  路  3Comments