[Completed][Complete] Whitebark's Spirit SAI

Hi all ^^

I was trying to convert the EventAI of this npc http://www.wowhead.com/npc=19456 and I came to this sql:

-- Defines SET @WHITEBARK_SPIRIT_ENTRY := 19456; SET @SPELL_ENTANGLING_ROOTS := 31287; SET @SPELL_WITHERED_TOUCH := 11442; -- Template UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@WHITEBARK_SPIRIT_ENTRY; -- Delete old data DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@WHITEBARK_SPIRIT_ENTRY; DELETE FROM `creature_ai_texts` WHERE `entry` IN (-1051,-1052); -- Texts DELETE FROM `creature_text` WHERE `entry`=@WHITEBARK_SPIRIT_ENTRY; INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES (@WHITEBARK_SPIRIT_ENTRY,0,0,'What good does this violence serve? What is done is done. I have failed my people.',12,0,50,0,0,0,'Whitebark''s Spirit - 19456'), (@WHITEBARK_SPIRIT_ENTRY,0,1,'Haven''t you done enough harm? Must you also disturb my slumber?',12,0,50,0,0,0,'Whitebark''s Spirit - 19456'); -- Script DELETE FROM `smart_scripts` WHERE `entryorguid`=@WHITEBARK_SPIRIT_ENTRY; 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 (@WHITEBARK_SPIRIT_ENTRY,0,0,0,0,0,100,0,2500,5500,12000,14500,11,@SPELL_ENTANGLING_ROOTS,0,0,0,0,0,2,0,0,0,0,0,0,0,'Whitebark''s Spirit - Casts Entangling Roots'), (@WHITEBARK_SPIRIT_ENTRY,0,1,0,0,0,100,0,7500,7500,9500,16000,11,@SPELL_WITHERED_TOUCH,0,0,0,0,0,2,0,0,0,0,0,0,0,'Whitebark''s Spirit - Casts Withered Touch'), (@WHITEBARK_SPIRIT_ENTRY,0,2,0,2,0,100,1,0,25,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Whitebark''s Spirit - Say At 25% HP'), (@WHITEBARK_SPIRIT_ENTRY,0,3,4,2,0,100,1,0,20,0,0,2,35,0,0,0,0,0,1,0,0,0,0,0,0,0,'Whitebark''s Spirit - At 20% HP change faction to friendly'), (@WHITEBARK_SPIRIT_ENTRY,0,4,0,61,0,100,0,0,0,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Whitebark''s Spirit - At 20% HP - evade'), (@WHITEBARK_SPIRIT_ENTRY,0,5,0,1,0,100,0,15000,15000,15000,15000,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Whitebark''s Spirit - after 15sec OOC - despawn'); [/sql]

[s]but there are still some problems i wasn’t able to resolve:

  • below 25% it doesn’t say anything;

  • the text said at 25% must be one of the two (random). I don’y know how to do that

  • after the faction change, it should also stop combat, but I have not foud anything to do that

Hope someone can help.

PS: the current EventAI is broken, it doesn’t change faction.[/s]

EDIT: this is now complete and working properly ^^

(@WHITEBARK_SPIRIT_ENTRY,0,2,0,2,0,100,1,0,25,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Whitebark''s Spirit - Say At 25% HP'),

-- Texts DELETE FROM `creature_text` WHERE `entry`=@WHITEBARK_SPIRIT_ENTRY; INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES (@WHITEBARK_SPIRIT_ENTRY,0,0,'What good does this violence serve? What is done is done. I have failed my people.',0,0,100,0,0,0,'Whitebark''s Spirit - 19456'), (@WHITEBARK_SPIRIT_ENTRY,0,1,'Haven''t you done enough harm? Must you also disturb my slumber?',0,0,100,0,0,0,'Whitebark''s Spirit - 19456');[/sql]

I modified the script with your suggestions, but it still doesn’t say anything. I also tried to make it say only the first text, but nothing.

type

Value Localization

12 Say

14 Yell

16 Emote

41 Boss Emote

15 Whisper

42 Boss Whisper

change:

-- Texts DELETE FROM `creature_text` WHERE `entry`=@WHITEBARK_SPIRIT_ENTRY; INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES (@WHITEBARK_SPIRIT_ENTRY,0,0,'What good does this violence serve? What is done is done. I have failed my people.',0,0,100,0,0,0,'Whitebark''s Spirit - 19456'), (@WHITEBARK_SPIRIT_ENTRY,0,1,'Haven''t you done enough harm? Must you also disturb my slumber?',0,0,100,0,0,0,'Whitebark''s Spirit - 19456'); [/sql]

with:

[sql]
– Texts
DELETE FROM creature_text WHERE entry=@WHITEBARK_SPIRIT_ENTRY;
INSERT INTO creature_text (entry,groupid,id,text,type,language,probability,emote,duration,sound,comment) VALUES
(@WHITEBARK_SPIRIT_ENTRY,0,0,‘What good does this violence serve? What is done is done. I have failed my people.’,12,0,100,0,0,0,‘Whitebark’‘s Spirit - 19456’),
(@WHITEBARK_SPIRIT_ENTRY,0,1,‘Haven’‘t you done enough harm? Must you also disturb my slumber?’,12,0,100,0,0,0,‘Whitebark’‘s Spirit - 19456’);

  • the text said at 25% must be one of the two (random). I don’y know how to do that- after the faction change, it should also stop combat, but I have not foud anything to do that

may this solves your problems - but i’m not quite sure

[CODE]
DELETE FROM smart_scripts WHERE entryorguid=@WHITEBARK_SPIRIT_ENTRY;
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
(@WHITEBARK_SPIRIT_ENTRY,0,0,0,0,0,100,0,2500,5500,12000,14500,11,@SPELL_ENTANGLING_ROOTS,0,0,0,0,0,2,0,0,0,0,0,0,0,‘Whitebark’‘s Spirit - Combat - Casts Entangling Roots’),
(@WHITEBARK_SPIRIT_ENTRY,0,1,0,0,0,100,0,5500,5500,9500,16000,11,@SPELL_WITHERED_TOUCH,0,0,0,0,0,2,0,0,0,0,0,0,0,‘Whitebark’‘s Spirit - Combat - Casts Withered Touch’),

(@WHITEBARK_SPIRIT_ENTRY,0,2,0,2,0,100,1,0,25,0,0,87,0,0,0,0,0,0,0,0,0,0,0,0,0,0,‘Whitebark’‘s Spirit - At 25% HP - Say random Text’), – random Text
(@WHITEBARK_SPIRIT_ENTRY,9,1,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,‘Whitebark’‘s Spirit - Say random Text1’),
(@WHITEBARK_SPIRIT_ENTRY,9,2,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,‘Whitebark’‘s Spirit - Say random Text2’),

(@WHITEBARK_SPIRIT_ENTRY,0,3,4,2,0,100,1,0,20,0,0,2,35,0,0,0,0,0,1,0,0,0,0,0,0,0,‘Whitebark’‘s Spirit - At 20% HP - change faction to friendly’),
(@WHITEBARK_SPIRIT_ENTRY,0,4,0,61,0,100,0,0,0,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0,‘Whitebark’‘s Spirit - At 20% HP - evade’); – stop combat
[/sql][/CODE]

I want to thank you all for your help, the script is now complete and it works properly /emoticons/default_smile.png

I edited my first post whit the correct script.

Is the 50% chance right ?

Because the npc might say the two differents texts at once.

maybe there is a missing faction reset to default at the end of your script?!

for example:

(@WHITEBARK_SPIRIT_ENTRY,0,5,0,1,0,100,0,60000,60000,60000,60000,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0,‘Whitebark’‘s Spirit - every 60sec OOC - set faction to default’);

so other players doesn’t find a friendly npc which finishs instantly the quest without fighting against this npc.

EDIT:

source: http://www.wowwiki.com/Quest:Whitebark's_Memory

"If the player does not complete the quest within a few seconds, the spirit will despawn and must be summoned (and fought) again. "

(@WHITEBARK_SPIRIT_ENTRY,0,5,0,1,0,100,0,15000,15000,15000,15000,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Whitebark''s Spirit - after 15sec OOC  - despawn');

maybe better /emoticons/default_smile.png

yours sincerely

No, in the group 0 each text (ids 0 and 1) has a 50% chance to be said, so only one on them will be said (tested and works).

mmm, since the npc must be summoned I think that a forced despawn on completing the quest is more appropriate. I will add that as soon as I can. (I’m a bit busy atm xD)

Thanks for pointing this out /emoticons/default_smile.png Added to the script. It was said also on wowhead but I missed the comments saying that ^^‘’’

It would be nice if a mod could edit the topic’s title by changing [WIP] to [Complete] so the script can be added to the repo. Thanks /emoticons/default_smile.png

EDIT: Thanks Tome /emoticons/default_smile.png