diff --git a/zone/mob.h b/zone/mob.h index 8286bf647..cd7ecf7a8 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -1091,7 +1091,7 @@ protected: int _GetWalkSpeed() const; int _GetRunSpeed() const; int _GetFearSpeed() const; - virtual bool MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, bool checkZ); + virtual bool MakeNewPositionAndSendUpdate(float x, float y, float z, int speed); virtual bool AI_EngagedCastCheck() { return(false); } virtual bool AI_PursueCastCheck() { return(false); } diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index e1e4682b0..14e9337ac 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1536,7 +1536,11 @@ void NPC::AI_DoMovement() { Log(Logs::Detail, Logs::AI, "Roam Box: d=%.3f (%.3f->%.3f,%.3f->%.3f): Go To (%.3f,%.3f)", roambox_distance, roambox_min_x, roambox_max_x, roambox_min_y, roambox_max_y, roambox_movingto_x, roambox_movingto_y); - if (!CalculateNewPosition2(roambox_movingto_x, roambox_movingto_y, GetZ(), walksp, true)) + + float new_z = this->FindGroundZ(m_Position.x, m_Position.y, 5); + new_z += (this->GetSize() / 1.55); + + if (!CalculateNewPosition2(roambox_movingto_x, roambox_movingto_y, new_z, walksp, true)) { roambox_movingto_x = roambox_max_x + 1; // force update pLastFightingDelayMoving = Timer::GetCurrentTime() + RandomTimer(roambox_min_delay, roambox_delay); diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 8eb838a72..c1997af59 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -451,7 +451,7 @@ float Mob::CalculateHeadingToTarget(float in_x, float in_y) { return (256 * (360 - angle) / 360.0f); } -bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, bool checkZ) { +bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed) { if (GetID() == 0) return true; @@ -627,7 +627,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, boo } bool Mob::CalculateNewPosition2(float x, float y, float z, int speed, bool checkZ, bool calcHeading) { - return MakeNewPositionAndSendUpdate(x, y, z, speed, checkZ); + return MakeNewPositionAndSendUpdate(x, y, z, speed); } bool Mob::CalculateNewPosition(float x, float y, float z, int speed, bool checkZ, bool calcHeading) {