Should you want to help out, I would recommend you start with creatures outside instances, as they tend to be a bit simpler in certain ways like what target to choose. Though, very many instance-creatures are simple as well.
You can post your smart_scripts here: http://truewow.org/forum/viewtopic.php?f=66&t=36905. Though, you will have to apply as testers first.
Here is TrinityCore's page on smart scripts: https://trinitycore.atlassian.net/wiki/ ... rt_scripts. I'll cover the basics of smart_scripts, which is more than enough to script 95 % of the creatures mentioned in the TBC Transition Thread.
Identification
These together should always be unique as they together are the primary key for smart_scripts.
- entryorguid - The entry of the creature. Hogger is 448 (http://www.wowhead.com/npc=448/hogger).
- source_type - When scripting creatures, you put 0 here.
- id - Incremental id (0, 1, 2, ... ). You increment it for every event you add.
I would take a look at this list: https://trinitycore.atlassian.net/wiki/ ... event_type
- event_type - What type of event should it be? What should trigger it to happen? Here you have a lot to choose from, but the ones you want to look at are: UPDATE_IC (0), UPDATE_OOC (1), AGGRO (4), RANGE (9) and RESET (25).
- event_param1-4: Each type of event come with different params, so they'll be used differently for each type of event:
- For UPDATE_IC, param 1 is the minimum time and param 2 is the maximum until the event happens for the first time.
- Param 3 and param 4 are the minimum and maximum time for how the event repeats after the event has happened once.
For AGGRO, the params aren't even in use, so you just leave them at 0.
You'll just have to look at link above to figure out what event type you want and what event_params you should provide it.
Action
https://trinitycore.atlassian.net/wiki/ ... ction_type
What should be done? You can make this very advanced, but for most creatures, we just want them to cast a spell.
- action_type - We want to cast a spell, so we just add 11 here.
- action_param1 - What spell should we cast? Spell ID. Hearthstone's spell would be 8690: http://www.wowhead.com/spell=8690/hearthstone
https://trinitycore.atlassian.net/wiki/ ... arget_type
Who shall we cast the spell on? Here it's important to make sure you cast on the correct target. It's recommend you try out the spell on the PTR before deciding who should be the target. For instance, AoE spells like Thunder Clap, should be cast on self.
- target_type - Who do we cast on? Most used for open world creatures: self (1), victim (2)
Template
Code: Select all
SET @ENTRY := <NPC ID>;
UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0;
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, EVENT_TYPE, 0, 100, 0, EVENT_PARAM1, EVENT_PARAM2, EVENT_PARAM3, EVENT_PARAM4, 11, SPELL_ID, 0, 0, 0, 0, 0, TARGET_TYPE, 0, 0, 0, 0, 0, 0, 0, "Comment"),
(@ENTRY, 0, 1, 0, EVENT_TYPE, 0, 100, 0, EVENT_PARAM1, EVENT_PARAM2, EVENT_PARAM3, EVENT_PARAM4, 11, SPELL_ID, 0, 0, 0, 0, 0, TARGET_TYPE, 0, 0, 0, 0, 0, 0, 0, "Comment"),
(@ENTRY, 0, 2, 0, EVENT_TYPE, 0, 100, 0, EVENT_PARAM1, EVENT_PARAM2, EVENT_PARAM3, EVENT_PARAM4, 11, SPELL_ID, 0, 0, 0, 0, 0, TARGET_TYPE, 0, 0, 0, 0, 0, 0, 0, "Comment");
Some examples:
The Rock should cast Acid Spit. The in combat (IC) event (0) with the params below will make first cast after 3-5 seconds (1000 miliseconds = 1 second) and have it repeat every 10-12 seconds thereafter. It casts Acid Spit (spell id: 44477) and it casts it on the victim (target_type: 2).
Code: Select all
-- Rock Worm (http://www.wowhead.com/npc=11788/rock-worm#abilities) SAI
SET @ENTRY := 11788;
UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0;
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,3000,5000,10000,12000,11,44477,0,0,0,0,0,2,0,0,0,0,0,0,0,"Rock Worm - IC - Cast Acid Spit");
Shadowshard Rumbler should cast Trample. Trample has a limit range, so we will use the event RANGE (9) with the params that makes it only cast it if someone is within 0-5 yards (param1 & param2) of the Shadowshard Rumbler and it will repeat every 10-12 seconds (param3 & param4). Since it is an AoE abbility, we cast it on ourself (target_type = 1)
Code: Select all
-- Shadowshard Rumbler (http://www.wowhead.com/npc=11777/shadowshard-rumbler#abilities) SAI
SET @ENTRY := 11777;
UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0;
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,9,0,100,0,0,5,10000,12000,11,5568,0,0,0,0,0,1,0,0,0,0,0,0,0,"Shadowshard Rumbler - Range (0-5) - Trample");
The Fallout Slime should have the Disease Cloud aura from when it spawns. The RESET event (event type: 25) happens whenever the creature spawn or reset, so I use it to make it cast Diseases Cloud (spell id: 28156) on itself (target type: 1).
Code: Select all
-- Fallout Slime SAI (Grobbolus)
SET @ENTRY := 16290;
UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0;
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, 25, 0, 100, 1, 0, 0, 0, 0, 11, 28156, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Fallout Slime - Reset- Cast Disease Cloud");
Khan Jehn should cast defensive stance (spell: 72) on aggro (event type: 4) and he should cast it on himself. He does as well have a interrupt in Shield Bash, which is handled on a less used event (Victim casting, 13).
Code: Select all
-- Khan Jehn (http://wotlk.openwow.com/npc=5601 [^]) SAI
SET @ENTRY := 5601;
UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0;
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,4,0,100,0,0,0,0,0,11,7164,0,0,0,0,0,1,0,0,0,0,0,0,0,"Khan Jehn - Agroo - Cast Defensive Stance"),
(@ENTRY,0,1,0,13,0,100,0,12000,18000,0,0,11,72,0,0,0,0,0,2,0,0,0,0,0,0,0,"Khan Jehn - Victim Casting - Cast Shield Bash"),
(@ENTRY,0,2,0,0,0,100,0,0,0,10000,12000,11,8380,0,0,0,0,0,2,0,0,0,0,0,0,0,"Khan Jehn - IC - Cast Sunder Armor");
Whenever the Stonescythe Alpha's health is below 50 (event_type: 2), it should cast Desperate Defense (33896). This is something you can use for healing as well, only let it heal when it's health is below a certain value.
Code: Select all
-- Stonescythe Alpha (http://www.wowhead.com/npc=16929/stonescythe-alpha#abilities [^]) SAI
SET @ENTRY := 16929;
UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0;
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,3000,5000,6000,10000,11,33911,0,0,0,0,0,2,0,0,0,0,0,0,0,"Stonescythe Alpha - IC - Cast Tear Armor"),
(@ENTRY,0,1,0,2,0,100,0,0,50,120000,120000,11,33896,0,0,0,0,0,1,0,0,0,0,0,0,0,"Stonescythe Alpha - Less than 50% HP - Cast Desperate Defense");
Should the creature say something?
If you want the creature to say something, all you have to do is set the action_type to 1 (the one that is 11 for when we cast spells) and action_param1 set to the group in the creature_text we want to use. First off, we need to set up a creature_text for the creature, which is another table.
It has a few interesting attributes: *Primary key made out of bolded.
- entry - The entry of creature, same as per usual.
- group - You have one group for each type of event that triggers it. i.e. one group for when the creature aggro, one group for when a creature dies, one group for when the creature kills someone.
- id - Just an incremental value that should increment for within each group. On aggro, a creature might have two different aggro-messages, so we add one on id = 0 and one on id = 1.
- text - Basically, what the creature will say.
- type - Say (12), Yell (14), Emote (16), Boss Emote (41), Whisper (15), Boss Whisper (42)
- language - Generally kept 0 (universal), but you can choose from this list: https://trinitycore.atlassian.net/wiki/ ... /Languages
- BroadcastTextId - You need to find the text you want the creature to say and add its id. Big file
- Comment - Name of the creature - What should trigger it. i.e. 'Hogger - On Aggro'
Code: Select all
@ENTRY := Creature_entry
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(@ENTRY, GROUP, INCREMENTED_ID, 'Something the creature would say', TYPE, 0, 100, 0, 0, 0, BROADCAST_ID, 0, 'Creature_name - What and how should it trigger'),
(@ENTRY, GROUP, INCREMENTED_ID, 'Something the creature would say', TYPE, 0, 100, 0, 0, 0, BROADCAST_ID, 0, 'Creature_name - What should trigger it');
UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0;
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, EVENT_TYPE, 0, 100, 0, EVENT_PARAM1, EVENT_PARAM2, EVENT_PARAM3, EVENT_PARAM4, 1, GROUP, 0, 0, 0, 0, 0, TARGET_TYPE, 0, 0, 0, 0, 0, 0, 0, "Comment");
Most importantly:
- 1. Make sure the SQL doesn't have any errors. Something as little as replacing ` with ' will make the server not start up again (I've done that in the past. ). Should you use the template, it should however, be quite complicated to make any errors.
2. Make sure you have correct creature ID. Should we end up updating the wrong creature, we will bug out a different creature, which is very bad.