TrinityCore/TrinityCore — Issue #5027: Core/SAI: dead creatures which are using SAI can't execute any command during death
Author: tREAk
Created: 2012-02-01 00:12:27+00:00
State: open

i say it simple - a dead creature which is using SAI can't execute any command during its death

an example

```sql
SET @ENTRY := 18069;
SET @QUEST := 9977;
SET @SPELL_CHAIN_LIGHTNING := 16033;
SET @SPELL_FLAME_SHOCK := 39529;
SET @SPELL_HEALING_WAVE := 15982;
SET @SPELL_FRENZY := 28747;
SET @SPELL_REVIVE_SELF := 32343;
UPDATE `creature_template` SET `AIName`="SmartAI",`faction_A`=35,`faction_H`=35 WHERE `entry`=@ENTRY;
DELETE FROM `creature` WHERE `id`=@ENTRY;
INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`) VALUES
(1022681,@ENTRY,530,1,1,0,0,-714.823,7931.65,58.8672,4.3693,300,0,0,60720,29330,0,0,0,0);
DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@ENTRY,@ENTRY*100,@ENTRY*100+1);
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,0,0,100,0,1000,1000,3500,3500,11,@SPELL_CHAIN_LIGHTNING,0,0,0,0,0,2,0,0,0,0,0,0,0,"Mogor - In Combat - Cast Chain Lightning"),
(@ENTRY,0,1,0,0,0,100,0,4000,4000,11000,13000,11,@SPELL_FLAME_SHOCK,0,0,0,0,0,2,0,0,0,0,0,0,0,"Mogor - In Combat - Cast Flame Shock"),
(@ENTRY,0,2,0,2,0,100,1,0,60,0,0,11,@SPELL_HEALING_WAVE,1,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - At 60% HP - Cast Healing Wave"),
(@ENTRY,0,3,0,2,0,100,1,0,30,0,0,11,@SPELL_FRENZY,1,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - At 30% HP - Cast Frenzy"),
(@ENTRY,0,4,0,2,0,100,1,0,30,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"Mogor - At 30% HP - Say Line 0"),
(@ENTRY,0,5,0,6,0,100,1,0,0,0,0,80,@ENTRY*100+1,0,2,0,0,0,1,0,0,0,0,0,0,0,"Mogor - On Death - Run Script"), -- SCRIPT STOPS HERE !!!
(@ENTRY*100+1,9,0,0,0,0,100,0,2000,2000,0,0,11,@SPELL_REVIVE_SELF,2,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - On Script - Cast Revive Self"),
(@ENTRY*100+1,9,1,0,0,0,100,0,1000,1000,0,0,70,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - On Script - Revive Self"),
(@ENTRY*100+1,9,2,0,0,0,100,0,1000,1000,0,0,1,5,0,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - On Script - Say Line 5"),
(@ENTRY*100+1,9,3,0,0,0,100,0,500,500,0,0,49,0,0,0,0,0,0,21,0,0,0,0,0,0,0,"Mogor - On Script - Attack Closest Player"),
(@ENTRY,0,6,0,38,0,100,0,12,12,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - On Data Set - Say Line 1"),
(@ENTRY,0,7,0,38,0,100,0,13,13,0,0,1,2,0,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - On Data Set - Say Line 2"),
(@ENTRY,0,8,0,38,0,100,0,14,14,0,0,1,6,0,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - On Data Set - Say Line 6"),
(@ENTRY,0,9,10,38,0,100,0,1,1,0,0,53,0,@ENTRY,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - On Data Set - Start WP"),
(@ENTRY,0,10,0,61,0,100,0,0,0,0,0,1,3,0,0,0,0,0,7,0,0,0,0,0,0,0,"Mogor - On Data Set - Say Line 3"),
(@ENTRY,0,11,12,40,0,100,0,4,@ENTRY,0,0,54,100000,0,2,0,0,0,1,0,0,0,0,0,0,0,"Mogor - At WP 4 - Pause Path"),
(@ENTRY,0,12,0,61,0,100,0,0,0,0,0,80,@ENTRY*100,0,2,0,0,0,1,0,0,0,0,0,0,0,"Mogor - At WP 4 - Run Script"),
(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,1,4,0,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - On Script - Say Line 4"),
(@ENTRY*100,9,1,0,0,0,100,0,5000,5000,0,0,2,14,0,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - On Script - Set Faction Aggressive"),
(@ENTRY*100,9,2,0,0,0,100,0,9,9,0,0,8,2,0,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - On Script - Set React State Aggressive"),
(@ENTRY,0,13,0,21,0,100,0,0,0,0,0,2,35,0,0,0,0,0,1,0,0,0,0,0,0,0,"Mogor - Reached Home - Set Faction Friendly");
```

"-- SCRIPT STOPS HERE !!!" marks the line after which the creature doesn't do any of its following executions