diff --git a/Source/Game/AI/SmartScripts/SmartAIManager.cs b/Source/Game/AI/SmartScripts/SmartAIManager.cs index e49a5947b..7c4f71374 100644 --- a/Source/Game/AI/SmartScripts/SmartAIManager.cs +++ b/Source/Game/AI/SmartScripts/SmartAIManager.cs @@ -2652,6 +2652,9 @@ namespace Game.AI [FieldOffset(4)] public OverrideWeather overrideWeather; + [FieldOffset(4)] + public Evade evade; + [FieldOffset(4)] public Conversation conversation; @@ -3196,6 +3199,10 @@ namespace Game.AI public uint weatherId; public uint intensity; } + public struct Evade + { + public uint toRespawnPosition; + } public struct Conversation { public uint id; diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index ed1ac06b8..1e1728058 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -711,6 +711,13 @@ namespace Game.AI if (_me == null) break; + // Reset home position to respawn position if specified in the parameters + if (e.Action.evade.toRespawnPosition == 0) + { + _me.GetRespawnPosition(out float homeX, out float homeY, out float homeZ, out float homeO); + _me.SetHomePosition(homeX, homeY, homeZ, homeO); + } + _me.GetAI().EnterEvadeMode(); Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_EVADE: Creature {0} EnterEvadeMode", _me.GetGUID().ToString()); break;