PDA

View Full Version : BestZ Calculation for aggroed mobs, pet follow and mobs pathing back to spawn point


Derision
08-03-2008, 06:39 AM
At the moment, when CalculateNewPosition2 is called for:

Pet's following their master
Aggroed mobs pursuing a player
Mobs pathing back to their spawn point (because player is FD/Dead/Zoned)

it is called with the checkZ parameter omitted. This defaults to false, and therefore mobs/pets can 'bounce' or disappear under the world in these situations, particularly over uneven ground
(I performed my tests in nektulos, eastkarana, and commons).

In mob.h, around line 736 or so, find:

bool CalculateNewPosition2(float x, float y, float z, float speed, bool checkZ = false);


and change it to:

bool CalculateNewPosition2(float x, float y, float z, float speed, bool checkZ = true);


Note that there is both a CalculateNewPosition and CalculateNewPosition2 function. You can ignore the first one as it is no longer used.

In my testing this morning, this seems to work well in the scenarios I listed above. (It won't stop all occurrences of mobs disappearing under the world, as there are other reasons that happens).

Of course, the extra Z checks will add some extra CPU overhead, so anyone running a populated server should keep an eye on that if they make this change.

Angelox
08-03-2008, 08:31 AM
First thing that came to mind was the Orc Lift in GFay - I always seemed to have problems getting trains (I unfortunately made myself) to the guards there. Once I got aggro, couldn't go back because they would pop out of nowhere and be all over me again.
Well, this fixed that: with out the fix, I made a big train of around 10, they would occasionally come from inside the hill just in front of the Orc lift (others never came, until I went up the hill again).
With your fix, I made roughly the same train , now they all run over the hill to the orc lift, no delays.