smart_scripts
Manual editing smart_scripts
table can be tedious and difficult, for easier writing scripts you can use additional TrinityCore tools like WoW Database Editor.
Table Structure
Field | Type | Attributes | Key | Null | Default | Extra | Comment |
bigint(20) | signed | PRI | NO | 0 | |||
tinyint(3) | unsigned | PRI | NO | 0 | |||
smallint(5) | unsigned | PRI | NO | 0 | |||
smallint(5) | unsigned | PRI | NO | 0 | |||
tinyint(3) | unsigned | NO | 0 | ||||
tinyint(3) | unsigned | NO | 0 | ||||
tinyint(3) | unsigned | NO | 100 | ||||
tinyint(3) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | 0 | ||||
event_param5 | int(10) | unsigned | NO | 0 | |||
tinyint(3) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | 0 | ||||
tinyint(3) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | 0 | ||||
int(10) | unsigned | NO | NO | ||||
target_param4 | int(10) | unsigned | NO | NO | |||
float | signed | NO | 0 | ||||
float | signed | NO | 0 | ||||
float | signed | NO | 0 | ||||
float | signed | NO | 0 | ||||
text | signed | NO | Event Comment |
Description of the fields
Please note: 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.
source_type
Object type: creature, game object, spell. see table below for values
Name
Value
SMART_SCRIPT_TYPE_CREATURE
0
SMART_SCRIPT_TYPE_GAMEOBJECT
1
SMART_SCRIPT_TYPE_AREATRIGGER
2
SMART_SCRIPT_TYPE_EVENT
3
SMART_SCRIPT_TYPE_GOSSIP
4
SMART_SCRIPT_TYPE_QUEST
5
SMART_SCRIPT_TYPE_SPELL
6
SMART_SCRIPT_TYPE_TRANSPORT
7
SMART_SCRIPT_TYPE_INSTANCE
8
SMART_SCRIPT_TYPE_TIMED_ACTIONLIST
9
SMART_SCRIPT_TYPE_SCENE 10 SMART_SCRIPT_TYPE_AREATRIGGER_ENTITY 11 SMART_SCRIPT_TYPE_AREATRIGGER_ENTITY_SERVERSIDE 12
id
- Incremental id bound to each entryorguid & source_type (0, 1, 2, ...).
link
- Simple event linking;
- Example: if id = 0 and link = 1; id 1 will only be able to occur if id = 0 was triggered.
- Smart_event to be used.
event_phase_mask
When dealing with phases, phase IDs have to be used. There are 10 (9+1) different phases: 1, 2, ... 9 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
Name | Flag | Hex | Comment |
---|---|---|---|
SMART_EVENT_PHASE_ALWAYS_BIT | 0 | 0x000 | Means all phases (1 ... 9) |
SMART_EVENT_PHASE_1 | 1 | 0x001 | Phase 1 only. |
SMART_EVENT_PHASE_2 | 2 | 0x002 | Phase 2 only. |
SMART_EVENT_PHASE_3 | 4 | 0x004 | Phase 3 only. |
SMART_EVENT_PHASE_4 | 8 | 0x008 | Phase 4 only. |
SMART_EVENT_PHASE_5 | 16 | 0x010 | Phase 5 only. |
SMART_EVENT_PHASE_6 | 32 | 0x020 | Phase 6 only. |
SMART_EVENT_PHASE_7 | 64 | 0x040 | Phase 7 only. |
SMART_EVENT_PHASE_8 | 128 | 0x080 | Phase 8 only. |
SMART_EVENT_PHASE_9 | 256 | 0x100 | Phase 9 only. |
- Event will only be able to occur if creature/GO is in this phase.
- Example: If we want an event to only be able to occure in phase 1 and 4, event_phase_mask = 1+8 = 9
- (Inverse of EAI: event_inverse_phase_mask).
event_chance
This is the probability of the event to occur as a percentage from 0-100. So, if you want the event to occur roughly half of the time, then set this to 50.
event_flags
Name | Flag | Hex | 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_RESERVED_5 | 32 | 0x20 | |
SMART_EVENT_FLAG_RESERVED_6 | 64 | 0x40 | |
SMART_EVENT_FLAG_DEBUG_ONLY | 128 | 0x80 | Event only occurs in debug build |
SMART_EVENT_FLAG_DONT_RESET | 256 | 0x100 | Event will not reset in SmartScript::OnReset() |
SMART_EVENT_FLAG_WHILE_CHARMED | 512 | 0x200 | Event can occur while player controlled |
- 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).
event_type
Name | Value | Param1 | Param2 | Param3 | Param4 | Param5 | Comment |
---|---|---|---|---|---|---|---|
SMART_EVENT_UPDATE_IC | 0 | InitialMin | InitialMax | RepeatMin | RepeatMax | In combat. | |
SMART_EVENT_UPDATE_OOC | 1 | InitialMin | InitialMax | RepeatMin | RepeatMax | Out of combat. | |
SMART_EVENT_HEALTH_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 | CooldownMin | CooldownMax | Player only (0/1) | Creature entry (if param3 is 0) | 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 | 0/1 Player Only | On Target In Distance Out of Combat |
SMART_EVENT_RESPAWN | 11 | type (None= 0, Map = 1, Area = 2) | MapId | ZoneId | On Creature/Gameobject Respawn | ||
SMART_EVENT_TARGET_HEALTH_PCT (unused on 3.3.5) | 12 | HPMin% | HPMax% | RepeatMin | RepeatMax | On Target Health Percentage | |
SMART_EVENT_VICTIM_CASTING | 13 | RepeatMin | RepeatMax | Spell id (0 any) | On Target Casting Spell | ||
SMART_EVENT_FRIENDLY_HEALTH (unused on 3.3.5) | 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 (unused on 3.3.5) | 18 | ManaMin% | ManaMax% | RepeatMin | RepeatMax | On Target Mana Percentage | |
SMART_EVENT_ACCEPTED_QUEST | 19 | QuestID (0 any) | RepeatMin | RepeatMax | On Target Accepted Quest | ||
SMART_EVENT_REWARD_QUEST | 20 | QuestID (0 any) | RepeatMin | RepeatMax | On Target Rewarded Quest | ||
SMART_EVENT_REACHED_HOME | 21 | On Creature Reached Home | |||||
SMART_EVENT_RECEIVE_EMOTE | 22 | CooldownMin | CooldownMax | On Receive Emote. | |||
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 | 0/1 Player Only | On Target In Distance In Combat |
SMART_EVENT_PASSENGER_BOARDED | 27 | CooldownMin | CooldownMax | ||||
SMART_EVENT_PASSENGER_REMOVED | 28 | CooldownMin | CooldownMax | ||||
SMART_EVENT_CHARMED | 29 | 0 (on charm apply) / 1 (on charm remove) | 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 (0=any) | PointID | MovementType | |||
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 | |||
SMART_EVENT_TRANSPORT_ADDPLAYER | 41 | ||||||
SMART_EVENT_TRANSPORT_ADDCREATURE | 42 | Entry (0 any) | |||||
SMART_EVENT_TRANSPORT_REMOVE_PLAYER | 43 | ||||||
SMART_EVENT_TRANSPORT_RELOCATE | 44 | PointId | |||||
SMART_EVENT_INSTANCE_PLAYER_ENTER | 45 | Team (0 any) | CooldownMin | CooldownMax | |||
SMART_EVENT_AREATRIGGER_ONTRIGGER | 46 |