Jump to content

[Patch]Prevent Disappear Fly NPC

Guest mns

Recommended Posts

Prevent fall NPC to far depth when getHeight( ) function can`t process valid height

diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 0c6da8e..08ecfb8 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -1416,10 +1416,11 @@ bool Creature::FallGround()
    // use larger distance for vmap height search than in most other cases
    float tz = GetMap()->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true, MAX_FALL_DISTANCE);

-    if (tz < INVALID_HEIGHT)
+    if (tz <= INVALID_HEIGHT)
        DEBUG_LOG("FallGround: creature %u at map %u (x: %f, y: %f, z: %f), not able to retrive a proper GetHeight (z: %f).",
            GetEntry(), GetMap()->GetId(), GetPositionX(), GetPositionX(), GetPositionZ(), tz);
+        return false;

    // Abort too if the ground is very near

Link to comment
Share on other sites

  • 1 year later...

This don't must be case o.O

Someone break expected height check in matser also :((

INVALID_HEIGHT must be by original design used _only_ for checks. in past exist special greter by abs() value mark real invalid height...

Look at still exist vmap mirror:

    #define VMAP_INVALID_HEIGHT       -100000.0f            // for check
   #define VMAP_INVALID_HEIGHT_VALUE -200000.0f            // real assigned value in unknown height case

Link to comment
Share on other sites

  • 1 month later...
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use