Permalink
Browse files

Core/SmartAI: SMART_ACTION_FORCE_DESPAWN for dead creatures

  • Loading branch information...
1 parent d7d62e4 commit e635ba5b813464797ea834f845b723c54cfc469b @Gacko Gacko committed Mar 26, 2013
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/server/game/AI/SmartScripts/SmartScript.cpp
View
12 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:

1 comment on commit e635ba5

@Krogonos

Very nice little catch

Please sign in to comment.