Smart scripts SF: Difference between revisions

From Project Skyfire
Jump to navigation Jump to search
(recategorized)
No edit summary
 
(28 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{| align="right"
{| align="right"
| __TOC__
| __TOC__
|}
|}


{{Back-to:World}}
{{Back-to:World}}


<br><big>'''Smart_Scripts_SF'''</big>


<big>'''The `smart_scripts` table'''</big>
This table controls events for the SmartAI system.


==== Table Structure ====
<br><big>'''Structure'''</big>


{| border="1"
{| border="1"
|-
|-
| '''Field'''  
 
| '''Type'''  
| '''Field'''
| '''Attributes'''  
 
| '''Key'''  
| '''Type'''
| '''Null'''  
 
| '''Default'''  
| '''Attributes'''
| '''Extra'''  
 
| '''Key'''
 
| '''Null'''
 
| '''Default'''
 
| '''Extra'''
 
| '''Comment'''
| '''Comment'''
|-
|-
| [[#entryorguid|entryorguid]]
| [[#entryorguid|entryorguid]]
| int(11)  
 
| signed  
| int(11)
| PRI  
 
| NO  
| signed
| ''None''  
 
| <br>
| PRI
| <br>
 
| NO
 
| ''None''
 
|
 
|
 
|-
|-
| [[#Source_Type|source_type]]  
 
| tinyint(3)  
| [[#source_type|source_type]]
| unsigned  
 
| PRI  
| tinyint(3)
| NO  
 
| 0
| unsigned
|
 
| <br>
| PRI
|-
 
| [[#id|id]]
| NO
| smallint(5)
 
| unsigned
| 0
| PRI
 
| NO
|
| 0  
 
|
|
| <br>
 
|-
| [[#link|link]]
| smallint(5)
| unsigned
| PRI
| NO
| 0
|
| <br>
|-
|-
| [[#Event_types|event_type]]  
 
| tinyint(3)  
| [[#id|id]]
| unsigned  
 
|  
| smallint(5)
| NO  
 
| 0  
| unsigned
|  
 
|  
| PRI
 
| NO
 
| 0
 
|
 
|
 
|-
|-
| [[#event_phase_mask|event_phase_mask]]
 
| tinyint(3)  
| [[#link|link]]
| unsigned  
 
|
| smallint(5)
| NO
 
| 0
| unsigned
|  
 
|
| PRI
|-
 
| [[#event_chance|event_chance]]
| NO
| tinyint(3)
 
| unsigned
| 0
|  
 
| NO
|
| 100
 
|
|
|
 
|-
|-
| [[#Event_flags|event_flags]]  
 
| tinyint(3)  
| [[#event_type|event_type]]
| unsigned  
 
|  
| tinyint(3)
| NO  
 
| 0  
| unsigned
|  
 
|  
|
 
| NO
 
| 0
 
|
 
|
 
|-
|-
| [[#Event_types|event_param1]]  
 
| int(10)  
| [[#event_phase_mask|event_phase_mask]]
| unsigned  
 
|
| tinyint(3)
| NO
 
| 0
| unsigned
|  
 
| <br>
|
|-
 
| [[#Event_types|event_param2]]
| NO
| int(10)
 
| unsigned
| 0
|
 
| NO
|
| 0
 
|
|
|
 
|-
|-
| [[#Event_types|event_param3]]  
 
| int(10)  
| [[#event_chance|event_chance]]
| unsigned  
 
|  
| tinyint(3)
| NO  
 
| 0
| unsigned
|  
 
| <br>
|
 
| NO
 
| 100
 
|
 
|
 
|-
|-
| [[#Event_types|event_param4]]  
 
| int(10)  
| [[#event_flags|event_flags]]
| unsigned  
 
|
| tinyint(3)
| NO
 
| 0
| unsigned
|  
 
|
|
|-
 
| [[#Action_types|action_type]]
| NO
| tinyint(3)
 
| unsigned
| 0
|
 
| NO
|
| 0
 
|  
|
|
 
|-
|-
| [[#Action_types|action_param1]]  
 
| int(10)  
| [[#event_param1-4|event_param1]]
| unsigned  
 
|  
| int(10)
| NO  
 
| 0  
| unsigned
|  
 
|  
|
 
| NO
 
| 0
 
|
 
|
 
|-
|-
| [[#Action_types|action_param2]]  
 
| int(10)  
| [[#event_param1-4|event_param2]]
| unsigned  
 
|
| int(10)
| NO
 
| 0
| unsigned
|  
 
| <br>
|
|-
 
| [[#Action_types|action_param3]]
| NO
| int(10)
 
| unsigned
| 0
|
 
| NO
|
| 0
 
|  
|
|
 
|-
|-
| [[#Action_types|action_param4]]  
 
| int(10)  
| [[#event_param1-4|event_param3]]
| unsigned  
 
|  
| int(10)
| NO  
 
| 0  
| unsigned
|  
 
|  
|
 
| NO
 
| 0
 
|
 
|
 
|-
|-
| [[#Action_types|action_param5]]  
 
| int(10)  
| [[#event_param1-4|event_param4]]
| unsigned  
 
|
| int(10)
| NO
 
| 0
| unsigned
|  
 
|
|
|-
 
| [[#Action_types|action_param6]]
| NO
| int(10)
 
| unsigned
| 0
|
 
| NO
|
| 0
 
|  
|
| <br>
 
|-
|-
| [[#Targets|target_type]]  
 
| tinyint(3)  
| [[#action_type|action_type]]
| unsigned  
 
|  
| tinyint(3)
| NO  
 
| 0  
| unsigned
|  
 
|  
|
 
| NO
 
| 0
 
|
 
|
 
|-
|-
| [[#Targets|target_param1]]
| int(10)
| unsigned
|
| NO
| 0
|
|
|-
| [[#Targets|target_param2]]
| int(10)
| unsigned
|
| NO
| 0
|
|
|-
| [[#Targets|target_param3]]
| int(10)
| unsigned
|
| NO
| 0
|
|
|-
| [[#Targets|target_x]]
| float
| signed
|
| NO
| 0
|
|
|-
| [[#Targets|target_y]]
| float
| signed
|
| NO
| 0
|
|
|-
| [[#Targets|target_z]]
| float
| signed
|
| NO
| 0
|
|
|-
| [[#Targets|target_o]]
| float
| signed
|
| NO
| 0
|
|
|-
| [[#comment|comment]]
| text
| signed
|
| NO
| <br>
|
| Event Comment
|}


<br>
| [[#action_param1-6|action_param1]]
 
| int(10)
 
| unsigned
 
|
 
| NO
 
| 0
 
|


==== Table fields description  ====
|


'''[[#EntryOrGuid|EntryOrGuid:]]'''
|-


*Entryorguid &gt; 0: entry of the creature / game object / etc.
| [[#action_param1-6|action_param2]]
*Entryorguid &lt; 0: guid of the creature / game object / etc.
*Depends on source_type.


'''[[#Source_Type|source_type:]]'''
| int(10)


*Object type: creature, game object, spell.
| unsigned


'''[[#Id|id:]]'''
|


*Incremental id ''bound'' to each entryorguid&amp;source_type (0, 1, 2, ...).
| NO


'''[[#Link|link:]]'''
| 0


*Simple event linking;
|
*Example: if id = 0 and link = 1; id 1 will only be able to occur if id = 0 was triggered.
 
|


'''[[#Event_types|event_type, event_param1, event_param2, event_param3, event_param4:]]'''
|-


*Smart_event to be used.
| [[#action_param1-6|action_param3]]


'''event_phase_mask:'''
| int(10)


*Event will only be able to occur if creature/GO is in this phase;
| unsigned
*0 means all phases (?);
*(Inverse of EAI: event_inverse_phase_mask).


'''event_chance:'''
|


*Probability of the event to occur, in percentage;
| NO
*0-100%.


'''[[#Event_flags|event_flags:]]'''
| 0


*Sets if the event should not repeat or should only happen in a given instance/dungeon difficulty (if applicable);
|
*Values can be added together (bitwise math).


'''[[#Action_types|action_type, action_param1,&nbsp;action_param2, action_param3, action_param4, action_param5, action_param6:]]'''
|


*Action what will be used if event is triggered.
|-


'''[[#Targets|target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o:]]'''
| [[#action_param1-6|action_param4]]


*Defines the target of the event and/or action.
| int(10)


'''comment:'''
| unsigned


*Description of the event-action combo;
|
*Use simple comments however they should not be ambiguous;
*(not used by core).
* Style should be something like this: 'Creature (or Gameobject) name - Cast Spellname'
Read some real scripts for more info.


'''Quick notes:'''
| NO


*Always update ''creature_template'' or ''gameobject_template'' with:
| 0
<pre>UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=y;
UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI' WHERE `entry`=y;
</pre>
*If the creature or GO is inside a dungeon, set ''event_flags'' accordingly to the instance difficulty (heroic, 25 man, etc.).
*In case of doubt about an ''Event'', ''Action ''or ''Target, ''check source code (''src/server/game/AI/SmartScripts'' files; mainly '''SmartScript.cpp'''


<br>
|


==== Source_Type  ====
|


{| width="50%" border="1" cellpadding="1" cellspacing="1"
|-
|-
! scope="col" | Name
 
! scope="col" | Value
| [[#action_param1-6|action_param5]]
! scope="col" | Comment
 
|-
| int(10)
| SMART_SCRIPT_TYPE_CREATURE
 
| 0
| unsigned
| <br>
 
|-
|
| SMART_SCRIPT_TYPE_GAMEOBJECT
 
| 1
| NO
| Partially implemented
 
|-
| 0
| SMART_SCRIPT_TYPE_AREATRIGGER
 
| 2
|
| <br>
 
|-
|
| SMART_SCRIPT_TYPE_EVENT
 
| 3
| Not Yet Implemented<br>
|-
| SMART_SCRIPT_TYPE_GOSSIP
| 4
| Not Yet Implemented
|-
|-
| SMART_SCRIPT_TYPE_QUEST
 
| 5
| [[#action_param1-6|action_param6]]
| Not Yet Implemented
 
| int(10)
 
| unsigned
 
|
 
| NO
 
| 0
 
|
 
|
 
|-
|-
| SMART_SCRIPT_TYPE_SPELL
| 6
| Not Yet Implemented
|-
| SMART_SCRIPT_TYPE_TRANSPORT
| 7
| Not Yet Implemented
|-
| SMART_SCRIPT_TYPE_INSTANCE
| 8
| Not Yet Implemented
|-
| SMART_SCRIPT_TYPE_TIMED_ACTIONLIST
| 9
|
|}


<br>
| [[#target_type|target_type]]
 
| tinyint(3)
 
| unsigned
 
|
 
| NO
 
| 0
 
|


==== Event types  ====
|


{| width="100%" border="1" cellpadding="1" cellspacing="1"
|-
|-
! scope="col" | Name
 
! scope="col" | Value
| [[#target_param1-3|target_param1]]
! scope="col" | Param1
 
! scope="col" | Param2
| int(10)
! scope="col" | Param3
 
! scope="col" | Param4
| unsigned
! scope="col" | Comment
 
|
 
| NO
 
| 0
 
|
 
|
 
|-
|-
| SMART_EVENT_UPDATE_IC
 
| 0
| [[#target_param1-3|target_param2]]
| InitialMin
 
| InitialMax
| int(10)
| RepeatMin
 
| RepeatMax
| unsigned
| In combat.
 
|
 
| NO
 
| 0
 
|
 
|
 
|-
|-
| SMART_EVENT_UPDATE_OOC
 
| 1
| [[#target_param1-3|target_param3]]
| InitialMin
 
| InitialMax
| int(10)
| RepeatMin
 
| RepeatMax
| unsigned
| Out of combat.
 
|-
|
| SMART_EVENT_HEALT_PCT
 
| 2
| NO
| HPMin%
 
| HPMax%
| 0
| RepeatMin
 
| RepeatMax
|
| Health Percentage
 
|-
|
| SMART_EVENT_MANA_PCT
 
| 3
| ManaMin%
| ManaMax%
| RepeatMin
| RepeatMax
| Mana Percentage
|-
|-
| SMART_EVENT_AGGRO
 
| 4
| [[#target_xyzo|target_x]]
|  
 
|  
| float
|  
 
|  
| signed
| On Creature Aggro
 
|
 
| NO
 
| 0
 
|
 
|
 
|-
|-
| SMART_EVENT_KILL
 
| 5
| [[#target_xyzo|target_y]]
| CooldownMin0
 
| CooldownMax1
| float
| playerOnly2
 
| else creature entry3
| signed
| On Creature Kill
 
|-
|
| SMART_EVENT_DEATH
 
| 6
| NO
|
 
|  
| 0
|
 
|  
|
| On Creature Death
 
|
 
|-
|-
| SMART_EVENT_EVADE
 
| 7
| [[#target_xyzo|target_z]]
|  
 
|  
| float
|  
 
|  
| signed
| On Creature Evade Attack
 
|
 
| NO
 
| 0
 
|
 
|
 
|-
|-
| SMART_EVENT_SPELLHIT
 
| 8
| [[#target_xyzo|target_o]]
| SpellID
 
| School
| float
| CooldownMin
 
| CooldownMax
| signed
| On Creature Spell Hit
 
|-
|
| SMART_EVENT_RANGE
 
| 9
| NO
| MinDist
 
| MaxDist
| 0
| RepeatMin
 
| RepeatMax
|
| On Target In Range
 
|-
|
| SMART_EVENT_OOC_LOS
 
| 10
| NoHostile
| MaxRange
| CooldownMin
| CooldownMax
| On Target In Distance Out of Combat
|-
|-
| SMART_EVENT_RESPAWN
 
| 11
| [[#comment|comment]]
| type
 
| MapId
| text
| ZoneId
 
|
| signed
| On Creature Respawn
 
|-
|
| SMART_EVENT_TARGET_HEALTH_PCT
 
| 12
| NO
| HPMin%
 
| HPMax%
|
| RepeatMin
 
| RepeatMax
|
| On Target Health Percentage
 
|-
| Event Comment
| SMART_EVENT_TARGET_CASTING
 
| 13
|}
| RepeatMin
 
| RepeatMax
<br> <big>'''Description of the fields'''</big>
|
 
|
Please note: <b style="color:red">X</b> means that the feature/option is not (yet) implemented.
| On Target Casting Spell
 
|-
==== entryorguid ====
| SMART_EVENT_FRIENDLY_HEALTH
 
| 14
*EntryOrGuid &gt; 0: entry of the creature / game object / etc.
| HPDeficit
 
| Radius
*EntryOrGuid &lt; 0: guid of the creature / game object / etc.
| RepeatMin
 
| RepeatMax
*Depends on source_type.
| On Friendly Health Deficit
 
|-
Example1: Lets say we want all Azure Netherwing Drakes to perform this action... our creature_template entry=23456
| SMART_EVENT_FRIENDLY_IS_CC
  EntryorGuid= 23456
| 15
Example2: Lets say we only want ONE Azure Netherwing Drake to perform this action... his guid=1234
| Radius
  EntryorGuid= -1234
| RepeatMin
 
| RepeatMax
==== source_type ====
|
 
|
*Object type: creature, game object, spell.
|-
 
| SMART_EVENT_FRIENDLY_MISSING_BUFF
==== id ====
| 16
 
| SpellId
*Incremental id ''bound'' to each entryorguid&amp;source_type (0, 1, 2, ...).
| Radius
*Every event for a single creature or gobject needs its own specific id number
| RepeatMin
**EXAMPLE: CreatureX
| RepeatMax
***EVENT 1 would have id= 0
| On Friendly Lost Buff
***EVENT 2 would have id= 1
|-
***EVENT 3 would have id= 2
| SMART_EVENT_SUMMONED_UNIT
***Etc...
| 17
 
| CretureId (0 all)  
==== link ====
| CooldownMin
 
| CooldownMax
*Simple event linking;
|
 
| On Creature Summoned Unit
*Example: if id = 0 and link = 1; id 1 will only be able to occur if id = 0 was triggered.
|-
**NOTE: id 1 must then be event type 61 (SMART_EVENT_LINK)
| SMART_EVENT_TARGET_MANA_PCT
 
| 18
*To set multiple links, each event (in order) must then link the next event
| ManaMin%
Example:
| ManaMax%
Event1-> id=0, link=1
| RepeatMin
Event2-> id=1, link=2 (Cannot Occur unless id=0 was triggered)
| RepeatMax
Event3-> id=2, link=3 (Cannot Occur unless id=1 was triggered)
| On Target Mana Percentage
Event4-> id=3, link=0 (Cannot Occur unless id=2 was triggered)
|-
etc.
| SMART_EVENT_ACCEPTED_QUEST
 
| 19
NOTE: Also, if you have an event linked (SMART_EVENT_LINK), it will follow the "chance" of the prior linked event... NOT the chance set on that specific event.
| QuestID (0 any)
 
|
'''[[#Event_types|event_type, event_param1, event_param2, event_param3, event_param4:]]'''
|
 
|
*Smart_event to be used.
| On Target Accepted Quest
 
|-
==== event_phase_mask ====
| SMART_EVENT_REWARD_QUEST
 
| 20
*Event will only be able to occur if creature/GO is in this phase;
| QuestID (0 any)  
 
|
*0 means all phases;
|
 
|
*All events default in phase 0
| On Target Rewarded Quest
 
|-
*(Inverse of EAI: event_inverse_phase_mask).
| SMART_EVENT_REACHED_HOME
 
| 21
==== event_chance ====
|
 
|
*Probability of the event to occur, in percentage;
|  
 
|
*0-100%.
| On Creature Reached Home
 
|-
'''event_flags'''
| SMART_EVENT_RECEIVE_EMOTE
 
| 22
*Sets if the event should not repeat or should only happen in a given instance/dungeon difficulty (if applicable);
| EmoteId
 
| CooldownMin
*Values can be added together (bitwise math).
| CooldownMax
 
| condition
'''[[#Action_types|action_type, action_param1,&nbsp;action_param2, action_param3, action_param4, action_param5, action_param6:]]'''
| val1,val2,val3 (?)
 
|-
*Action what will be used if event is triggered.
| SMART_EVENT_HAS_AURA
 
| 23
'''[[#Targets|target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o:]]'''
| SpellID
 
| Stacks
*Defines the target of the event and/or action.
| RepeatMin
 
| RepeatMax
==== comment ====
| On Creature Has Aura
 
|-
Commenting on SAI uses a template which is the following: (with an example)
| SMART_EVENT_TARGET_BUFFED
 
| 24
"Creature name - Event - Action"
| SpellID
"Minion of Gurok - On spawn - Set Random Movement"
| Stacks
 
| RepeatMin
'''Quick notes:'''
| RepeatMax
 
| On Target Buffed With Spell
*Always update ''creature_template'',''gameobject_template'' or ''areatrigger_scripts'' with:
|-
 
| SMART_EVENT_RESET
<pre>UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=y;
| 25
 
|
UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI' WHERE `entry`=y;
|
 
|
INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES(y,'SmartTrigger');
|  
 
| After Combat, On Respawn or Spawn
</pre>
 
*If the creature or GO is inside a dungeon, set ''event_flags'' accordingly to the instance difficulty (heroic, 25 man, etc.).
 
*In case of doubt about an ''Event'', ''Action ''or ''Target, ''check source code (''src/server/game/AI/SmartScripts'' files; mainly '''SmartScript.cpp''')
 
<br>
 
==== source_type ====
 
{| width="50%" border="1" cellpadding="1" cellspacing="1"
 
|-
|-
| SMART_EVENT_IC_LOS
 
| 26
! scope="col" | Name
| NoHostile
 
| MaxRange
! scope="col" | Value
| CooldownMin
 
| CooldownMax
| On Target In Distance In Combat
|-
|-
| SMART_EVENT_PASSENGER_BOARDED
 
| 27
| SMART_SCRIPT_TYPE_CREATURE
| CooldownMin
 
| CooldownMax
| 0
|  
 
|
|
|-
|-
| SMART_EVENT_PASSENGER_REMOVED
 
| 28
| SMART_SCRIPT_TYPE_GAMEOBJECT
| CooldownMin
 
| CooldownMax
| 1
|  
 
|
|
|-
|-
| SMART_EVENT_CHARMED
 
| 29
| SMART_SCRIPT_TYPE_AREATRIGGER
|  
 
|
| 2
|  
 
|
| On Creature Charmed
|-
|-
| SMART_EVENT_CHARMED_TARGET
 
| 30
| <b style="color:red">X</b> SMART_SCRIPT_TYPE_EVENT
|  
 
|
| 3
|  
 
|
| On Target Charmed
|-
|-
| SMART_EVENT_SPELLHIT_TARGET
 
| 31
| <b style="color:red">X</b> SMART_SCRIPT_TYPE_GOSSIP
| SpellId
 
| School
| 4
| RepeatMin
 
| RepeatMax
| On Target Spell Hit
|-
|-
| SMART_EVENT_DAMAGED
 
| 32
| <b style="color:red">X</b>  SMART_SCRIPT_TYPE_QUEST
| MinDmg
 
| MaxDmg
| 5
| RepeatMin
 
| RepeatMax
| On Creature Damaged
|-
|-
| SMART_EVENT_DAMAGED_TARGET
 
| 33
| <b style="color:red">X</b>  SMART_SCRIPT_TYPE_SPELL
| MinDmg
 
| MaxDmg
| 6
| RepeatMin
 
| RepeatMax
| On Target Damaged
|-
|-
| SMART_EVENT_MOVEMENTINFORM
 
| 34
| <b style="color:red">X</b>  SMART_SCRIPT_TYPE_TRANSPORT
| MovementType (any)
 
| PointID
| 7
|  
 
|
|
|-
|-
| SMART_EVENT_SUMMON_DESPAWNED
 
| 35
| <b style="color:red">X</b> SMART_SCRIPT_TYPE_INSTANCE
| Entry
 
| CooldownMin
| 8
| CooldownMax
 
|
| On Summoned Unit Despawned
|-
|-
| SMART_EVENT_CORPSE_REMOVED
 
| 36
| SMART_SCRIPT_TYPE_TIMED_ACTIONLIST
|  
 
|
| 9
|
 
|  
|}
| On Creature Corpse Removed
 
<br>
 
==== event_type ====
 
{| width="100%" border="1" cellpadding="1" cellspacing="1"
 
|-
|-
| SMART_EVENT_AI_INIT
 
| 37
! scope="col" | Name
|  
 
|  
! scope="col" | Value
|  
 
|  
! scope="col" | Param1
|  
 
! scope="col" | Param2
 
! scope="col" | Param3
 
! scope="col" | Param4
 
! scope="col" | Comment
 
|-
|-
| SMART_EVENT_DATA_SET
 
| 38
| SMART_EVENT_UPDATE_IC
| Field
 
| Value
| 0
| CooldownMin
 
| CooldownMax
| InitialMin (minimum time to wait before execute)
| On Creature Data Set,  Can be used with  SMART_ACTION_SET_DATA
 
| InitialMax (maximum time to wait before execute)
 
| RepeatMin (When repeating, minimum wait for repeat - If 0, will not repeat)
 
| RepeatMax (When repeating, maximum wait for repeat - If 0, will not repeat)
 
| In combat.
 
|-
|-
| SMART_EVENT_WAYPOINT_START
 
| 39
| SMART_EVENT_UPDATE_OOC
| PointId (0 any)
 
| pathId (0 any)
| 1
|  
 
|  
| InitialMin
| On Creature Waypoint ID Started
 
| InitialMax
 
| RepeatMin
 
| RepeatMax
 
| Out of combat.
 
|-
|-
| SMART_EVENT_WAYPOINT_REACHED
 
| 40
| SMART_EVENT_HEALT_PCT
| PointId (0 any)
 
| pathId (0 any)
| 2
|  
 
|  
| HPMin%
| On Creature Waypoint ID Reached
 
| HPMax%
 
| RepeatMin
 
| RepeatMax
 
| Health Percentage
 
|-
|-
| SMART_EVENT_TRANSPORT_ADDPLAYER
 
| 41
| SMART_EVENT_MANA_PCT
|  
 
|  
| 3
|  
 
|  
| ManaMin%
|  
 
| ManaMax%
 
| RepeatMin
 
| RepeatMax
 
| Mana Percentage
 
|-
|-
| SMART_EVENT_TRANSPORT_ADDCREATURE
 
| 42
| SMART_EVENT_AGGRO
| Entry (0 any)
 
|  
| 4
|  
 
|  
|
|  
 
|
 
|
 
|
 
| On Creature Aggro
 
|-
|-
| SMART_EVENT_TRANSPORT_REMOVE_PLAYER
 
| 43
| SMART_EVENT_KILL
|  
 
|  
| 5
|  
 
|  
| CooldownMin0
|  
 
| CooldownMax1
 
| playerOnly2
 
| else creature entry3
 
| On Creature Kill
 
|-
|-
| SMART_EVENT_TRANSPORT_RELOCATE
 
| 44
| SMART_EVENT_DEATH
| PointId
 
|  
| 6
|
 
|  
|
|
 
|-
|
| SMART_EVENT_INSTANCE_PLAYER_ENTER
 
| 45
|
| Team (0 any)
 
| CooldownMin
|
| CooldownMax
 
|  
| On Creature Death
|
 
|-
|-
| SMART_EVENT_AREATRIGGER_ONTRIGGER
 
| 46
| SMART_EVENT_EVADE
| TriggerId (0 any)
 
|  
| 7
|  
 
|  
|
|  
 
|
 
|
 
|
 
| On Creature Evade Attack
 
|-
|-
| SMART_EVENT_QUEST_ACCEPTED
 
| 47
| SMART_EVENT_SPELLHIT
|  
 
|  
| 8
|  
 
|  
| SpellID
| On Target Quest Accepted
 
| School
 
| CooldownMin
 
| CooldownMax
 
| On Creature/Gameobject Spell Hit
 
|-
|-
| SMART_EVENT_QUEST_OBJ_COPLETETION
 
| 48
| SMART_EVENT_RANGE
|  
 
|  
| 9
|  
 
|  
| MinDist
| On Target Quest Objective Completed
 
| MaxDist
 
| RepeatMin
 
| RepeatMax
 
| On Target In Range
 
|-
|-
| SMART_EVENT_QUEST_COMPLETION
 
| 49
| SMART_EVENT_OOC_LOS
|  
 
|  
| 10
|  
 
|  
| NoHostile
| On Target Quest Completed
 
| MaxRange
 
| CooldownMin
 
| CooldownMax
 
| On Target In Distance Out of Combat
 
|-
|-
| SMART_EVENT_QUEST_REWARDED
 
| 50
| SMART_EVENT_RESPAWN
|  
 
|  
| 11
|  
 
|  
| type
| On Target Quest Rewarded
 
| MapId
 
| ZoneId
 
|
 
| On Creature/Gameobject Respawn
 
|-
|-
| SMART_EVENT_QUEST_FAIL
 
| 51
| SMART_EVENT_TARGET_HEALTH_PCT
|  
 
|  
| 12
|  
 
|  
| HPMin%
| On Target Quest Field
 
| HPMax%
 
| RepeatMin
 
| RepeatMax
 
| On Target Health Percentage
 
|-
|-
| SMART_EVENT_TEXT_OVER
 
| 52
| SMART_EVENT_TARGET_CASTING
| GroupId (from creatue_text)
 
| CreatureId (0 any)
| 13
|
 
|  
| RepeatMin
| On TEXT_OVER Event Triggered After SMART_ACTION_TALK
 
|-
| RepeatMax
| SMART_EVENT_RECEIVE_HEAL
 
| 53
|
| MinHeal
 
| MaxHeal
|
| CooldownMin
 
| CooldownMax
| On Target Casting Spell
| On Creature Received Healing
 
|-
|-
| SMART_EVENT_JUST_SUMMONED
 
| 54
| SMART_EVENT_FRIENDLY_HEALTH
|  
 
|  
| 14
|  
 
|  
| HPDeficit
| On Creature Just spawned
 
| Radius
 
| RepeatMin
 
| RepeatMax
 
| On Friendly Health Deficit
 
|-
|-
| SMART_EVENT_WAYPOINT_PAUSED
 
| 55
| SMART_EVENT_FRIENDLY_IS_CC
| PointId (0 any)
 
| pathID (0 any)
| 15
|  
 
|  
| Radius
| On Creature Paused at Waypoint ID
 
| RepeatMin
 
| RepeatMax
 
|
 
|
 
|-
|-
| SMART_EVENT_WAYPOINT_RESUMED
 
| 56
| SMART_EVENT_FRIENDLY_MISSING_BUFF
| PointId (0 any)
 
| pathID (0 any)
| 16
|  
 
|  
| SpellId
| On Creature Resumed after Waypoint ID
 
| Radius
 
| RepeatMin
 
| RepeatMax
 
| On Friendly Lost Buff
 
|-
|-
| SMART_EVENT_WAYPOINT_STOPPED
 
| 57
| SMART_EVENT_SUMMONED_UNIT
| PointId (0 any)  
 
| pathID (0 any)
| 17
|  
 
|  
| CretureId (0 all)
| On Creature Stopped On Waypoint ID
 
| CooldownMin
 
| CooldownMax
 
|
 
| On Creature/Gameobject Summoned Unit
 
|-
|-
| SMART_EVENT_WAYPOINT_ENDED
 
| 58
| SMART_EVENT_TARGET_MANA_PCT
| PointId (0 any)
 
| pathID (0 any)
| 18
|  
 
|  
| ManaMin%
| On Creature Waypoint Path Ended
 
| ManaMax%
 
| RepeatMin
 
| RepeatMax
 
| On Target Mana Percentage
 
|-
|-
| SMART_EVENT_TIMED_EVENT_TRIGGERED
 
| 59
| SMART_EVENT_ACCEPTED_QUEST
| Id
 
|  
| 19
|  
 
|  
| QuestID (0 any)
|  
 
|
 
|
 
|
 
| On Target Accepted Quest
 
|-
|-
| SMART_EVENT_UPDATE
 
| 60
| SMART_EVENT_REWARD_QUEST
| InitialMin
 
| InitialMax
| 20
| RepeatMin
 
| RepeatMax
| QuestID (0 any)
|  
 
|
 
|
 
|
 
| On Target Rewarded Quest
 
|-
|-
| SMART_EVENT_LINK
| 61
|
|
|
|
| used to link together multiple events
|-
| SMART_EVENT_GOSSIP_SELECT
| 62
| menuID
| actionID
|
|
|
|-
| SMART_EVENT_JUST_CREATED
| 63
|
|
|
|
|
|-
| SMART_EVENT_GOSSIP_HELLO
| 64
|
|
|
|
|
|-
| SMART_EVENT_FOLLOW_COMPLETED
| 65
|
|
|
|
|
|-
| SMART_EVENT_DUMMY_EFFECT
| 66
| spellId
| effectIndex
|
|
|
|}


<br>
| SMART_EVENT_REACHED_HOME
 
| 21
 
|
 
|


==== Action types  ====
|
 
|
 
| On Creature Reached Home


{| width="100%" border="1" cellpadding="1" cellspacing="1"
|-
|-
! scope="col" | Name
 
! scope="col" | Value
| SMART_EVENT_RECEIVE_EMOTE
! scope="col" | Param1
 
! scope="col" | Param2
| 22
! scope="col" | Param3
 
! scope="col" | Param4
| EmoteId
! scope="col" | Param5
 
! scope="col" | Param6
| CooldownMin
! scope="col" | Comment
 
| CooldownMax
 
| condition
 
| val1,val2,val3 (?)
 
|-
|-
| SMART_ACTION_NONE
 
| 0
| SMART_EVENT_HAS_AURA
|  
 
|  
| 23
|  
 
|  
| SpellID
|
 
|  
| Stacks
| Do Nothing
 
| RepeatMin
 
| RepeatMax
 
| On Creature Has Aura
 
|-
|-
| SMART_ACTION_TALK
 
| 1
| SMART_EVENT_TARGET_BUFFED
| [[Creature_text_tc2#group_id|Creature_text.groupid]]
 
| duration to wait before TEXT_OVER event is triggered
| 24
|
 
|  
| SpellID
|
 
|  
| Stacks
| Param2 in Milliseconds.
 
| RepeatMin
 
| RepeatMax
 
| On Target Buffed With Spell
 
|-
|-
| SMART_ACTION_SET_FACTION
 
| 2
| SMART_EVENT_RESET
| [[FactionTemplate.dbc_tc2|FactionID]] (or 0 for default)
 
|  
| 25
|
 
|  
|
|
 
|  
|
|
 
|
 
|
 
| After Combat, On Respawn or Spawn
 
|-
|-
| SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL
 
| 3
| SMART_EVENT_IC_LOS
| [[Creature_template_tc2#entry|Creature_template.entry]](param1)
 
| [[Creature_template_tc2#modelid1-4|Creature_template.modelID]](param2)
| 26
|
 
|  
| NoHostile
|
 
|  
| MaxRange
| Take DisplayID of creature (param1)  OR  Turn to DisplayID (param2)  OR  Both = 0 for Demorph
 
| CooldownMin
 
| CooldownMax
 
| On Target In Distance In Combat
 
|-
|-
| SMART_ACTION_SOUND
 
| 4
| SMART_EVENT_PASSENGER_BOARDED
| SoundId
 
| TextRange
| 27
|  
 
|  
| CooldownMin
|
 
|  
| CooldownMax
| Play Sound
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_PLAY_EMOTE
 
| 5
| SMART_EVENT_PASSENGER_REMOVED
| EmoteId
 
|  
| 28
|  
 
|  
| CooldownMin
|
 
|  
| CooldownMax
| Play Emote
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_FAIL_QUEST
 
| 6
| SMART_EVENT_CHARMED
| [[Quest_template_tc2#entry|QuestID]]
 
|  
| 29
|
 
|  
|
|
 
|  
|
| Fail Quest of Target
 
|
 
|
 
| On Creature Charmed
 
|-
|-
| SMART_ACTION_ADD_QUEST
 
| 7
| SMART_EVENT_CHARMED_TARGET
| [[Quest_template_tc2#entry|QuestID]]
 
|
| 30
|  
 
|
|
|  
 
|
|
| Add Quest to Target
 
|
 
|
 
| On Target Charmed
 
|-
|-
| SMART_ACTION_SET_REACT_STATE
 
| 8
| SMART_EVENT_SPELLHIT_TARGET
| State
 
|  
| 31
|  
 
|  
| SpellId
|
 
|  
| School
| React State. Can be Aggressive, Passive or Defensive.
 
| RepeatMin
 
| RepeatMax
 
| On Target Spell Hit
 
|-
|-
| SMART_ACTION_ACTIVATE_GOBJECT
 
| 9
| SMART_EVENT_DAMAGED
|  
 
|  
| 32
|  
 
|  
| MinDmg
|
 
|  
| MaxDmg
| Activate Object
 
| RepeatMin
 
| RepeatMax
 
| On Creature Damaged
 
|-
|-
| SMART_ACTION_RANDOM_EMOTE
 
| 10
| SMART_EVENT_DAMAGED_TARGET
| EmoteId1
 
| EmoteId2
| 33
| EmoteId3...
 
|  
| MinDmg
|
 
|  
| MaxDmg
| Play Random Emote
 
| RepeatMin
 
| RepeatMax
 
| On Target Damaged
 
|-
|-
| SMART_ACTION_CAST
 
| 11
| SMART_EVENT_MOVEMENTINFORM
| SpellId
 
| [[#Cast_flags|CastFlags]]
| 34
|
 
|  
| MovementType (any)
|
 
|
| PointID
| Cast Spell ID at Target
 
|-
|
| SMART_ACTION_SUMMON_CREATURE
 
| 12
|
| CreatureID
 
| [[#Summon Types|Summon type]]
|
| duration in ms
 
| StorageID (always 0)
| attackInvoker
|
| Summon Unit
|-
|-
| SMART_ACTION_THREAT_SINGLE_PCT
 
| 13
| SMART_EVENT_SUMMON_DESPAWNED
| Threat%
 
|  
| 35
|  
 
|  
| Entry
|
 
|  
| CooldownMin
| Change Threat Percentage for Single Target
 
| CooldownMax
 
|
 
| On Summoned Unit Despawned
 
|-
|-
| SMART_ACTION_THREAT_ALL_PCT
 
| 14
| SMART_EVENT_CORPSE_REMOVED
| Threat%
 
|  
| 36
|  
 
|  
|
|
 
|  
|
| Change Threat Percentage for All Enemies
 
|
 
|
 
| On Creature Corpse Removed
 
|-
|-
| SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS
 
| 15
| SMART_EVENT_AI_INIT
| [[Quest_template_tc2#entry|QuestID]]
 
|  
| 37
|
 
|  
|
|
 
|  
|
|
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_SEND_CASTCREATUREORGO
 
| 16
| SMART_EVENT_DATA_SET
| [[Quest_template_tc2#entry|QuestID]]
 
| SpellId
| 38
|
 
|  
| Field
|
 
|  
| Value
|
 
| CooldownMin
 
| CooldownMax
 
| On Creature/Gameobject Data Set, Can be used with SMART_ACTION_SET_DATA
 
|-
|-
| SMART_ACTION_SET_EMOTE_STATE
 
| 17
| SMART_EVENT_WAYPOINT_START
| emoteID
 
|  
| 39
|  
 
|  
| PointId (0 any)
|
 
|  
| pathId (0 any)
| Play Emote Continuously
 
|
 
|
 
| On Creature Waypoint ID Started
 
|-
|-
| SMART_ACTION_SET_UNIT_FLAG
 
| 18
| SMART_EVENT_WAYPOINT_REACHED
| [[Creature_template_tc2#unit_flags|Creature_template.unit_flags]] (may be more than one field OR'd together)  
 
| Target
| 40
|
 
|  
| PointId (0 any)
|
 
|  
| pathId (0 any)
| Can set Multi-able flags at once
 
|
 
|
 
| On Creature Waypoint ID Reached (Does not function if creature is running)
 
|-
|-
| SMART_ACTION_REMOVE_UNIT_FLAG
 
| 19
| <b style="color:red">X</b> SMART_EVENT_TRANSPORT_ADDPLAYER
| [[Creature_template_tc2#unit_flags|Creature_template.unit_flags]] (may be more than one field OR'd together)
 
| Target
| 41
|
 
|  
|
|
 
|  
|
| Can Remove Multi-able flags at once
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_AUTO_ATTACK
 
| 20
| <b style="color:red">X</b> SMART_EVENT_TRANSPORT_ADDCREATURE
| AllowAttackState (0 = Stop attack, anything else means continue attacking)  
 
|  
| 42
|  
 
|  
| Entry (0 any)
|
 
|  
|
| Stop or Continue Automatic Attack.
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_ALLOW_COMBAT_MOVEMENT
 
| 21
| <b style="color:red">X</b>SMART_EVENT_TRANSPORT_REMOVE_PLAYER
| AllowCombatMovement (0 = Stop combat based movement, anything else continue attacking)
 
|  
| 43
|  
 
|  
|
|
 
|  
|
| Allow or Disable Combat Movement
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_SET_EVENT_PHASE
 
| 22
| <b style="color:red">X</b> SMART_EVENT_TRANSPORT_RELOCATE
| smart_scripts.event_phase_mask
 
|  
| 44
|  
 
|  
| PointId
|
 
|  
|
|
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_INC_EVENT_PHASE
 
| 23
| <b style="color:red">X</b> SMART_EVENT_INSTANCE_PLAYER_ENTER
| Increment
 
| Decrement
| 45
|  
 
|  
| Team (0 any)
|
 
|  
| CooldownMin
| Set param1 OR param2 (not both). Value 0 has no effect.
 
| CooldownMax
 
|
 
|
 
|-
|-
| SMART_ACTION_EVADE
 
| 24
| SMART_EVENT_AREATRIGGER_ONTRIGGER
|  
 
|  
| 46
|  
 
|  
| TriggerId (0 any)
|
 
|  
|
| Evade Incoming Attack
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_FLEE_FOR_ASSIST
 
| 25
| <b style="color:red">X</b> SMART_EVENT_QUEST_ACCEPTED
|  
 
|  
| 47
|  
 
|  
|
|
 
|  
|
|
 
|
 
|
 
| On Target Quest Accepted (Use event 19 instead)
 
|-
|-
| SMART_ACTION_CALL_GROUPEVENTHAPPENS
 
| 26
| <b style="color:red">X</b> SMART_EVENT_QUEST_OBJ_COPLETETION
| [[Quest_template_tc2#entry|QuestID]]
 
|  
| 48
|
 
|  
|
|
 
|  
|
|
 
|
 
|
 
| On Target Quest Objective Completed
 
|-
|-
| SMART_ACTION_CALL_CASTEDCREATUREORGO
 
| 27
| <b style="color:red">X</b> SMART_EVENT_QUEST_COMPLETION
| [[Creature_template_tc2#entry|Creature_template.entry]]
 
| SpellId
| 49
|
 
|  
|
|
 
|  
|
|
 
|
 
|
 
| On Target Quest Completed
 
|-
|-
| SMART_ACTION_REMOVEAURASFROMSPELL
 
| 28
| <b style="color:red">X</b> SMART_EVENT_QUEST_REWARDED
| Spellid
 
|  
| 50
|  
 
|  
|
|
 
|  
|
|
 
|
 
|
 
| On Target Quest Rewarded (Use event 20 instead)
 
|-
|-
| SMART_ACTION_FOLLOW
 
| 29
| <b style="color:red">X</b> SMART_EVENT_QUEST_FAIL
| Distance
 
| Angle
| 51
| EndCreatureEntry
 
| credit
|
| creditType (0monsterkill, 1event)
 
|
|
| Follow Target
 
|
 
|
 
| On Target Quest Field
 
|-
|-
| SMART_ACTION_RANDOM_PHASE
 
| 30
| SMART_EVENT_TEXT_OVER
| [[Creature_tc2#phaseMask|Creature.phasemask]] 1
 
| [[Creature_tc2#phaseMask|Creature.phasemask]] 2
| 52
| [[Creature_tc2#phaseMask|Creature.phasemask]] 3...
 
|  
| GroupId (from creatue_text)
|
 
|  
| CreatureId (0 any)
|
 
|
 
|
 
| On TEXT_OVER Event Triggered After SMART_ACTION_TALK
 
|-
|-
| SMART_ACTION_RANDOM_PHASE_RANGE
 
| 31
| SMART_EVENT_RECEIVE_HEAL
| [[Creature_tc2#phaseMask|Creature.phasemask]] minimum
 
| [[Creature_tc2#phaseMask|Creature.phasemask]] maximum
| 53
|
 
|  
| MinHeal
|
 
|  
| MaxHeal
|
 
| CooldownMin
 
| CooldownMax
 
| On Creature Received Healing
 
|-
|-
| SMART_ACTION_RESET_GOBJECT
 
| 32
| SMART_EVENT_JUST_SUMMONED
|  
 
|  
| 54
|  
 
|  
|
|
 
|  
|
| Reset Gameobject
 
|
 
|
 
| On Creature Just spawned
 
|-
|-
| SMART_ACTION_CALL_KILLEDMONSTER
 
| 33
| SMART_EVENT_WAYPOINT_PAUSED
| CreatureId
 
|  
| 55
|  
 
|  
| PointId (0 any)
|
 
|  
| pathID (0 any)
|
 
|
 
|
 
| On Creature Paused at Waypoint ID
 
|-
|-
| SMART_ACTION_SET_INST_DATA
 
| 34
| SMART_EVENT_WAYPOINT_RESUMED
| Field
 
| Data
| 56
|  
 
|  
| PointId (0 any)
|
 
|  
| pathID (0 any)
| Set Instance Data
 
|
 
|
 
| On Creature Resumed after Waypoint ID
 
|-
|-
| SMART_ACTION_SET_INST_DATA64
 
| 35
| SMART_EVENT_WAYPOINT_STOPPED
| Field
 
|  
| 57
|  
 
|  
| PointId (0 any)
|
 
|  
| pathID (0 any)
| Set Instance Data uint64
 
|
 
|
 
| On Creature Stopped On Waypoint ID
 
|-
|-
| SMART_ACTION_UPDATE_TEMPLATE
 
| 36
| SMART_EVENT_WAYPOINT_ENDED
| Entry
 
| Team (updates creature_template to given entry)  
| 58
|  
 
|  
| PointId (0 any)
|
 
|  
| pathID (0 any)
|
 
|
 
|
 
| On Creature Waypoint Path Ended (Does not function if creature is running)
 
|-
|-
| SMART_ACTION_DIE
 
| 37
| SMART_EVENT_TIMED_EVENT_TRIGGERED
|  
 
|  
| 59
|  
 
|  
| Id
|
 
|  
|
| Kill Target
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_SET_IN_COMBAT_WITH_ZONE
 
| 38
| SMART_EVENT_UPDATE
|  
 
|  
| 60
|  
 
|  
| InitialMin
|
 
|  
| InitialMax
|
 
| RepeatMin
 
| RepeatMax
 
|
 
|-
|-
| SMART_ACTION_CALL_FOR_HELP
 
| 39
| SMART_EVENT_LINK
| Radius in yards that other creatures must be to acknowledge the cry for help
 
|  
| 61
|  
 
|  
|
|
 
|  
|
|
 
|
 
|
 
| used to link together multiple events
 
|-
|-
| SMART_ACTION_SET_SHEATH
 
| 40
| SMART_EVENT_GOSSIP_SELECT
| Sheath (0-unarmed, 1-melee, 2-ranged)
 
|  
| 62
|  
 
|  
| [[Gossip_menu_option_SF#menu_id|menu_ID]]
|
 
|  
| [[Gossip_menu_option_SF#id|ID]]
|
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_FORCE_DESPAWN
 
| 41
| SMART_EVENT_JUST_CREATED
| timer
 
|
| 63
|
 
|
|
|
| Despawn Target after param1 Milliseconds
|-
| SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL
| 42
| MinHpValue(+pct,-flat)
|  
|
|
|
|
|
|-
| SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL
| 43
| [[Creature_template_tc2#entry|Creature_template.entry]]
| [[Creature_template_tc2#modelid1-4|Creature_template.modelID]]
|
|
|
|
|  
 
| Mount to Creature Entry (param1) OR Mount to Creature Display (param2) Or both = 0 for Unmount
|
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_SET_INGAME_PHASE_MASK
 
| 44
| SMART_EVENT_GOSSIP_HELLO
| [[Creature_tc2#phaseMask|Creature.phasemask]]
 
|  
| 64
|
 
|  
|
|
 
|  
|
|
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_SET_DATA
 
| 45
| SMART_EVENT_FOLLOW_COMPLETED
| Field
 
| Data
| 65
|  
 
|  
|
|
 
|  
|
| Set Data For Target, can be used with  SMART_EVENT_DATA_SET ( CREATURE ONLY - TODO )
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_MOVE_FORWARD
 
| 46
| <b style="color:red">X</b> SMART_EVENT_DUMMY_EFFECT
| Distance in yards
 
|  
| 66
|  
 
|  
| spellId
|  
 
|  
| effectIndex
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_SET_VISIBILITY
 
| 47
| SMART_EVENT_IS_BEHIND_TARGET
| 0/1
 
|  
| 67
|  
 
|  
| CooldownMin
|  
 
|  
| CooldownMax
 
|
 
|
 
|
 
|-
 
| SMART_EVENT_GAME_EVENT_START
 
| 68
 
| [[game_event SF#eventEntry|game_event.eventEntry]]
 
|  
|  
|
|
|
|-
|-
| SMART_ACTION_SET_ACTIVE
 
| 48
| SMART_EVENT_GAME_EVENT_END
|
 
|  
| 69
|
 
|  
| [[game_event SF#eventEntry|game_event.eventEntry]]
|  
 
|
|  
|  
|
|
|
|-
|-
| SMART_ACTION_ATTACK_START
 
| 49
| SMART_EVENT_GO_STATE_CHANGED
|  
 
|  
| 70
|  
 
|  
| State (0 - Active, 1 - Ready, 2 - Active alternative)
|  
 
|  
|
|  
 
|
 
|
 
|
 
|}
 
<br>
 
==== action_type ====
 
{| width="100%" border="1" cellpadding="1" cellspacing="1"
 
|-
|-
| SMART_ACTION_SUMMON_GO
 
| 50
! scope="col" | Name
| [[Gameobject_template_tc2#entry|Gameobject_template.entry]]
 
| DespawnTime in ms
! scope="col" | Value
|  
 
|  
! scope="col" | Param1
|  
 
|  
! scope="col" | Param2
|
 
! scope="col" | Param3
 
! scope="col" | Param4
 
! scope="col" | Param5
 
! scope="col" | Param6
 
! scope="col" | Comment
 
|-
|-
| SMART_ACTION_KILL_UNIT
 
| 51
| SMART_ACTION_NONE
|
 
|  
| 0
|
 
|  
|
|
 
|  
|
|
 
|-
|
| SMART_ACTION_ACTIVATE_TAXI
 
| 52
|
| TaxiID
 
|  
|
|
 
|  
|
|
 
|  
| Do nothing
|
 
|-
|-
| SMART_ACTION_WP_START
 
| 53
| SMART_ACTION_TALK
| run/walk
 
| [[Waypoints_tc2#entry|Waypoints.entry]]
| 1
| canRepeat
 
| [[Quest_template_tc2#entry|Quest_template.entry]]
| [[Creature_text_SF#group_id|Creature_text.groupid]]
| despawntime
 
| reactState
| duration to wait before TEXT_OVER event is triggered
|  
 
|
 
|
 
|
 
|
 
| Param2 in Milliseconds.
 
|-
|-
| SMART_ACTION_WP_PAUSE
 
| 54
| SMART_ACTION_SET_FACTION
| time
 
|  
| 2
|  
 
|  
| [[FactionTemplate.dbc_SF|FactionID]] (or 0 for default)
|  
 
|  
|
|  
 
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_WP_STOP
 
| 55
| SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL
| despawnTime
 
| [[Quest_template_tc2#entry|Quest_template.entry]]
| 3
| fail (0/1)  
 
|  
| [[Creature_template_SF#entry|Creature_template.entry]](param1)
|  
 
|  
| [[Creature_template_SF#modelid1-4|Creature_template.modelID]](param2)
|  
 
|
 
|
 
|
 
|
 
| Take DisplayID of creature (param1) OR Turn to DisplayID (param2) OR Both = 0 for Demorph
 
|-
|-
| SMART_ACTION_ADD_ITEM
 
| 56
| SMART_ACTION_SOUND
| [[Item_template_tc2#entry|Item_template.entry]]
 
| count
| 4
|  
 
|  
| SoundId
|  
 
|  
| TextRange
|
 
|
 
|
 
|
 
|
 
| Play Sound
 
|-
|-
| SMART_ACTION_REMOVE_ITEM
 
| 57
| SMART_ACTION_PLAY_EMOTE
| [[Item_template_tc2#entry|Item_template.entry]]
 
| count
| 5
|
 
|
| [[Emote.dbc_SF#id|EmoteId]]  
|  
 
|
|
|  
 
|-
|
| SMART_ACTION_INSTALL_AI_TEMPLATE
 
| 58
|
| AITemplateID
 
|
|
|  
 
|
|
|
 
|  
| Play Emote
|
 
|-
|-
| SMART_ACTION_SET_RUN
 
| 59
| SMART_ACTION_FAIL_QUEST
| 0/1
 
|
| 6
|  
 
|  
| [[Quest_template_SF#id|QuestID]]
|
 
|  
|
|
 
|-
|
| SMART_ACTION_SET_FLY
 
| 60,
|
| 0/1
 
|  
|
|
 
|  
|
|
 
|  
| Fail Quest of Target
|
 
|-
|-
| SMART_ACTION_SET_SWIMM
 
| 61
| SMART_ACTION_ADD_QUEST
| 0/1
 
|  
| 7
|  
 
|  
| [[Quest_template_SF#id|QuestID]]
|  
 
|  
|
|  
 
|
 
|
 
|
 
|
 
| Add Quest to Target
 
|-
|-
| SMART_ACTION_TELEPORT
 
| 62
| SMART_ACTION_SET_REACT_STATE
| [[Maps.dbc_tc2|MapID]]
 
|  
| 8
|  
 
|  
| [[Smart_scripts_SF#React_States|State]]
|  
 
|  
|
| Use Any SMART_TARGET, and Set  target_x,  target_y, target_z, target_o. (param4,param5,param6,param7)
 
|
 
|
 
|
 
|
 
| React State. Can be Aggressive, Passive or Defensive.
 
|-
|-
| SMART_ACTION_STORE_VARIABLE_DECIMAL
 
| 63
| SMART_ACTION_ACTIVATE_GOBJECT
| varID
 
| number
| 9
|
 
|  
|
|
 
|  
|
|
 
|-
|
| SMART_ACTION_STORE_TARGET_LIST
 
| 64
|
| varID
 
|  
|
|
 
|  
|
|
 
|  
| Activate Object
|
 
|-
|-
| SMART_ACTION_WP_RESUME
 
| 65
| SMART_ACTION_RANDOM_EMOTE
|  
 
|  
| 10
|  
 
|  
| [[Emote.dbc_SF#id|EmoteId1]]
|  
 
|  
| [[Emote.dbc_SF#id|EmoteId2]]
|  
 
| [[Emote.dbc_SF#id|EmoteId3...]]
 
|
 
|
 
|
 
| Play Random Emote
 
|-
|-
| SMART_ACTION_SET_ORIENTATION
 
| 66
| SMART_ACTION_CAST
| 0 = North, West = 1.5, South = 3, East = 4.5
 
|  
| 11
|  
 
|  
| SpellId
|  
 
|  
| [[#Cast_flags|CastFlags]]
|  
 
|
 
|
 
|
 
|
 
| Cast Spell ID at Target
 
|-
|-
| SMART_ACTION_CREATE_TIMED_EVENT
 
| 67
| SMART_ACTION_SUMMON_CREATURE
| id
 
| InitialMin
| 12
| InitialMax
 
| RepeatMin(only if it repeats)
| [[Creature_template_SF#entry|Creature_template.entry]]
| RepeatMax(only if it repeats)
 
| chance
| [[#Summon Types|Summon type]]
|
 
|-
| duration in ms
| SMART_ACTION_PLAYMOVIE
 
| 68
| StorageID (always 0)
| entry
 
|  
| attackInvoker
|
 
|  
|
|
 
|  
| Summon Unit
|
 
|-
|-
| SMART_ACTION_MOVE_TO_POS
 
| 69
| SMART_ACTION_THREAT_SINGLE_PCT
|
 
|
| 13
|
 
|  
| Threat%
|  
 
|  
|
| Use Any SMART_TARGET, and Set  target_x,  target_y, target_z, target_o. (param4,param5,param6,param7)
 
|
 
|
 
|
 
|
 
| Change Threat Percentage for Single Target
 
|-
|-
| SMART_ACTION_RESPAWN_TARGET
 
| 70
| SMART_ACTION_THREAT_ALL_PCT
|  
 
|  
| 14
|  
 
|  
| Threat%
|  
 
|  
|
|  
 
|
 
|
 
|
 
|
 
| Change Threat Percentage for All Enemies
 
|-
|-
| SMART_ACTION_EQUIP
 
| 71
| SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS
| [[Creature_equip_template_tc2#entry|Creature_equip_template.entry]]
 
| Slotmask
| 15
| slot1 (item_template.entry)
 
| Slot2 (item_template.entry)
| [[Quest_template_SF#id|QuestID]]
| Slot3 (item_template.entry)
 
|  
|
| only slots with mask set will be sent to client, bits are 1, 2, 4, leaving mask 0 is defaulted to mask 7 (send all), Slots1-3 are only used if no Param1 is set
 
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_CLOSE_GOSSIP
 
| 72
| SMART_ACTION_SEND_CASTCREATUREORGO
|  
 
|  
| 16
|  
 
|  
| [[Quest_template_SF#id|QuestID]]
|  
 
|  
| SpellId
|  
 
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_TRIGGER_TIMED_EVENT
 
| 73
| SMART_ACTION_SET_EMOTE_STATE
| id(&gt;1)
 
|  
| 17
|  
 
|  
| [[Emote.dbc_SF#id|EmoteId]]
|  
 
|  
|
|  
 
|
 
|
 
|
 
|
 
| Play Emote Continuously
 
|-
|-
| SMART_ACTION_REMOVE_TIMED_EVENT
 
| 74
| SMART_ACTION_SET_UNIT_FLAG
| id(&gt;1)  
 
|  
| 18
|  
 
|  
| [[Creature_template_SF#unit_flags|Creature_template.unit_flags]] (may be more than one field OR'd together)
|  
 
|  
|
|  
 
|
 
|
 
|
 
|
 
| Can set Multi-able flags at once
 
|-
|-
| SMART_ACTION_ADD_AURA
 
| 75
| SMART_ACTION_REMOVE_UNIT_FLAG
| Spellid
 
| targets
| 19
|  
 
|  
| [[Creature_template_SF#unit_flags|Creature_template.unit_flags]] (may be more than one field OR'd together)
|  
 
|  
|
|  
 
|
 
|
 
|
 
|
 
| Can Remove Multi-able flags at once
 
|-
|-
| SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT
 
| 76
| SMART_ACTION_AUTO_ATTACK
|  
 
|  
| 20
|  
 
|  
| AllowAttackState (0 = Stop attack, anything else means continue attacking)
|  
 
|  
|
| WARNING: CAN CRASH CORE, do not use if you dont know what you are doing
 
|
 
|
 
|
 
|
 
| Stop or Continue Automatic Attack.
 
|-
|-
| SMART_ACTION_RESET_SCRIPT_BASE_OBJECT
 
| 77
| SMART_ACTION_ALLOW_COMBAT_MOVEMENT
|  
 
|  
| 21
|  
 
|  
| AllowCombatMovement (0 = Stop combat based movement, anything else continue attacking)
|  
 
|  
|
|  
 
|
 
|
 
|
 
|
 
| Allow or Disable Combat Movement
 
|-
|-
| SMART_ACTION_CALL_SCRIPT_RESET
 
| 78
| SMART_ACTION_SET_EVENT_PHASE
|  
 
|  
| 22
|  
 
|  
| [[Smart_scripts_SF#event_phase_mask|smart_scripts.event_phase_mask]]
|  
 
|  
|
|  
 
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_ENTER_VEHICLE
 
| 79
| SMART_ACTION_INC_EVENT_PHASE
| SeatID
 
|  
| 23
|
 
|  
| Increment
|
 
|  
| Decrement
|
 
|-
|
| SMART_ACTION_CALL_TIMED_ACTIONLIST
 
| 80
|
| ID (overwrites already running actionlist)
 
| Stop after combat (0/1)
|
| timer update type(0-OOC,1-IC,2-ALWAYS)
 
|  
|
|
 
|  
| Set param1 OR param2 (not both). Value 0 has no effect.
|
 
|-
|-
| SMART_ACTION_SET_NPC_FLAG
 
| 81
| SMART_ACTION_EVADE
| [[Creature_template_tc2#npcflag|Creature_template.npcflag]]
 
|  
| 24
|
 
|  
|
|
 
|  
|
|
 
|-
|
| SMART_ACTION_ADD_NPC_FLAG
 
| 82
|
| Add this number to the above flag
 
|  
|
|
 
|  
|
|
 
|  
| Evade Incoming Attack
|
 
|-
|-
| SMART_ACTION_REMOVE_NPC_FLAG
 
| 83
| SMART_ACTION_FLEE_FOR_ASSIST
| Subtract this number from the above flag
 
|  
| 25
|  
 
|  
| 0/1 (If you want the fleeing NPC to say attempts to flee text on flee, use 1 on param1. For no message use 0.)
|  
 
|  
|
|  
 
|
 
|
 
|
 
|
 
| If you want the fleeing NPC to say '%s attempts to run away in fear!' on flee, use 1 on param1. 0 for no message.
 
|-
|-
| SMART_ACTION_SIMPLE_TALK
 
| 84
| SMART_ACTION_CALL_GROUPEVENTHAPPENS
| [[Creature_text_tc2#group_id|Creature_text.groupID]]
 
|  
| 26
|  
 
|  
| [[Quest_template_SF#id|QuestID]]
|  
 
|  
|
| can be used to make players say groupID, Text_over event is not triggered, whisper can not be used (Target units will say the text)
 
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMART_ACTION_INVOKER_CAST
 
| 85
| SMART_ACTION_CALL_CASTEDCREATUREORGO
| SpellID
 
| [[#Cast_flags|castFlags]]
| 27
|
 
|
| [[Creature_template_SF#entry|Creature_template.entry]]
|
 
|  
| SpellId
| if avaliable, last used invoker will cast spellId with castFlags on targets
 
|-
|
| SMART_ACTION_CROSS_CAST
 
| 86
|
| SpellID
 
| [[#Cast_flags|castFlags]]  
|
| CasterTargetType
 
| CasterTarget param1
|
| CasterTarget param2
 
| CasterTarget param3
|
| ( + the original target fields as Destination target), CasterTargets will cast spellID on all Targets (use with caution if targeting multiple * multiple units)
 
|-
| SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST
| 87
| Script9 ids 1-9
|
|  
|
|
|  
|
|-
|-
| SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST
| 88
| Script9 entry of script1
| entry of script2
|
|
|
|
|
|-
| SMART_ACTION_RANDOM_MOVE
| 89
| maxDist
|
|
|
|
|
|


|-
| SMART_ACTION_REMOVEAURASFROMSPELL
| SMART_ACTION_SET_UNIT_FIELD_BYTES_1
 
| 90
| 28
| [[Creature_addon_tc2#bytes1|Value]]
|
|
|
|
|
|  


|-
| Spellid
| SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1
 
| 91
|
| [[Creature_addon_tc2#bytes1|Value]]
 
|
|
|
 
|
|
|
|
|
|-
| SMART_ACTION_INTERRUPT_SPELL
| 92
| withDelay (bool value)
| spellId (uint32 value)
| withInstant (bool value)
|
|
|
| This action allows you to interrupt the current spell being cast. If you do not set the spellId, the core will find the current spell depending on the withDelay and the withInstant values.


|-
|
| SMART_ACTION__GO_CUSTOM_ANIM
| 93
| animprogress (0-255)
|
|
|
|
|
|
|}


<br>
|
<br>


==== Predefined SAI templates  ====
|


{| width="50%" border="1" cellpadding="1" cellspacing="1"
|-
|-
! scope="col" | Description Name
 
! scope="col" | Value (Param1)
| SMART_ACTION_FOLLOW
! scope="col" | Param2
 
! scope="col" | Param3
| 29
! scope="col" | Param4
 
! scope="col" | Param5
| Distance (0 = Default value)
! scope="col" | Param6
 
! scope="col" | Comment
| Angle (0 = Default value)
|-
 
| SMARTAI_TEMPLATE_BASIC
| End [[Creature_template_SF#entry|creature_template.entry]]
| 0  
 
| <br>
| credit
| <br>
 
| <br>
| creditType (0monsterkill, 1event)
| <br>
 
| <br>
|
| <br>
 
|-
| Follow Target
| SMARTAI_TEMPLATE_CASTER
 
| 1
| spellid
| repeatMin
| repeatMax
| range
| manaPCT
| +JOIN: target_param1 as castFlag
|-
| SMARTAI_TEMPLATE_TURRET
| 2
| spellid
| repeatMin
| repeatMax
| range
| manaPCT
| +JOIN: target_param1 as castflag
|-
|-
| SMARTAI_TEMPLATE_PASSIVE
| 3
|
|
|
|
|
|
|-
| SMARTAI_TEMPLATE_CAGED_GO_PART
| 4
| creatureID
| give credit at point end (0/1)
|
|
|
|
|-
| SMARTAI_TEMPLATE_CAGED_NPC_PART
| 5
| gameObjectID
| despawntime
| run (0/1)
| dist
| TextGroupID
|
|}


<br>
| SMART_ACTION_RANDOM_PHASE


==== Targets  ====
| 30
 
| [[Creature_SF#phaseMask|Creature.phasemask]] 1
 
| [[Creature_SF#phaseMask|Creature.phasemask]] 2
 
| [[Creature_SF#phaseMask|Creature.phasemask]] 3...
 
|
 
|
 
|
 
|


{| width="100%" border="1" cellpadding="1" cellspacing="1"
|-
! scope="col" | Name
! scope="col" | Value
! scope="col" | target_param1
! scope="col" | target_param2
! scope="col" | target_param3
! scope="col" | target_x
! scope="col" | target_y
! scope="col" | target_z
! scope="col" | target_o
! scope="col" | Comment
|-
|-
| SMART_TARGET_NONE
 
| 0
| SMART_ACTION_RANDOM_PHASE_RANGE
|
 
|  
| 31
|
 
|  
| [[Creature_SF#phaseMask|Creature.phasemask]] minimum
|  
 
|
| [[Creature_SF#phaseMask|Creature.phasemask]] maximum
|  
 
| None, default to invoker
|
|-
 
| SMART_TARGET_SELF
|
| 1
 
|  
|
|
 
|  
|
|
 
|  
|
|
 
|  
| Self cast
|-
|-
| SMART_TARGET_VICTIM
 
| 2
| SMART_ACTION_RESET_GOBJECT
|  
 
|
| 32
|  
 
|
|
|
 
|  
|
|
 
| Our current target (ie: highest aggro)
|
|-
 
| SMART_TARGET_HOSTILE_SECOND_AGGRO
|
| 3
 
|  
|
|
 
|  
|
|
 
|  
| Reset Gameobject
|
 
|  
| Second highest aggro
|-
|-
| SMART_TARGET_HOSTILE_LAST_AGGRO
 
| 4
| SMART_ACTION_CALL_KILLEDMONSTER
|  
 
|  
| 33
|  
 
|  
| [[Creature_template_SF#entry|Creature_template.entry]]
|  
 
|  
|
|  
 
| Dead last on aggro
|
 
|
 
|
 
|
 
| This is the ID from [[Quest_template_SF#RequiredNpcOrGo|quest_template.RequiredNpcOrGo]]
 
|-
|-
| SMART_TARGET_HOSTILE_RANDOM
 
| 5
| SMART_ACTION_SET_INST_DATA
|  
 
|  
| 34
|  
 
|  
| Field
|  
 
|  
| Data
|  
 
| Just any random target on our threat list
|
 
|
 
|
 
|
 
| Set Instance Data
 
|-
|-
| SMART_TARGET_HOSTILE_RANDOM_NOT_TOP
 
| 6
| SMART_ACTION_SET_INST_DATA64
|  
 
|  
| 35
|  
 
|  
| Field
|  
 
|  
|
|  
 
| Any random target except top threat
|
 
|
 
|
 
|
 
| Set Instance Data uint64
 
|-
|-
| SMART_TARGET_ACTION_INVOKER
 
| 7
| SMART_ACTION_UPDATE_TEMPLATE
|
 
|  
| 36
|
 
|  
| [[Creature_template_SF#entry|Creature_template.entry]]
|  
 
|
| Team (updates creature_template to given entry)
|  
 
| Unit who caused this Event to occur
|
|-
 
| SMART_TARGET_POSITION
|
| 8
 
|  
|
|
 
|  
|
| x
 
| y
|
| z
 
| o
| Use xyz from event params
|-
|-
| SMART_TARGET_CREATURE_RANGE
 
| 9
| SMART_ACTION_DIE
| [[Creature_template_tc2#entry|creatureEntry]] (0 any)
 
| minDist
| 37
| maxDist
 
|  
|
|  
 
|
|
|  
 
|
|
 
|
 
|
 
|
 
| Kill Target
 
|-
|-
| SMART_TARGET_CREATURE_GUID
 
| 10
| SMART_ACTION_SET_IN_COMBAT_WITH_ZONE
| guid
 
| entry
| 38
|  
 
|  
|
|  
 
|  
|
|  
 
|
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMART_TARGET_CREATURE_DISTANCE
 
| 11
| SMART_ACTION_CALL_FOR_HELP
| [[Creature_template_tc2#entry|creatureEntry]] (0 any)
 
| maxDist
| 39
|
 
|  
| Radius in yards that other creatures must be to acknowledge the cry for help
|
 
|  
|
|
 
|  
|
|-
 
| SMART_TARGET_STORED
|
| 12
 
| id
|
|
 
|
|
|  
 
|
|
|  
 
|
| Uses pre-stored target(list)
|-
|-
| SMART_TARGET_GAMEOBJECT_RANGE
 
| 13
| SMART_ACTION_SET_SHEATH
| [[Gameobject_template_tc2#entry|goEntry]] (0 any)  
 
| minDist
| 40
| maxDist
 
|
| Sheath (0-unarmed, 1-melee, 2-ranged)
|  
 
|
|
|  
 
|
|
|-
 
| SMART_TARGET_GAMEOBJECT_GUID
|
| 14
 
| guid
|
| entry
 
|
|
|
 
|
|
|
 
|  
|
|-
|-
| SMART_TARGET_GAMEOBJECT_DISTANCE
 
| 15
| SMART_ACTION_FORCE_DESPAWN
| [[Gameobject_template_tc2#entry|goEntry]] (0 any)
 
| maxDist
| 41
|  
 
|  
| timer
|  
 
|
|
|  
 
|
|
 
|
 
|
 
|
 
| Despawn Target after param1 Milliseconds
 
|-
|-
| SMART_TARGET_INVOKER_PARTY
 
| 16
| SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL
|  
 
|  
| 42
|  
 
|  
| MinHpValue(+pct,-flat)
|  
 
|  
|
|  
 
| Invoker's party members
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMART_TARGET_PLAYER_RANGE
 
| 17
| SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL
| minDist
 
| maxDist
| 43
|  
 
|  
| [[Creature_template_SF#entry|Creature_template.entry]]
|  
 
|  
| [[Creature_template_SF#modelid1-4|Creature_template.modelID]]
|  
 
|
|
 
|
 
|
 
|
 
| Mount to Creature Entry (param1) OR Mount to Creature Display (param2) Or both = 0 for Unmount
 
|-
|-
| SMART_TARGET_PLAYER_DISTANCE
 
| 18
| SMART_ACTION_SET_INGAME_PHASE_MASK
| maxDist
 
|  
| 44
|  
 
|  
| [[Creature_SF#phaseMask|Creature.phasemask]]
|  
 
|  
|
|  
 
|
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMART_TARGET_CLOSEST_CREATURE
 
| 19
| SMART_ACTION_SET_DATA
| [[Creature_template_tc2#entry|creatureEntry]] (0 any)
 
|  
| 45
|  
 
|  
| Field
|  
 
|
| Data
|  
 
|
|
 
|
 
|
 
|
 
| Set Data For Target, can be used with SMART_EVENT_DATA_SET
 
|-
|-
| SMART_TARGET_CLOSEST_GAMEOBJECT
 
| 20
| SMART_ACTION_MOVE_FORWARD
| [[Gameobject_template_tc2#entry|goEntry]] (0 any)
 
|  
| 46
|  
 
|  
| Distance in yards
|  
 
|
|
|  
 
|
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMART_TARGET_CLOSEST_PLAYER
 
| 21
| SMART_ACTION_SET_VISIBILITY
|  
 
|  
| 47
|  
 
|  
| 0/1
|  
 
|  
|
|  
 
|
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMART_TARGET_ACTION_INVOKER_VEHICLE
| 22
|
|
|
|
|
|
|
| Unit's vehicle who caused this Event to occur
|-
| SMART_TARGET_OWNER_OR_SUMMONER
| 23
|
|
|
|
|
|
|
| Unit's owner or summoner
|-
| SMART_TARGET_THREAT_LIST
| 24
|
|
|
|
|
|
|
| All units on creature's threat list
|}


<br>
| SMART_ACTION_SET_ACTIVE
 
| 48


==== Event flags  ====
|
 
|
 
|
 
|
 
|
 
|
 
|


{| width="50%" border="1" cellpadding="1" cellspacing="1"
|-
! scope="col" | Name
! scope="col" | Value
! scope="col" | Comment
|-
|-
| SMART_EVENT_FLAG_NOT_REPEATABLE
| 0x01
| Event can not repeat
|-
| SMART_EVENT_FLAG_DIFFICULTY_0
| 0x02
| Event only occurs in instance difficulty 0
|-
| SMART_EVENT_FLAG_DIFFICULTY_1
| 0x04
| Event only occurs in instance difficulty 1
|-
| SMART_EVENT_FLAG_DIFFICULTY_2
| 0x08
| Event only occurs in instance difficulty 2
|-
| SMART_EVENT_FLAG_DIFFICULTY_3
| 0x10
| Event only occurs in instance difficulty 3
|-
| SMART_EVENT_FLAG_DEBUG_ONLY
| 0x80
| Event only occurs in debug build
|}


<br>
| SMART_ACTION_ATTACK_START
 
| 49
 
|
 
|
 
|
 
|
 
|
 
|


==== Cast flags  ====
|


{| width="50%" border="1" cellpadding="1" cellspacing="1"
|-
|-
! scope="col" | Name
 
! scope="col" | Value
| SMART_ACTION_SUMMON_GO
! scope="col" | Comment
 
| 50
 
| [[Gameobject_template_SF#entry|Gameobject_template.entry]]
 
| DespawnTime in ms
 
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMARTCAST_INTERRUPT_PREVIOUS
 
| 0x01
| SMART_ACTION_KILL_UNIT
| Interrupt any spell casting
 
| 51
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
|-
| SMARTCAST_TRIGGERED
 
| 0x02
| SMART_ACTION_ACTIVATE_TAXI
| Triggered (this makes spell cost zero mana and have no cast time)
 
| 52
 
| TaxiID
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
|-
| CAST_FORCE_CAST
 
| 0x04
| SMART_ACTION_WP_START
| Not Yet Implemented: Forces cast even if creature is out of mana or out of range
 
| 53
 
| walk = 0 run = 1
 
| [[Waypoints_SF#entry|Waypoints.entry]]
 
| canRepeat
 
| [[Quest_template_SF#id|Quest_template.id]]
 
| despawntime
 
| reactState
 
|
 
|-
|-
| CAST_NO_MELEE_IF_OOM
 
| 0x08
| SMART_ACTION_WP_PAUSE
| Not Yet Implemented: Prevents creature from entering melee if out of mana or out of range
 
|-
| 54
| CAST_FORCE_TARGET_SELF
 
| 0x10
| time
| Not Yet Implemented: Forces the target to cast this spell on itself
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_WP_STOP
 
| 55
 
| despawnTime
 
| [[Quest_template_SF#id|Quest_template.id]]
 
| fail (0/1)
 
|
 
|
 
|
 
|
 
|-
|-
| CAST_AURA_NOT_PRESENT
 
| 0x20
| SMART_ACTION_ADD_ITEM
| Not Yet Implemented: Only casts the spell if the target does not have an aura from the spell
 
| 56
 
| [[Item_template_SF#entry|Item_template.entry]]
 
| count
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_REMOVE_ITEM
 
| 57
 
| [[Item_template_SF#entry|Item_template.entry]]
 
| count
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_INSTALL_AI_TEMPLATE
 
| 58
 
| [[Smart_scripts_SF#Predefined_SAI_templates|TemplateID]]
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_SET_RUN
 
| 59
 
| 0 = Off / 1 = On
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_SET_FLY
 
| 60
 
| 0 = Off / 1 = On
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_SET_SWIM
 
| 61
 
| 0 = Off / 1 = On
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_TELEPORT
 
| 62
 
| [[Map.dbc_SF|MapID]]
 
|
 
|
 
|
 
|
 
|
 
| Continue this action with the TARGET_TYPE column. Use any target_type, and use target_x, target_y, target_z, target_o as the coordinates
 
|-
 
| SMART_ACTION_STORE_VARIABLE_DECIMAL
 
| 63
 
| varID
 
| number
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_STORE_TARGET_LIST
 
| 64
 
| varID
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_WP_RESUME
 
| 65
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_SET_ORIENTATION
 
| 66
 
| This depends on whet target script have if SMART_TARGET_SELF than Facing will be set like in HomePosition, When SMART_TARGET_POSITION you need to set target_o. 0 = North, West = 1.5, South = 3, East = 4.5
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_CREATE_TIMED_EVENT
 
| 67
 
| id
 
| InitialMin
 
| InitialMax
 
| RepeatMin(only if it repeats)
 
| RepeatMax(only if it repeats)
 
| chance
 
|
 
|-
 
| SMART_ACTION_PLAYMOVIE
 
| 68
 
| entry
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_MOVE_TO_POS
 
| 69
 
| PointId
 
|
 
|
 
|
 
|
 
|
 
| PointId is called by SMART_EVENT_MOVEMENTINFORM. Continue this action with the TARGET_TYPE column. Use any target_type, and use target_x, target_y, target_z, target_o as the coordinates
 
|-
 
| SMART_ACTION_RESPAWN_TARGET
 
| 70
 
| Respawntime in seconds for gameobjects (only GOs)
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_EQUIP
 
| 71
 
| [[Creature_equip_template_SF#entry|Creature_equip_template.entry]]
 
| Slotmask
 
| slot1 (item_template.entry)
 
| Slot2 (item_template.entry)
 
| Slot3 (item_template.entry)
 
|
 
| only slots with mask set will be sent to client, bits are 1, 2, 4, leaving mask 0 is defaulted to mask 7 (send all), Slots1-3 are only used if no Param1 is set
 
|-
 
| SMART_ACTION_CLOSE_GOSSIP
 
| 72
 
|
 
|
 
|
 
|
 
|
 
|
 
|[[Gossip_menu_option_SF#action_menu_id|gossip_menu_option.action_menu_id]] must be 0, and [[Smart_scripts_SF#target_type|target_type]] must be 7
 
|-
 
| SMART_ACTION_TRIGGER_TIMED_EVENT
 
| 73
 
| id(&gt;1)
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_REMOVE_TIMED_EVENT
 
| 74
 
| id(&gt;1)
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_ADD_AURA
 
| 75
 
| SpellId
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT
 
| 76
 
|
 
|
 
|
 
|
 
|
 
|
 
| WARNING: CAN CRASH CORE, do not use if you dont know what you are doing
 
|-
 
| SMART_ACTION_RESET_SCRIPT_BASE_OBJECT
 
| 77
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_CALL_SCRIPT_RESET
 
| 78
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| None
 
| 79
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_CALL_TIMED_ACTIONLIST
 
| 80
 
| [[Smart_scripts_SF#entryorguid|EntryOrGuid]]
 
| timer update type(0 OOC, 1 IC, 2 ALWAYS)
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_SET_NPC_FLAG
 
| 81
 
| [[Creature_template_SF#npcflag|Creature_template.npcflag]]
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_ADD_NPC_FLAG
 
| 82
 
| [[Creature_template_SF#npcflag|Creature_template.npcflag]]
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_REMOVE_NPC_FLAG
 
| 83
 
| [[Creature_template_SF#npcflag|Creature_template.npcflag]]
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_SIMPLE_TALK
 
| 84
 
| [[Creature_text_SF#group_id|Creature_text.groupID]]
 
|
 
|
 
|
 
|
 
|
 
| Makes a player say text. SMART_EVENT_TEXT_OVER is not triggered and whispers can not be used.
 
|-
 
| SMART_ACTION_INVOKER_CAST
 
| 85
 
| SpellID
 
| [[#Cast_flags|castFlags]]
 
|
 
|
 
|
 
|
 
| if avaliable, last used invoker will cast spellId with castFlags on targets
 
|-
 
| SMART_ACTION_CROSS_CAST
 
| 86
 
| SpellID
 
| [[#Cast_flags|castFlags]]
 
| CasterTargetType
 
| CasterTarget param1
 
| CasterTarget param2
 
| CasterTarget param3
 
|
 
|-
 
| SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST
 
| 87
 
| [[Smart_scripts_SF#entryorguid|EntryOrGuid 1]]
 
| [[Smart_scripts_SF#entryorguid|EntryOrGuid 2]]
 
| [[Smart_scripts_SF#entryorguid|EntryOrGuid 3]]
 
| [[Smart_scripts_SF#entryorguid|EntryOrGuid 4]]
 
| [[Smart_scripts_SF#entryorguid|EntryOrGuid 5]]
 
| [[Smart_scripts_SF#entryorguid|EntryOrGuid 6]]
 
| Will select one entry from the ones provided. 0 is ignored.
 
|-
 
| SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST
 
| 88
 
| [[Smart_scripts_SF#entryorguid|EntryOrGuid 1]]
 
| [[Smart_scripts_SF#entryorguid|EntryOrGuid 2]]
 
|
 
|
 
|
 
|
 
| 0 is ignored.
 
|-
 
| SMART_ACTION_RANDOM_MOVE
 
| 89
 
| Max distance in yards
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_SET_UNIT_FIELD_BYTES_1
 
| 90
 
| [[Creature_addon_SF#bytes1|Value]]
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1
 
| 91
 
| [[Creature_addon_SF#bytes1|Value]]
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_INTERRUPT_SPELL
 
| 92
 
| With delay (0/1)
 
| SpellId
 
| Instant (0/1)
 
|
 
|
 
|
 
| This action allows you to interrupt the current spell being cast. If you do not set the spellId, the core will find the current spell depending on the withDelay and the withInstant values.
 
|-
 
| SMART_ACTION_SEND_GO_CUSTOM_ANIM
 
| 93
 
| animprogress (0-255)
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_SET_DYNAMIC_FLAG
 
| 94
 
| [[Creature_template_SF#dynamicflags|dynamicflag]].
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_ADD_DYNAMIC_FLAG
 
| 95
 
| [[Creature_template_SF#dynamicflags|dynamicflags]]
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_REMOVE_DYNAMIC_FLAG
 
| 96
 
| [[Creature_template_SF#dynamicflags|dynamicflags]]
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_JUMP_TO_POS
 
| 97
 
| Speed XY
 
| Speed Z
 
| Target X
 
| Target Y
 
| Target Z
 
|
 
|
 
|-
 
| SMART_ACTION_SEND_GOSSIP_MENU
 
| 98
 
| [[Gossip_menu_option_SF#menu_id|Gossip_menu_option.menuId]]
 
| [[Gossip_menu_option_SF#npc_text_id|Gossip_menu_option.npc_text_id]]
 
|
 
|
 
|
 
|
 
| Can be used together with 'SMART_EVENT_GOSSIP_HELLO' to set custom gossip.
 
|-
 
| SMART_ACTION_SET_RANDOM_HEALTH
 
| 99
 
| MinPctHealth
 
| MaxPctHealth
 
|
 
|
 
|
 
|
 
| Set current health random percentage between Min/Max (DOES NOT CHANGE MAX HEALTH)
 
|-
 
| SMART_ACTION_GO_SET_LOOT_STATE
 
| 100
 
| LootState (0 - Not ready, 1 - Ready, 2 - Activated, 3 - Just deactivated)
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_SEND_TARGET_TO_TARGET
 
| 101
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_ACTION_SET_MANA
 
| 102
 
| SetManaAmount
 
|
 
|
 
|
 
|
 
|
 
| Set current mana to a specific amount (NOT percentage). If amount given is greater than unit's max mana, will set unit's current mana at full (Will NOT change unit's max mana)
|-
 
| SMART_ACTION_CHARACTER_SAVE
 
| 103
 
|
 
|
 
|
 
|
 
|
 
|
 
| Force Character to save current data to the database (useful in heavily phased areas to prevent player from logging in wrong phase)
 
|-
 
| SMART_ACTION_CHARACTER_BIND
 
| 104
 
|
 
|
 
|
 
|
 
|
 
|
 
| Force Character to update their current hearthstone bind location - This will update bind location to their current coordinates (again, useful in heavily phased areas to prevent player from hearthstoning back into wrong phase)
 
|}
|}


<br>
<br>
 
 
==== React States ====
==== Predefined SAI templates ====
 
 
{| width="55%" border="1" cellpadding="1" cellspacing="1"  
{| width="50%" border="1" cellpadding="1" cellspacing="1"
|-  
 
! scope="col" | Name
|-
! scope="col" | Value
 
! scope="col" | Comment  
! scope="col" | Description Name
|-  
 
| REACT_PASSIVE
! scope="col" | Value (Param1)
| 0
 
| attacks nothing, does not defend (default setting)
! scope="col" | Param2
|-  
 
| REACT_DEFENSIVE
! scope="col" | Param3
| 1
 
| only attacks when attacked  
! scope="col" | Param4
|-  
 
| REACT_AGGRESSIVE  
! scope="col" | Param5
| 2  
 
| will attack if on threat list and in threat radius  
! scope="col" | Param6
|-  
 
|}
! scope="col" | Comment
 
 
 
|-
==== Summon Types ====
 
 
| SMARTAI_TEMPLATE_BASIC
{| width="55%" border="1" cellpadding="1" cellspacing="1"  
 
|-  
| 0
! scope="col" | Name
 
! scope="col" | Value
|
! scope="col" | Comment  
 
|-  
|
| TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
 
| 1
|
| despawns after a specified time OR when the creature disappears  
 
|-  
|
| TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
 
| 2
|
| despawns after a specified time OR when the creature dies  
 
|-  
|
| TEMPSUMMON_TIMED_DESPAWN  
 
| 3  
|-
| despawns after a specified time  
 
|-  
| SMARTAI_TEMPLATE_CASTER
| TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
 
| 4
| 1
| despawns after a specified time after the creature is out of combat
 
|-  
| spellid
| TEMPSUMMON_CORPSE_DESPAWN
 
| 5
| repeatMin
| despawns instantly after death  
 
|-  
| repeatMax
| TEMPSUMMON_CORPSE_TIMED_DESPAWN  
 
| 6  
| range
| despawns after a specified time after death  
 
|-  
| manaPCT
| TEMPSUMMON_DEAD_DESPAWN  
 
| 7  
| +JOIN: target_param1 as castFlag
| despawns when the creature disappears  
 
|-  
|-
| TEMPSUMMON_MANUAL_DESPAWN  
 
| 8  
| SMARTAI_TEMPLATE_TURRET
| despawns when UnSummon() (or Force Despawn action) is called  
 
|-  
| 2
|}
 
 
| spellid
 
 
==== (Event) Phases explained ====
| repeatMin
 
 
 
| repeatMax
When dealing with phases, ''phase IDs'' have to be used.
 
 
| range
There are 7 (6+1) different phases: 1, 2, 3, 4, 5, 6 and the default, 0.
 
 
| manaPCT
 
 
''Example'': the script is in phase 0 by default: if we want it to go to phase 1, we got two choices:
| +JOIN: target_param1 as castflag
 
 
SMART_ACTION_INC_PHASE by 1 or SMART_ACTION_SET_PHASE 1
|-
 
 
 
| SMARTAI_TEMPLATE_PASSIVE
If the script is in phase 0 and want to skip to phase 2:
 
 
| 3
SMART_ACTION_INC_PHASE by 2 or SMART_ACTION_SET_PHASE 2
 
 
|
 
 
If the script is in phase 1 and want to skip to phase 2:
|
 
 
SMART_ACTION_INC_PHASE by 1 or SMART_ACTION_SET_PHASE 2
|
 
 
|
 
|
 
|
 
|-
 
| SMARTAI_TEMPLATE_CAGED_GO_PART
 
| 4
 
| creatureID
 
| give credit at point end (0/1)
 
|
 
|
 
|
 
|
 
|-
 
| SMARTAI_TEMPLATE_CAGED_NPC_PART
 
| 5
 
| gameObjectID
 
| despawntime
 
| run (0/1)
 
| dist
 
| TextGroupID
 
|
 
|}
 
<br>
 
==== target_type ====
 
{| width="100%" border="1" cellpadding="1" cellspacing="1"
 
|-
 
! scope="col" | Name
 
! scope="col" | Value
 
! scope="col" | target_param1
 
! scope="col" | target_param2
 
! scope="col" | target_param3
 
! scope="col" | target_x
 
! scope="col" | target_y
 
! scope="col" | target_z
 
! scope="col" | target_o
 
! scope="col" | Comment
 
|-
 
| SMART_TARGET_NONE
 
| 0
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
| None, default to invoker
 
|-
 
| SMART_TARGET_SELF
 
| 1
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
| Self cast
 
|-
 
| SMART_TARGET_VICTIM
 
| 2
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
| Our current target (ie: highest aggro)
 
|-
 
| SMART_TARGET_HOSTILE_SECOND_AGGRO
 
| 3
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
| Second highest aggro
 
|-
 
| SMART_TARGET_HOSTILE_LAST_AGGRO
 
| 4
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
| Dead last on aggro
 
|-
 
| SMART_TARGET_HOSTILE_RANDOM
 
| 5
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
| Just any random target on our threat list
 
|-
 
| SMART_TARGET_HOSTILE_RANDOM_NOT_TOP
 
| 6
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
| Any random target except top threat
 
|-
 
| SMART_TARGET_ACTION_INVOKER
 
| 7
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
| Unit who caused this Event to occur
 
|-
 
| SMART_TARGET_POSITION
 
| 8
 
|
 
|
 
|
 
| x
 
| y
 
| z
 
| o
 
| Use xyz from event params
 
|-
 
| SMART_TARGET_CREATURE_RANGE
 
| 9
 
| [[Creature_template_SF#entry|creatureEntry]] (0 any)
 
| minDist
 
| maxDist
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_TARGET_CREATURE_GUID
 
| 10
 
| guid
 
| entry
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_TARGET_CREATURE_DISTANCE
 
| 11
 
| [[Creature_template_SF#entry|creatureEntry]] (0 any)
 
| maxDist
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_TARGET_STORED
 
| 12
 
| id
 
|
 
|
 
|
 
|
 
|
 
|
 
| Uses pre-stored target(list)
 
|-
 
| SMART_TARGET_GAMEOBJECT_RANGE
 
| 13
 
| [[Gameobject_template_SF#entry|goEntry]] (0 any)
 
| minDist
 
| maxDist
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_TARGET_GAMEOBJECT_GUID
 
| 14
 
| guid
 
| entry
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_TARGET_GAMEOBJECT_DISTANCE
 
| 15
 
| [[Gameobject_template_SF#entry|goEntry]] (0 any)
 
| maxDist
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_TARGET_INVOKER_PARTY
 
| 16
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
| Invoker's party members
 
|-
 
| SMART_TARGET_PLAYER_RANGE
 
| 17
 
| minDist
 
| maxDist
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_TARGET_PLAYER_DISTANCE
 
| 18
 
| maxDist
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_TARGET_CLOSEST_CREATURE
 
| 19
 
| [[Creature_template_SF#entry|creatureEntry]] (0 any)
 
| maxDist
 
| dead? (0/1)
 
|
 
|
 
|
 
|
 
| param2 = 0 -> 100 yards
 
|-
 
| SMART_TARGET_CLOSEST_GAMEOBJECT
 
| 20
 
| [[Gameobject_template_SF#entry|goEntry]] (0 any)
 
| maxDist
 
|
 
|
 
|
 
|
 
|
 
| param2 = 0 -> 100 yards
 
|-
 
| SMART_TARGET_CLOSEST_PLAYER
 
| 21
 
| maxDist
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
|-
 
| SMART_TARGET_ACTION_INVOKER_VEHICLE
 
| 22
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
| Unit's vehicle who caused this Event to occur
 
|-
 
| SMART_TARGET_OWNER_OR_SUMMONER
 
| 23
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
| Unit's owner or summoner
 
|-
 
| SMART_TARGET_THREAT_LIST
 
| 24
 
|
 
|
 
|
 
|
 
|
 
|
 
|
 
| All units on creature's threat list
 
|}
 
<br>
 
==== event_flags ====
 
{| width="50%" border="1" cellpadding="1" cellspacing="1"
 
|-
 
! scope="col" | Name
 
! colspan="2" | Flag
 
! scope="col" | Comment
 
|-
 
| SMART_EVENT_FLAG_NOT_REPEATABLE
 
| 1
 
| 0x01
 
| Event can not repeat
 
|-
 
| SMART_EVENT_FLAG_DIFFICULTY_0
 
| 2
 
| 0x02
 
| Event only occurs in normal dungeon
 
|-
 
| SMART_EVENT_FLAG_DIFFICULTY_1
 
| 4
 
| 0x04
 
| Event only occurs in heroic dungeon
 
|-
 
| SMART_EVENT_FLAG_DIFFICULTY_2
 
| 8
 
| 0x08
 
| Event only occurs in normal raid
 
|-
 
| SMART_EVENT_FLAG_DIFFICULTY_3
 
| 16
 
| 0x10
 
| Event only occurs in heroic raid
 
|-
 
| SMART_EVENT_FLAG_DEBUG_ONLY
 
| 128
 
| 0x80
 
| Event only occurs in debug build
 
|}
 
<br>
 
==== Cast flags ====
 
{| width="50%" border="1" cellpadding="1" cellspacing="1"
 
|-
 
! scope="col" | Name
 
! colspan="2" | Flag
 
! scope="col" | Comment
 
|-
 
| SMARTCAST_INTERRUPT_PREVIOUS
 
| 1
 
| 0x01
 
| Interrupt any spell casting
 
|-
 
| SMARTCAST_TRIGGERED
 
| 2
 
| 0x02
 
| Triggered (this makes spell cost zero mana and have no cast time)
 
|-
 
| <b style="color:red">X</b> CAST_FORCE_CAST
 
| 4
 
| 0x04
 
| Forces cast even if creature is out of mana or out of range
 
|-
 
| <b style="color:red">X</b> CAST_NO_MELEE_IF_OOM
 
| 8
 
| 0x08
 
| Prevents creature from entering melee if out of mana or out of range
 
|-
 
| <b style="color:red">X</b> CAST_FORCE_TARGET_SELF
 
| 16
 
| 0x10
 
| Forces the target to cast this spell on itself
 
|-
 
| CAST_AURA_NOT_PRESENT
 
| 32
 
| 0x20
 
| Only casts the spell if the target does not have an aura from the spell
 
|}
 
<br>
 
==== React States ====
 
{| width="55%" border="1" cellpadding="1" cellspacing="1"
 
|-
 
! scope="col" | Name
 
! scope="col" | Value
 
! scope="col" | Comment
 
|-
 
| REACT_PASSIVE
 
| 0
 
| Does not defend or attack at all. Does nothing!
 
|-
 
| REACT_DEFENSIVE
 
| 1
 
| Only attacks back when attacked
 
|-
 
| REACT_AGGRESSIVE
 
| 2
 
| Will attack if on threat list and in threat radius (default)
 
|-
 
|}
 
<br>
 
==== Summon Types ====
 
{| width="55%" border="1" cellpadding="1" cellspacing="1"
 
|-
 
! scope="col" | Name
 
! scope="col" | Value
 
! scope="col" | Comment
 
|-
 
| TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
 
| 1
 
| despawns after a specified time OR when the creature disappears
 
|-
 
| TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
 
| 2
 
| despawns after a specified time OR when the creature dies
 
|-
 
| TEMPSUMMON_TIMED_DESPAWN
 
| 3
 
| despawns after a specified time
 
|-
 
| TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
 
| 4
 
| despawns after a specified time after the creature is out of combat
 
|-
 
| TEMPSUMMON_CORPSE_DESPAWN
 
| 5
 
| despawns instantly after death
 
|-
 
| TEMPSUMMON_CORPSE_TIMED_DESPAWN
 
| 6
 
| despawns after a specified time after death
 
|-
 
| TEMPSUMMON_DEAD_DESPAWN
 
| 7
 
| despawns when the creature disappears
 
|-
 
| TEMPSUMMON_MANUAL_DESPAWN
 
| 8
 
| despawns when UnSummon() (or Force Despawn action) is called
 
|-
 
|}
 
<br>
 
==== (Event) Phases explained ====
 
When dealing with phases, ''phase IDs'' have to be used.
 
There are 7 (6+1) different phases: 1, 2, 3, 4, 5, 6 and the default, 0.
 
''Example'': the script is in phase 0 by default: if we want it to go to phase 1, we got two choices:
 
SMART_ACTION_INC_PHASE by 1 or SMART_ACTION_SET_PHASE 1
 
If the script is in phase 0 and want to skip to phase 2:
 
SMART_ACTION_INC_PHASE by 2 or SMART_ACTION_SET_PHASE 2
 
If the script is in phase 1 and want to skip to phase 2:
 
SMART_ACTION_INC_PHASE by 1 or SMART_ACTION_SET_PHASE 2
 
<br>


'''smart_scripts.event_phase_mask''':
'''smart_scripts.event_phase_mask''':
Line 2,433: Line 5,023:
The values in this field are bitmasked values:
The values in this field are bitmasked values:


PHASE_ALWAYS_BIT = 0,


PHASE_ALWAYS_BIT  = 0,
PHASE_1_BIT = 1,
 
PHASE_1_BIT       = 1,
 
PHASE_2_BIT        = 2,


PHASE_3_BIT        = 4,
PHASE_2_BIT = 2,


PHASE_4_BIT        = 8,
PHASE_3_BIT = 4,


PHASE_5_BIT        = 16,
PHASE_4_BIT = 8,


PHASE_6_BIT        = 32
PHASE_5_BIT = 16,


PHASE_6_BIT = 32


''Example'': if we want an event to only be able to occur in phase 1 and phase 4:
''Example'': if we want an event to only be able to occur in phase 1 and phase 4:
Line 2,457: Line 5,045:
phase 4: 8
phase 4: 8


 
[[Category:SkyFire_World_database_tables]]
[[Category: SkyFire World database tables]]
[[Category: English]]

Latest revision as of 13:57, 6 July 2012

Back to world database list of tables.


Smart_Scripts_SF

This table controls events for the SmartAI system.


Structure

Field Type Attributes Key Null Default Extra Comment
entryorguid int(11) signed PRI NO None
source_type tinyint(3) unsigned PRI NO 0
id smallint(5) unsigned PRI NO 0
link smallint(5) unsigned PRI NO 0
event_type tinyint(3) unsigned NO 0
event_phase_mask tinyint(3) unsigned NO 0
event_chance tinyint(3) unsigned NO 100
event_flags tinyint(3) unsigned NO 0
event_param1 int(10) unsigned NO 0
event_param2 int(10) unsigned NO 0
event_param3 int(10) unsigned NO 0
event_param4 int(10) unsigned NO 0
action_type tinyint(3) unsigned NO 0
action_param1 int(10) unsigned NO 0
action_param2 int(10) unsigned NO 0
action_param3 int(10) unsigned NO 0
action_param4 int(10) unsigned NO 0
action_param5 int(10) unsigned NO 0
action_param6 int(10) unsigned NO 0
target_type tinyint(3) unsigned NO 0
target_param1 int(10) unsigned NO 0
target_param2 int(10) unsigned NO 0
target_param3 int(10) unsigned NO 0
target_x float signed NO 0
target_y float signed NO 0
target_z float signed NO 0
target_o float signed NO 0
comment text signed NO Event Comment


Description of the fields

Please note: X means that the feature/option is not (yet) implemented.

entryorguid

  • EntryOrGuid > 0: entry of the creature / game object / etc.
  • EntryOrGuid < 0: guid of the creature / game object / etc.
  • Depends on source_type.
Example1: Lets say we want all Azure Netherwing Drakes to perform this action... our creature_template entry=23456
 EntryorGuid= 23456
Example2: Lets say we only want ONE Azure Netherwing Drake to perform this action... his guid=1234
 EntryorGuid= -1234

source_type

  • Object type: creature, game object, spell.

id

  • Incremental id bound to each entryorguid&source_type (0, 1, 2, ...).
  • Every event for a single creature or gobject needs its own specific id number
    • EXAMPLE: CreatureX
      • EVENT 1 would have id= 0
      • EVENT 2 would have id= 1
      • EVENT 3 would have id= 2
      • Etc...

link

  • Simple event linking;
  • Example: if id = 0 and link = 1; id 1 will only be able to occur if id = 0 was triggered.
    • NOTE: id 1 must then be event type 61 (SMART_EVENT_LINK)
  • To set multiple links, each event (in order) must then link the next event
Example: 
Event1-> id=0, link=1
Event2-> id=1, link=2 (Cannot Occur unless id=0 was triggered)
Event3-> id=2, link=3 (Cannot Occur unless id=1 was triggered)
Event4-> id=3, link=0 (Cannot Occur unless id=2 was triggered) 
etc.

NOTE: Also, if you have an event linked (SMART_EVENT_LINK), it will follow the "chance" of the prior linked event... NOT the chance set on that specific event.

event_type, event_param1, event_param2, event_param3, event_param4:

  • Smart_event to be used.

event_phase_mask

  • Event will only be able to occur if creature/GO is in this phase;
  • 0 means all phases;
  • All events default in phase 0
  • (Inverse of EAI: event_inverse_phase_mask).

event_chance

  • Probability of the event to occur, in percentage;
  • 0-100%.

event_flags

  • Sets if the event should not repeat or should only happen in a given instance/dungeon difficulty (if applicable);
  • Values can be added together (bitwise math).

action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6:

  • Action what will be used if event is triggered.

target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o:

  • Defines the target of the event and/or action.

comment

Commenting on SAI uses a template which is the following: (with an example)

"Creature name - Event - Action"
"Minion of Gurok - On spawn - Set Random Movement"

Quick notes:

  • Always update creature_template,gameobject_template or areatrigger_scripts with:
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=y;

UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI' WHERE `entry`=y;

INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES(y,'SmartTrigger');

  • If the creature or GO is inside a dungeon, set event_flags accordingly to the instance difficulty (heroic, 25 man, etc.).
  • In case of doubt about an Event, Action or Target, check source code (src/server/game/AI/SmartScripts files; mainly SmartScript.cpp)


source_type

Name Value
SMART_SCRIPT_TYPE_CREATURE 0
SMART_SCRIPT_TYPE_GAMEOBJECT 1
SMART_SCRIPT_TYPE_AREATRIGGER 2
X SMART_SCRIPT_TYPE_EVENT 3
X SMART_SCRIPT_TYPE_GOSSIP 4
X SMART_SCRIPT_TYPE_QUEST 5
X SMART_SCRIPT_TYPE_SPELL 6
X SMART_SCRIPT_TYPE_TRANSPORT 7
X SMART_SCRIPT_TYPE_INSTANCE 8
SMART_SCRIPT_TYPE_TIMED_ACTIONLIST 9


event_type

Name Value Param1 Param2 Param3 Param4 Comment
SMART_EVENT_UPDATE_IC 0 InitialMin (minimum time to wait before execute) InitialMax (maximum time to wait before execute) RepeatMin (When repeating, minimum wait for repeat - If 0, will not repeat) RepeatMax (When repeating, maximum wait for repeat - If 0, will not repeat) In combat.
SMART_EVENT_UPDATE_OOC 1 InitialMin InitialMax RepeatMin RepeatMax Out of combat.
SMART_EVENT_HEALT_PCT 2 HPMin% HPMax% RepeatMin RepeatMax Health Percentage
SMART_EVENT_MANA_PCT 3 ManaMin% ManaMax% RepeatMin RepeatMax Mana Percentage
SMART_EVENT_AGGRO 4 On Creature Aggro
SMART_EVENT_KILL 5 CooldownMin0 CooldownMax1 playerOnly2 else creature entry3 On Creature Kill
SMART_EVENT_DEATH 6 On Creature Death
SMART_EVENT_EVADE 7 On Creature Evade Attack
SMART_EVENT_SPELLHIT 8 SpellID School CooldownMin CooldownMax On Creature/Gameobject Spell Hit
SMART_EVENT_RANGE 9 MinDist MaxDist RepeatMin RepeatMax On Target In Range
SMART_EVENT_OOC_LOS 10 NoHostile MaxRange CooldownMin CooldownMax On Target In Distance Out of Combat
SMART_EVENT_RESPAWN 11 type MapId ZoneId On Creature/Gameobject Respawn
SMART_EVENT_TARGET_HEALTH_PCT 12 HPMin% HPMax% RepeatMin RepeatMax On Target Health Percentage
SMART_EVENT_TARGET_CASTING 13 RepeatMin RepeatMax On Target Casting Spell
SMART_EVENT_FRIENDLY_HEALTH 14 HPDeficit Radius RepeatMin RepeatMax On Friendly Health Deficit
SMART_EVENT_FRIENDLY_IS_CC 15 Radius RepeatMin RepeatMax
SMART_EVENT_FRIENDLY_MISSING_BUFF 16 SpellId Radius RepeatMin RepeatMax On Friendly Lost Buff
SMART_EVENT_SUMMONED_UNIT 17 CretureId (0 all) CooldownMin CooldownMax On Creature/Gameobject Summoned Unit
SMART_EVENT_TARGET_MANA_PCT 18 ManaMin% ManaMax% RepeatMin RepeatMax On Target Mana Percentage
SMART_EVENT_ACCEPTED_QUEST 19 QuestID (0 any) On Target Accepted Quest
SMART_EVENT_REWARD_QUEST 20 QuestID (0 any) On Target Rewarded Quest
SMART_EVENT_REACHED_HOME 21 On Creature Reached Home
SMART_EVENT_RECEIVE_EMOTE 22 EmoteId CooldownMin CooldownMax condition val1,val2,val3 (?)
SMART_EVENT_HAS_AURA 23 SpellID Stacks RepeatMin RepeatMax On Creature Has Aura
SMART_EVENT_TARGET_BUFFED 24 SpellID Stacks RepeatMin RepeatMax On Target Buffed With Spell
SMART_EVENT_RESET 25 After Combat, On Respawn or Spawn
SMART_EVENT_IC_LOS 26 NoHostile MaxRange CooldownMin CooldownMax On Target In Distance In Combat
SMART_EVENT_PASSENGER_BOARDED 27 CooldownMin CooldownMax
SMART_EVENT_PASSENGER_REMOVED 28 CooldownMin CooldownMax
SMART_EVENT_CHARMED 29 On Creature Charmed
SMART_EVENT_CHARMED_TARGET 30 On Target Charmed
SMART_EVENT_SPELLHIT_TARGET 31 SpellId School RepeatMin RepeatMax On Target Spell Hit
SMART_EVENT_DAMAGED 32 MinDmg MaxDmg RepeatMin RepeatMax On Creature Damaged
SMART_EVENT_DAMAGED_TARGET 33 MinDmg MaxDmg RepeatMin RepeatMax On Target Damaged
SMART_EVENT_MOVEMENTINFORM 34 MovementType (any) PointID
SMART_EVENT_SUMMON_DESPAWNED 35 Entry CooldownMin CooldownMax On Summoned Unit Despawned
SMART_EVENT_CORPSE_REMOVED 36 On Creature Corpse Removed
SMART_EVENT_AI_INIT 37
SMART_EVENT_DATA_SET 38 Field Value CooldownMin CooldownMax On Creature/Gameobject Data Set, Can be used with SMART_ACTION_SET_DATA
SMART_EVENT_WAYPOINT_START 39 PointId (0 any) pathId (0 any) On Creature Waypoint ID Started
SMART_EVENT_WAYPOINT_REACHED 40 PointId (0 any) pathId (0 any) On Creature Waypoint ID Reached (Does not function if creature is running)
X SMART_EVENT_TRANSPORT_ADDPLAYER 41
X SMART_EVENT_TRANSPORT_ADDCREATURE 42 Entry (0 any)
XSMART_EVENT_TRANSPORT_REMOVE_PLAYER 43
X SMART_EVENT_TRANSPORT_RELOCATE 44 PointId
X SMART_EVENT_INSTANCE_PLAYER_ENTER 45 Team (0 any) CooldownMin CooldownMax
SMART_EVENT_AREATRIGGER_ONTRIGGER 46 TriggerId (0 any)
X SMART_EVENT_QUEST_ACCEPTED 47 On Target Quest Accepted (Use event 19 instead)
X SMART_EVENT_QUEST_OBJ_COPLETETION 48 On Target Quest Objective Completed
X SMART_EVENT_QUEST_COMPLETION 49 On Target Quest Completed
X SMART_EVENT_QUEST_REWARDED 50 On Target Quest Rewarded (Use event 20 instead)
X SMART_EVENT_QUEST_FAIL 51 On Target Quest Field
SMART_EVENT_TEXT_OVER 52 GroupId (from creatue_text) CreatureId (0 any) On TEXT_OVER Event Triggered After SMART_ACTION_TALK
SMART_EVENT_RECEIVE_HEAL 53 MinHeal MaxHeal CooldownMin CooldownMax On Creature Received Healing
SMART_EVENT_JUST_SUMMONED 54 On Creature Just spawned
SMART_EVENT_WAYPOINT_PAUSED 55 PointId (0 any) pathID (0 any) On Creature Paused at Waypoint ID
SMART_EVENT_WAYPOINT_RESUMED 56 PointId (0 any) pathID (0 any) On Creature Resumed after Waypoint ID
SMART_EVENT_WAYPOINT_STOPPED 57 PointId (0 any) pathID (0 any) On Creature Stopped On Waypoint ID
SMART_EVENT_WAYPOINT_ENDED 58 PointId (0 any) pathID (0 any) On Creature Waypoint Path Ended (Does not function if creature is running)
SMART_EVENT_TIMED_EVENT_TRIGGERED 59 Id
SMART_EVENT_UPDATE 60 InitialMin InitialMax RepeatMin RepeatMax
SMART_EVENT_LINK 61 used to link together multiple events
SMART_EVENT_GOSSIP_SELECT 62 menu_ID ID
SMART_EVENT_JUST_CREATED 63
SMART_EVENT_GOSSIP_HELLO 64
SMART_EVENT_FOLLOW_COMPLETED 65
X SMART_EVENT_DUMMY_EFFECT 66 spellId effectIndex
SMART_EVENT_IS_BEHIND_TARGET 67 CooldownMin CooldownMax
SMART_EVENT_GAME_EVENT_START 68 game_event.eventEntry
SMART_EVENT_GAME_EVENT_END 69 game_event.eventEntry
SMART_EVENT_GO_STATE_CHANGED 70 State (0 - Active, 1 - Ready, 2 - Active alternative)


action_type

Name Value Param1 Param2 Param3 Param4 Param5 Param6 Comment
SMART_ACTION_NONE 0 Do nothing
SMART_ACTION_TALK 1 Creature_text.groupid duration to wait before TEXT_OVER event is triggered Param2 in Milliseconds.
SMART_ACTION_SET_FACTION 2 FactionID (or 0 for default)
SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL 3 Creature_template.entry(param1) Creature_template.modelID(param2) Take DisplayID of creature (param1) OR Turn to DisplayID (param2) OR Both = 0 for Demorph
SMART_ACTION_SOUND 4 SoundId TextRange Play Sound
SMART_ACTION_PLAY_EMOTE 5 EmoteId Play Emote
SMART_ACTION_FAIL_QUEST 6 QuestID Fail Quest of Target
SMART_ACTION_ADD_QUEST 7 QuestID Add Quest to Target
SMART_ACTION_SET_REACT_STATE 8 State React State. Can be Aggressive, Passive or Defensive.
SMART_ACTION_ACTIVATE_GOBJECT 9 Activate Object
SMART_ACTION_RANDOM_EMOTE 10 EmoteId1 EmoteId2 EmoteId3... Play Random Emote
SMART_ACTION_CAST 11 SpellId CastFlags Cast Spell ID at Target
SMART_ACTION_SUMMON_CREATURE 12 Creature_template.entry Summon type duration in ms StorageID (always 0) attackInvoker Summon Unit
SMART_ACTION_THREAT_SINGLE_PCT 13 Threat% Change Threat Percentage for Single Target
SMART_ACTION_THREAT_ALL_PCT 14 Threat% Change Threat Percentage for All Enemies
SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS 15 QuestID
SMART_ACTION_SEND_CASTCREATUREORGO 16 QuestID SpellId
SMART_ACTION_SET_EMOTE_STATE 17 EmoteId Play Emote Continuously
SMART_ACTION_SET_UNIT_FLAG 18 Creature_template.unit_flags (may be more than one field OR'd together) Can set Multi-able flags at once
SMART_ACTION_REMOVE_UNIT_FLAG 19 Creature_template.unit_flags (may be more than one field OR'd together) Can Remove Multi-able flags at once
SMART_ACTION_AUTO_ATTACK 20 AllowAttackState (0 = Stop attack, anything else means continue attacking) Stop or Continue Automatic Attack.
SMART_ACTION_ALLOW_COMBAT_MOVEMENT 21 AllowCombatMovement (0 = Stop combat based movement, anything else continue attacking) Allow or Disable Combat Movement
SMART_ACTION_SET_EVENT_PHASE 22 smart_scripts.event_phase_mask
SMART_ACTION_INC_EVENT_PHASE 23 Increment Decrement Set param1 OR param2 (not both). Value 0 has no effect.
SMART_ACTION_EVADE 24 Evade Incoming Attack
SMART_ACTION_FLEE_FOR_ASSIST 25 0/1 (If you want the fleeing NPC to say attempts to flee text on flee, use 1 on param1. For no message use 0.) If you want the fleeing NPC to say '%s attempts to run away in fear!' on flee, use 1 on param1. 0 for no message.
SMART_ACTION_CALL_GROUPEVENTHAPPENS 26 QuestID
SMART_ACTION_CALL_CASTEDCREATUREORGO 27 Creature_template.entry SpellId
SMART_ACTION_REMOVEAURASFROMSPELL 28 Spellid
SMART_ACTION_FOLLOW 29 Distance (0 = Default value) Angle (0 = Default value) End creature_template.entry credit creditType (0monsterkill, 1event) Follow Target
SMART_ACTION_RANDOM_PHASE 30 Creature.phasemask 1 Creature.phasemask 2 Creature.phasemask 3...
SMART_ACTION_RANDOM_PHASE_RANGE 31 Creature.phasemask minimum Creature.phasemask maximum
SMART_ACTION_RESET_GOBJECT 32 Reset Gameobject
SMART_ACTION_CALL_KILLEDMONSTER 33 Creature_template.entry This is the ID from quest_template.RequiredNpcOrGo
SMART_ACTION_SET_INST_DATA 34 Field Data Set Instance Data
SMART_ACTION_SET_INST_DATA64 35 Field Set Instance Data uint64
SMART_ACTION_UPDATE_TEMPLATE 36 Creature_template.entry Team (updates creature_template to given entry)
SMART_ACTION_DIE 37 Kill Target
SMART_ACTION_SET_IN_COMBAT_WITH_ZONE 38
SMART_ACTION_CALL_FOR_HELP 39 Radius in yards that other creatures must be to acknowledge the cry for help
SMART_ACTION_SET_SHEATH 40 Sheath (0-unarmed, 1-melee, 2-ranged)
SMART_ACTION_FORCE_DESPAWN 41 timer Despawn Target after param1 Milliseconds
SMART_ACTION_SET_INVINCIBILITY_HP_LEVEL 42 MinHpValue(+pct,-flat)
SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL 43 Creature_template.entry Creature_template.modelID Mount to Creature Entry (param1) OR Mount to Creature Display (param2) Or both = 0 for Unmount
SMART_ACTION_SET_INGAME_PHASE_MASK 44 Creature.phasemask
SMART_ACTION_SET_DATA 45 Field Data Set Data For Target, can be used with SMART_EVENT_DATA_SET
SMART_ACTION_MOVE_FORWARD 46 Distance in yards
SMART_ACTION_SET_VISIBILITY 47 0/1
SMART_ACTION_SET_ACTIVE 48
SMART_ACTION_ATTACK_START 49
SMART_ACTION_SUMMON_GO 50 Gameobject_template.entry DespawnTime in ms
SMART_ACTION_KILL_UNIT 51
SMART_ACTION_ACTIVATE_TAXI 52 TaxiID
SMART_ACTION_WP_START 53 walk = 0 run = 1 Waypoints.entry canRepeat Quest_template.id despawntime reactState
SMART_ACTION_WP_PAUSE 54 time
SMART_ACTION_WP_STOP 55 despawnTime Quest_template.id fail (0/1)
SMART_ACTION_ADD_ITEM 56 Item_template.entry count
SMART_ACTION_REMOVE_ITEM 57 Item_template.entry count
SMART_ACTION_INSTALL_AI_TEMPLATE 58 TemplateID
SMART_ACTION_SET_RUN 59 0 = Off / 1 = On
SMART_ACTION_SET_FLY 60 0 = Off / 1 = On
SMART_ACTION_SET_SWIM 61 0 = Off / 1 = On
SMART_ACTION_TELEPORT 62 MapID Continue this action with the TARGET_TYPE column. Use any target_type, and use target_x, target_y, target_z, target_o as the coordinates
SMART_ACTION_STORE_VARIABLE_DECIMAL 63 varID number
SMART_ACTION_STORE_TARGET_LIST 64 varID
SMART_ACTION_WP_RESUME 65
SMART_ACTION_SET_ORIENTATION 66 This depends on whet target script have if SMART_TARGET_SELF than Facing will be set like in HomePosition, When SMART_TARGET_POSITION you need to set target_o. 0 = North, West = 1.5, South = 3, East = 4.5
SMART_ACTION_CREATE_TIMED_EVENT 67 id InitialMin InitialMax RepeatMin(only if it repeats) RepeatMax(only if it repeats) chance
SMART_ACTION_PLAYMOVIE 68 entry
SMART_ACTION_MOVE_TO_POS 69 PointId PointId is called by SMART_EVENT_MOVEMENTINFORM. Continue this action with the TARGET_TYPE column. Use any target_type, and use target_x, target_y, target_z, target_o as the coordinates
SMART_ACTION_RESPAWN_TARGET 70 Respawntime in seconds for gameobjects (only GOs)
SMART_ACTION_EQUIP 71 Creature_equip_template.entry Slotmask slot1 (item_template.entry) Slot2 (item_template.entry) Slot3 (item_template.entry) only slots with mask set will be sent to client, bits are 1, 2, 4, leaving mask 0 is defaulted to mask 7 (send all), Slots1-3 are only used if no Param1 is set
SMART_ACTION_CLOSE_GOSSIP 72 gossip_menu_option.action_menu_id must be 0, and target_type must be 7
SMART_ACTION_TRIGGER_TIMED_EVENT 73 id(>1)
SMART_ACTION_REMOVE_TIMED_EVENT 74 id(>1)
SMART_ACTION_ADD_AURA 75 SpellId
SMART_ACTION_OVERRIDE_SCRIPT_BASE_OBJECT 76 WARNING: CAN CRASH CORE, do not use if you dont know what you are doing
SMART_ACTION_RESET_SCRIPT_BASE_OBJECT 77
SMART_ACTION_CALL_SCRIPT_RESET 78
None 79
SMART_ACTION_CALL_TIMED_ACTIONLIST 80 EntryOrGuid timer update type(0 OOC, 1 IC, 2 ALWAYS)
SMART_ACTION_SET_NPC_FLAG 81 Creature_template.npcflag
SMART_ACTION_ADD_NPC_FLAG 82 Creature_template.npcflag
SMART_ACTION_REMOVE_NPC_FLAG 83 Creature_template.npcflag
SMART_ACTION_SIMPLE_TALK 84 Creature_text.groupID Makes a player say text. SMART_EVENT_TEXT_OVER is not triggered and whispers can not be used.
SMART_ACTION_INVOKER_CAST 85 SpellID castFlags if avaliable, last used invoker will cast spellId with castFlags on targets
SMART_ACTION_CROSS_CAST 86 SpellID castFlags CasterTargetType CasterTarget param1 CasterTarget param2 CasterTarget param3
SMART_ACTION_CALL_RANDOM_TIMED_ACTIONLIST 87 EntryOrGuid 1 EntryOrGuid 2 EntryOrGuid 3 EntryOrGuid 4 EntryOrGuid 5 EntryOrGuid 6 Will select one entry from the ones provided. 0 is ignored.
SMART_ACTION_CALL_RANDOM_RANGE_TIMED_ACTIONLIST 88 EntryOrGuid 1 EntryOrGuid 2 0 is ignored.
SMART_ACTION_RANDOM_MOVE 89 Max distance in yards
SMART_ACTION_SET_UNIT_FIELD_BYTES_1 90 Value
SMART_ACTION_REMOVE_UNIT_FIELD_BYTES_1 91 Value
SMART_ACTION_INTERRUPT_SPELL 92 With delay (0/1) SpellId Instant (0/1) This action allows you to interrupt the current spell being cast. If you do not set the spellId, the core will find the current spell depending on the withDelay and the withInstant values.
SMART_ACTION_SEND_GO_CUSTOM_ANIM 93 animprogress (0-255)
SMART_ACTION_SET_DYNAMIC_FLAG 94 dynamicflag.
SMART_ACTION_ADD_DYNAMIC_FLAG 95 dynamicflags
SMART_ACTION_REMOVE_DYNAMIC_FLAG 96 dynamicflags
SMART_ACTION_JUMP_TO_POS 97 Speed XY Speed Z Target X Target Y Target Z
SMART_ACTION_SEND_GOSSIP_MENU 98 Gossip_menu_option.menuId Gossip_menu_option.npc_text_id Can be used together with 'SMART_EVENT_GOSSIP_HELLO' to set custom gossip.
SMART_ACTION_SET_RANDOM_HEALTH 99 MinPctHealth MaxPctHealth Set current health random percentage between Min/Max (DOES NOT CHANGE MAX HEALTH)
SMART_ACTION_GO_SET_LOOT_STATE 100 LootState (0 - Not ready, 1 - Ready, 2 - Activated, 3 - Just deactivated)
SMART_ACTION_SEND_TARGET_TO_TARGET 101
SMART_ACTION_SET_MANA 102 SetManaAmount Set current mana to a specific amount (NOT percentage). If amount given is greater than unit's max mana, will set unit's current mana at full (Will NOT change unit's max mana)
SMART_ACTION_CHARACTER_SAVE 103 Force Character to save current data to the database (useful in heavily phased areas to prevent player from logging in wrong phase)
SMART_ACTION_CHARACTER_BIND 104 Force Character to update their current hearthstone bind location - This will update bind location to their current coordinates (again, useful in heavily phased areas to prevent player from hearthstoning back into wrong phase)


Predefined SAI templates

Description Name Value (Param1) Param2 Param3 Param4 Param5 Param6 Comment
SMARTAI_TEMPLATE_BASIC 0
SMARTAI_TEMPLATE_CASTER 1 spellid repeatMin repeatMax range manaPCT +JOIN: target_param1 as castFlag
SMARTAI_TEMPLATE_TURRET 2 spellid repeatMin repeatMax range manaPCT +JOIN: target_param1 as castflag
SMARTAI_TEMPLATE_PASSIVE 3
SMARTAI_TEMPLATE_CAGED_GO_PART 4 creatureID give credit at point end (0/1)
SMARTAI_TEMPLATE_CAGED_NPC_PART 5 gameObjectID despawntime run (0/1) dist TextGroupID


target_type

Name Value target_param1 target_param2 target_param3 target_x target_y target_z target_o Comment
SMART_TARGET_NONE 0 None, default to invoker
SMART_TARGET_SELF 1 Self cast
SMART_TARGET_VICTIM 2 Our current target (ie: highest aggro)
SMART_TARGET_HOSTILE_SECOND_AGGRO 3 Second highest aggro
SMART_TARGET_HOSTILE_LAST_AGGRO 4 Dead last on aggro
SMART_TARGET_HOSTILE_RANDOM 5 Just any random target on our threat list
SMART_TARGET_HOSTILE_RANDOM_NOT_TOP 6 Any random target except top threat
SMART_TARGET_ACTION_INVOKER 7 Unit who caused this Event to occur
SMART_TARGET_POSITION 8 x y z o Use xyz from event params
SMART_TARGET_CREATURE_RANGE 9 creatureEntry (0 any) minDist maxDist
SMART_TARGET_CREATURE_GUID 10 guid entry
SMART_TARGET_CREATURE_DISTANCE 11 creatureEntry (0 any) maxDist
SMART_TARGET_STORED 12 id Uses pre-stored target(list)
SMART_TARGET_GAMEOBJECT_RANGE 13 goEntry (0 any) minDist maxDist
SMART_TARGET_GAMEOBJECT_GUID 14 guid entry
SMART_TARGET_GAMEOBJECT_DISTANCE 15 goEntry (0 any) maxDist
SMART_TARGET_INVOKER_PARTY 16 Invoker's party members
SMART_TARGET_PLAYER_RANGE 17 minDist maxDist
SMART_TARGET_PLAYER_DISTANCE 18 maxDist
SMART_TARGET_CLOSEST_CREATURE 19 creatureEntry (0 any) maxDist dead? (0/1) param2 = 0 -> 100 yards
SMART_TARGET_CLOSEST_GAMEOBJECT 20 goEntry (0 any) maxDist param2 = 0 -> 100 yards
SMART_TARGET_CLOSEST_PLAYER 21 maxDist
SMART_TARGET_ACTION_INVOKER_VEHICLE 22 Unit's vehicle who caused this Event to occur
SMART_TARGET_OWNER_OR_SUMMONER 23 Unit's owner or summoner
SMART_TARGET_THREAT_LIST 24 All units on creature's threat list


event_flags

Name Flag Comment
SMART_EVENT_FLAG_NOT_REPEATABLE 1 0x01 Event can not repeat
SMART_EVENT_FLAG_DIFFICULTY_0 2 0x02 Event only occurs in normal dungeon
SMART_EVENT_FLAG_DIFFICULTY_1 4 0x04 Event only occurs in heroic dungeon
SMART_EVENT_FLAG_DIFFICULTY_2 8 0x08 Event only occurs in normal raid
SMART_EVENT_FLAG_DIFFICULTY_3 16 0x10 Event only occurs in heroic raid
SMART_EVENT_FLAG_DEBUG_ONLY 128 0x80 Event only occurs in debug build


Cast flags

Name Flag Comment
SMARTCAST_INTERRUPT_PREVIOUS 1 0x01 Interrupt any spell casting
SMARTCAST_TRIGGERED 2 0x02 Triggered (this makes spell cost zero mana and have no cast time)
X CAST_FORCE_CAST 4 0x04 Forces cast even if creature is out of mana or out of range
X CAST_NO_MELEE_IF_OOM 8 0x08 Prevents creature from entering melee if out of mana or out of range
X CAST_FORCE_TARGET_SELF 16 0x10 Forces the target to cast this spell on itself
CAST_AURA_NOT_PRESENT 32 0x20 Only casts the spell if the target does not have an aura from the spell


React States

Name Value Comment
REACT_PASSIVE 0 Does not defend or attack at all. Does nothing!
REACT_DEFENSIVE 1 Only attacks back when attacked
REACT_AGGRESSIVE 2 Will attack if on threat list and in threat radius (default)


Summon Types

Name Value Comment
TEMPSUMMON_TIMED_OR_DEAD_DESPAWN 1 despawns after a specified time OR when the creature disappears
TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN 2 despawns after a specified time OR when the creature dies
TEMPSUMMON_TIMED_DESPAWN 3 despawns after a specified time
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT 4 despawns after a specified time after the creature is out of combat
TEMPSUMMON_CORPSE_DESPAWN 5 despawns instantly after death
TEMPSUMMON_CORPSE_TIMED_DESPAWN 6 despawns after a specified time after death
TEMPSUMMON_DEAD_DESPAWN 7 despawns when the creature disappears
TEMPSUMMON_MANUAL_DESPAWN 8 despawns when UnSummon() (or Force Despawn action) is called


(Event) Phases explained

When dealing with phases, phase IDs have to be used.

There are 7 (6+1) different phases: 1, 2, 3, 4, 5, 6 and the default, 0.

Example: the script is in phase 0 by default: if we want it to go to phase 1, we got two choices:

SMART_ACTION_INC_PHASE by 1 or SMART_ACTION_SET_PHASE 1

If the script is in phase 0 and want to skip to phase 2:

SMART_ACTION_INC_PHASE by 2 or SMART_ACTION_SET_PHASE 2

If the script is in phase 1 and want to skip to phase 2:

SMART_ACTION_INC_PHASE by 1 or SMART_ACTION_SET_PHASE 2


smart_scripts.event_phase_mask:

The values in this field are bitmasked values:

PHASE_ALWAYS_BIT = 0,

PHASE_1_BIT = 1,

PHASE_2_BIT = 2,

PHASE_3_BIT = 4,

PHASE_4_BIT = 8,

PHASE_5_BIT = 16,

PHASE_6_BIT = 32

Example: if we want an event to only be able to occur in phase 1 and phase 4:

event_phase_mask = 1+8 = 9

phase 1: 1

phase 4: 8