From 00e18adfacf3cb3067c9e84608ab07755bcd3e24 Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Thu, 30 Jul 2015 17:59:48 +0300 Subject: [PATCH] Fix https://github.com/ElunaLuaEngine/Eluna/issues/157 --- ElunaCreatureAI.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ElunaCreatureAI.h b/ElunaCreatureAI.h index 76b294e..8462303 100644 --- a/ElunaCreatureAI.h +++ b/ElunaCreatureAI.h @@ -18,13 +18,14 @@ struct ScriptedAI; struct ElunaCreatureAI : ScriptedAI { + // used to delay the spawn hook triggering on AI creation + bool justSpawned; #ifndef TRINITY #define me m_creature #endif - ElunaCreatureAI(Creature* creature) : ScriptedAI(creature) + ElunaCreatureAI(Creature* creature) : ScriptedAI(creature), justSpawned(true) { - JustRespawned(); } ~ElunaCreatureAI() { } @@ -35,6 +36,9 @@ struct ElunaCreatureAI : ScriptedAI void UpdateAI(uint32 diff) override #endif { + if (justSpawned) + JustRespawned(); + if (!sEluna->UpdateAI(me, diff)) { #ifdef TRINITY