Jump to content

[patch?]Creature evade


Guest laise

Recommended Posts

attempt to fix proper creature evade when player teleports - example:

enter instance, aggro few mobs, run to exit, enter instance again - same mobs will be waiting for you (stuck there)happening because ObjectGridStoper::Visit(CreatureMapType &m) explicitly stops attack so when creature gets ::Update it falls on the check

  // no target but something prevent go to evade mode
   if( !isInCombat() || HasAuraType(SPELL_AURA_MOD_TAUNT) )
       return false;

in bool Unit::SelectHostileTarget() - preventing to enter proper EvadeMode when there is no target..

I think there are cases when isInCombat is needed in this if & same with CombatStop() that sometimes just need to stop combat so i dont want to touch 'em

so here is my fix :

diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp
index 506cac1..41f9d7e 100644
--- a/src/game/ObjectGridLoader.cpp
+++ b/src/game/ObjectGridLoader.cpp
@@ -20,6 +20,7 @@
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Creature.h"
+#include "CreatureAI.h"
#include "GameObject.h"
#include "DynamicObject.h"
#include "Corpse.h"
@@ -288,8 +289,7 @@ ObjectGridStoper::Visit(CreatureMapType &m)
    // stop any fights at grid de-activation and remove dynobjects created at cast by creatures
    for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
    {
-        iter->getSource()->CombatStop();
-        iter->getSource()->DeleteThreatList();
+        iter->getSource()->AI()->EnterEvadeMode();
        iter->getSource()->RemoveAllDynObjects();
    }
}

so far the only known bug(?) with it is - when you enter instance again after you left mobs in the entrance you will see them going back to their places (evade)..

Link to comment
Share on other sites

so far the only known bug(?) with it is - when you enter instance again after you left mobs in the entrance you will see them going back to their places (evade)..

mobs its not active objects, so when you left instance, update not called for instance map and objects inside it, all timers became frozen

Link to comment
Share on other sites

×
×
  • 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