aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGacko <gacko28@gmx.de>2013-03-26 21:49:22 +0100
committerGacko <gacko28@gmx.de>2013-03-26 21:51:59 +0100
commite635ba5b813464797ea834f845b723c54cfc469b (patch)
tree3f9095e08463de0d17da5a645fcdb27be11add32 /src
parentd7d62e4248d70866bce56b72b42302fdc6d6b7b5 (diff)
Core/SmartAI: SMART_ACTION_FORCE_DESPAWN for dead creatures
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 9c476ea55fc..f5a75de73f8 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1023,8 +1023,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!IsSmart())
break;
- CAST_AI(SmartAI, me->AI())->SetDespawnTime(e.action.forceDespawn.delay + 1);//next tick
- CAST_AI(SmartAI, me->AI())->StartDespawn();
+ // The AI is only updated if the creature is alive
+ if (me->isAlive())
+ {
+ CAST_AI(SmartAI, me->AI())->SetDespawnTime(e.action.forceDespawn.delay + 1); // Next tick
+ CAST_AI(SmartAI, me->AI())->StartDespawn();
+ }
+ // Otherwise we call the despawn directly
+ else
+ me->DespawnOrUnsummon(e.action.forceDespawn.delay);
+
break;
}
case SMART_ACTION_SET_INGAME_PHASE_MASK: