From ad94721b7cd31ea99fbbc631560cff39cbac2ef9 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 28 Apr 2021 10:36:17 -0400 Subject: [PATCH] Core/SAI: Don't clear stored pathid if it changed after processing waypoint events Port From (https://github.com/TrinityCore/TrinityCore/commit/8b0de23d0e4b15fce8dc8c67f9512f76804d6439) --- Source/Game/AI/SmartScripts/SmartAI.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Game/AI/SmartScripts/SmartAI.cs b/Source/Game/AI/SmartScripts/SmartAI.cs index 654f807a5..5b747d91a 100644 --- a/Source/Game/AI/SmartScripts/SmartAI.cs +++ b/Source/Game/AI/SmartScripts/SmartAI.cs @@ -289,14 +289,15 @@ namespace Game.AI if (fail) return; - GetScript().ProcessEventsFor(SmartEvents.WaypointEnded, null, _currentWaypointNode, GetScript().GetPathId()); + uint pathid = GetScript().GetPathId(); + GetScript().ProcessEventsFor(SmartEvents.WaypointEnded, null, _currentWaypointNode, pathid); if (_repeatWaypointPath) { if (IsAIControlled()) StartPath(_run, GetScript().GetPathId(), _repeatWaypointPath); } - else + else if (pathid == GetScript().GetPathId()) // if it's not the same pathid, our script wants to start another path; don't override it GetScript().SetPathId(0); if (_despawnState == 1)