From 6c1efd74cb8e8afdc25b6a7bcb27a774f2ae5893 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 14 Jul 2017 21:45:38 -0500 Subject: [PATCH] Resolve an issue with NPC's not returning back to guard point when once engaged and dropped aggro --- zone/mob.cpp | 4 ++-- zone/mob_ai.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 02cd1a5dc..fc7772b8d 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1437,7 +1437,7 @@ void Mob::SendHPUpdate(bool skip_self /*= false*/, bool force_update_all /*= fal } } -// this one just warps the mob to the current location +/* Used for NPCs mainly */ void Mob::SendPosition() { @@ -1446,7 +1446,7 @@ void Mob::SendPosition() MakeSpawnUpdateNoDelta(spu); /* When an NPC has made a large distance change - we should update all clients to prevent "ghosts" */ - if (DistanceSquared(last_major_update_position, m_Position) > (100 * 100)) { + if (DistanceSquared(last_major_update_position, m_Position) >= (100 * 100)) { entity_list.QueueClients(this, app, true, true); last_major_update_position = m_Position; } diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 633dde297..a016b98e6 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1006,7 +1006,12 @@ void Mob::AI_Process() { } else if (!this->CheckLosFN(this->GetTarget())) { Mob* target = this->GetTarget(); - this->GMMove(target->GetX(), target->GetY(), target->GetZ(), target->GetHeading()); + + m_Position.x = target->GetX(); + m_Position.y = target->GetY(); + m_Position.z = target->GetZ(); + m_Position.w = target->GetHeading(); + SendPosition(); } } }