-
Notifications
You must be signed in to change notification settings - Fork 47
dbscripts
Back to world database list of tables.
The manual reference for these tables is located in the doc/script_commands.txt file.
This table format is used for different tables to control possible scripts activated by different actions:
-
dbscripts_on_quest_start:
Holds scripts activated when a player accepts a quest.
Source: quest giver (creature); Target: player; Script execution unique by source.
The usage of IDs is as following: Quest Entry
-
dbscripts_on_quest_end:
Holds scripts activated when a player finishes a quest.
Source: quest taker (creature); Target: player; Script execution unique by source.
The usage of IDs is as following: Quest Entry
-
dbscripts_on_creature_movement:
Holds scripts activated while a npc is moving.
Source: moving creature; Target moving creature.
The usage of IDs is as following: Creature Entry * 100 + (1 – 99)
-
dbscripts_on_creature_death:
Holds scripts activated when a creature dies.
Source: killed creature; Target: responsible killer (unit or player).
The usage of IDs is as following: Creature Entry
-
dbscripts_on_gossip:
Holds scripts activated on gossip_menu_option or gossip_menu.- For gossip_menu – Source: player; Target: gossip holder (creature or gameobject); Script execution unique by target.
- For gossip_menu_option when gossip holder is creature – Source: gossip holder (creature); Target: player; Script execution unique by source.
- For gossip_menu_option when gossip holder is gameobject – Source: player; Target: gossip holder (gameobject); Script execution unique by target.
The usage of IDs is as following: gossip_menu / gossip_menu_option * 100 + (1-99)
-
dbscripts_on_spell:
Holds scripts that can be activated by spells with the following spell effects:- SPELL_EFFECT_DUMMY (3)
- SPELL_EFFECT_TRIGGER_SPELL (64) – only for missing triggered spells
- SPELL_EFFECT_SCRIPT_EFFECT (77)
Source: caster; Target: target.
The usage of IDs is as following: Spell Id
-
dbscripts_on_event:
Holds scripts activated whenever an event is activated by spell, gameobject or taxi waypoints.
The following spell effects and gameobjects can activate an event:- SPELL_EFFECT_SEND_EVENT (61)
- GAMEOBJECT_TYPE_CHEST (3)
- GAMEOBJECT_TYPE_GOOBER (10)
- GAMEOBJECT_TYPE_TRANSPORT (11) [not supported yet]
- GAMEOBJECT_TYPE_CAMERA (13)
- GAMEOBJECT_TYPE_MO_TRANSPORT (15) [partially supported]
- GAMEOBJECT_TYPE_FLAGDROP (26) [not supported yet]
- GAMEOBJECT_TYPE_CAPTURE_POINT (29)
- GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING (33)
Source, Target and Script execution can be different based on the event activation source.
The usage of IDs is as following: EffectMiscValueA: EventID
-
dbscripts_on_go_[template]_use:
Holds possible scripts activated by gameobjects.
Source: object user (unit); Target: gameobject.- dbscripts_on_go_template_use can be used for any type of gameobject.
- dbscripts_on_go_use can be used only for GAMEOBJECT_TYPE_DOOR (0) and GAMEOBJECT_TYPE_BUTTON (1)
The usage of IDs is as following: (gameobject.guid) / (gameobject_tempate.entry), always try to use entry if possible
-
dbscript_random_templates
Holds scripts that can be activated by AI or other dbscripts.
The usage of IDs is as following:- Vanilla: 0 – 9999
- TBC: 10000 – 19999
- WoTLK 20000 +
Source and Target are defined by the mechanism that launched it.
-
dbscripts_on_relay:
Holds scripts that can be activated by AI or other dbscripts.
The usage of IDs is as following:- Vanilla: 0 – 9999
- TBC: 10000 – 19999
- WoTLK 20000 +
Source and Target are defined by the mechanism that launched it.
- Other Ways to launch dbscripts
- For creature_ai_scripts – ACTION_T_TEXT_NEW.param3 to launch dbscript_random_templates.type = 0, broadcast_text.id
- For creature_ai_scripts – ACTION_T_START_RELAY_SCRIPT to launch type = 2, dbscripts_on_relay
- For SCRIPT_COMMAND_TALK to launch dbscript_random_templates.type = 0, broadcast_text.id
- For SCRIPT_COMMAND_START_RELAY_SCRIPT to launch type = 2, dbscripts_on_relay
NOTE:
An entry in this table may have more than one row as a script may do more than just one action.
Also each action the script may make can have a separate delay attached to it.
In that case, the core will activate the appropriate action after the correct delay and priority.
Field | Type | Null | Key | Default | Extra |
id | int(8) unsigned | NO | 0 | ||
delay | int(10) unsigned | NO | 0 | ||
priority | int(11) unsigned | NO | 0 | ||
command | mediumint(8) unsigned | NO | 0 | ||
datalong | int(10) unsigned | NO | 0 | ||
datalong2 | int(10) unsigned | NO | 0 | ||
datalong3 | int(11) unsigned | NO | 0 | ||
buddy_entry | int(10) unsigned | NO | 0 | ||
search_radius | int(10) unsigned | NO | 0 | ||
data_flags | int(10) unsigned | NO | 0 | ||
dataint | int(11) | NO | 0 | ||
dataint2 | int(11) | NO | 0 | ||
dataint3 | int(11) | NO | 0 | ||
dataint4 | int(11) | NO | 0 | ||
datafloat | float | NO | 0 | ||
x | float | NO | 0 | ||
y | float | NO | 0 | ||
z | float | NO | 0 | ||
o | float | NO | 0 | ||
speed | float | NO | 0 | ||
condition_id | mediumint(8) unsigned | NO | 0 | condition | |
comments | VARCHAR | NO | NULL |
For dbscripts_on_creature_death, it is the entry of the creature. See creature_template.entry.
For dbscripts_on_creature_movement, it is the script id of the waypoint. (creature entry * 100 + (1 – 99)) e.g: entry = 474 * 100 + (1-99) = 474101 – 474199
- The PROPER formatting for the ID field is as follows: Creature_entry + 2-Digit Script ID (Starting at 01). Example: c.1234 has few movement_scripts, so 1234+01 = 123401 … 123402 ..etc
For dbscripts_on_event, it is the event ID. There doesn’t exist currently a full list of events. In any case, the event IDs are taken directly from gameobject WDB data or spell effect data. If both a gameobject and a spell activate the same event, the IDs will match.
For dbscripts_on_go_template_use, it is the entry of the button/lever. See gameobject_template.entry.
For dbscripts_on_go_use, it is the guid of the button/lever. See gameobject.guid.
For dbscripts_on_gossip, it is the action script id of the gossip option.
- The PROPER formatting for the ID field is as follows: GossipID + 2-Digit Script ID (Starting at 01). Example: c.1234 has few gossip_scripts, so 1234+01 = 123401 … 123402 ..etc
For dbscripts_on_quest_end, it is the ID that is used in CompleteScript in the quest template definition.
For dbscripts_on_quest_start, it is the ID that is used in StartScript in the quest template definition.
For dbscript_random_templates, it is unique ID
- (0-9999 for Classic, 10k-19999 for TBC, 20K+ for WoTLK)
For dbscripts_on_relay, it is unique ID
- (0-9999 for Classic, 10k-19999 for TBC, 20K+ for WoTLK)
For dbscripts_on_spell, it is the Spell ID. See spell_template.Id
Delay in milliseconds before this current step of the script activates. 0 = instant.
NOTE: Delay is Cumulative From Script to Script with same ID.
Example: Script 1 Has 5 seconds (5000ms) delay and then if you want script 2 to trigger 3 seconds (3000ms) later you would use delay value 8000 (5000+3000) for script 2 in the sequence.
priority of the event, lower number higher priority if delay is the same. Used for adjusting execution order of events taking place at the same time
condition which decides if this line is executed.
Description of the executed line, “who does what”.
The type of action performed by the script after delay milliseconds have passed. The value of this field affects what other fields also need to be set.
The following commands can be used (enum ScriptCommand):
Command | Name | Description |
---|---|---|
0 | SCRIPT_COMMAND_TALK | Creature say/whisper/yell/textemote. |
1 | SCRIPT_COMMAND_EMOTE | Plays emote on a player/creature. |
2 | SCRIPT_COMMAND_FIELD_SET | Change the value at an index for the player. |
3 | SCRIPT_COMMAND_MOVE_TO | Relocate creature to a destination |
4 | SCRIPT_COMMAND_FLAG_SET | Turns on bits on a flag field at an index for the player. |
5 | SCRIPT_COMMAND_FLAG_REMOVE | Turns off bits on a flag field at an index for the player. |
6 | SCRIPT_COMMAND_TELEPORT_TO | Teleports the player to a location. |
7 | SCRIPT_COMMAND_QUEST_EXPLORED | Satisfies the explore requirement for a quest. |
8 | SCRIPT_COMMAND_KILL_CREDIT | Satisfies the kill credit requirement for a quest. |
9 | SCRIPT_COMMAND_RESPAWN_GAMEOBJECT | Spawns a despawned gameobject. |
10 | SCRIPT_COMMAND_TEMP_SPAWN_CREATURE | Temporarily summon a creature. |
11 | SCRIPT_COMMAND_OPEN_DOOR | Opens a door gameobject (type == 0). |
12 | SCRIPT_COMMAND_CLOSE_DOOR | Closes a door gameobject (type == 0). |
13 | SCRIPT_COMMAND_ACTIVATE_OBJECT | Activate (use) a gameobject. |
14 | SCRIPT_COMMAND_REMOVE_AURA | Removes an aura due to a spell. |
15 | SCRIPT_COMMAND_CAST_SPELL | Casts a spell. |
16 | SCRIPT_COMMAND_PLAY_SOUND | Plays a sound. |
17 | SCRIPT_COMMAND_CREATE_ITEM | Creates an item. |
18 | SCRIPT_COMMAND_DESPAWN_SELF | Despawns a creature with some delay. |
19 | SCRIPT_COMMAND_PLAY_MOVIE | Plays a movie to the target player. |
20 | SCRIPT_COMMAND_MOVEMENT | Change the movement type of a creature (idle, random, waypoint). |
21 | SCRIPT_COMMAND_SET_ACTIVEOBJECT | Set a creature as active object. |
22 | SCRIPT_COMMAND_SET_FACTION | Changes the faction of a creature. |
23 | SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL | Morphs a creature go a given model. |
24 | SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL | Mounts or dismounts a creature to mount entry or model. |
25 | SCRIPT_COMMAND_SET_RUN | Makes a creature start or stop running. |
26 | SCRIPT_COMMAND_ATTACK_START | Makes a creature attack things within a radius. |
27 | SCRIPT_COMMAND_GO_LOCK_STATE | Change the GO lock or interact flags. |
28 | SCRIPT_COMMAND_STAND_STATE | Change the stand state of a creature. |
29 | SCRIPT_COMMAND_MODIFY_NPC_FLAGS | Change NPC flags of a creature. |
30 | SCRIPT_COMMAND_SEND_TAXI_PATH | Sends a player on a give taxi path. |
31 | SCRIPT_COMMAND_TERMINATE_SCRIPT | Stop script execution if a given creature entry meets conditions. |
32 | SCRIPT_COMMAND_PAUSE_WAYPOINTS | Pause or unpause waypoint movement. |
33 | SCRIPT_COMMAND_XP_USER | Enable or disable experience gain for a player. – WotLK Only |
34 | SCRIPT_COMMAND_TERMINATE_COND | Stop script execution when a give condition is met. |
35 | SCRIPT_COMMAND_SEND_AI_EVENT | Send a give AI event for EventAI around the source with a given radius. |
36 | SCRIPT_COMMAND_SET_FACING | Turn resulting source to resulting target. |
37 | SCRIPT_COMMAND_MOVE_DYNAMIC | Move resulting source to a random point around resulting target or to resulting target. |
38 | SCRIPT_COMMAND_SEND_MAIL | Send mail,money from resulting source to resulting target. |
39 | SCRIPT_COMMAND_SET_HOVER | Makes a creature start or stop flying. |
40 | SCRIPT_COMMAND_DESPAWN_GO | Despawns a gameobject. |
41 | SCRIPT_COMMAND_RESPAWN | Respawns a creature. |
42 | SCRIPT_COMMAND_SET_EQUIPMENT_SLOTS | Change equipment slots of the resulting source. |
43 | SCRIPT_COMMAND_RESET_GO | Reset a gameobject. |
44 | SCRIPT_COMMAND_UPDATE_TEMPLATE | Update creature entry. |
45 | SCRIPT_COMMAND_START_RELAY_SCRIPT | Launch relay script or relay template. |
46 | SCRIPT_COMMAND_CAST_CUSTOM_SPELL | resSource = Unit, cast spell at resTarget = Unit |
47 | SCRIPT_COMMAND_INTERRUPT_SPELL | resSource = Unit, interrupt spell in specific slot |
48 | SCRIPT_COMMAND_MODIFY_UNIT_FLAGS | Change UnitFlags of a creature. |
49 | SCRIPT_COMMAND_SET_DATA_64 | Set instance data if it exists – datalong – param1 datalong2 – param2 |
50 | SCRIPT_COMMAND_ZONE_PULSE | Pulses zone for combat and attacks closest enemy |
52 | SCRIPT_COMMAND_SET_GOSSIP_MENU | Change default gossip menu id of a creature. |
53 | SCRIPT_COMMAND_SET_WORLDSTATE | Change worldstate variable to specific value. |
54 | SCRIPT_COMMAND_SET_SHEATHE | Change (sheatheState) (b2_0_sheath, UNIT_FIELD_BYTES_2,0) for a creature |
55 | SCRIPT_COMMAND_SET_STRING_ID | Sets or unsets string_id for a world object |
Commands except the ones requiring a player (like KILL_CREDIT) have support for the buddy concept.
This means that if an entry for buddy_entry is provided, aside from source and target as listed above also a “buddy” is available.
Which one on the three (originalSource, originalTarget, buddy) will be used in the command, depends on the data_flags (enum ScriptInfoDataFlags) Note that some commands (like EMOTE) use only the resulting source for an action.
When SCRIPT_FLAG_BUDDY_BY_STRING_ID is used – buddy_entry is StringId – supercedes pool, spawn group, entry and guid targeting and enables spell spawn and script targeting when set.
Possible combinations of the data_flags |SCRIPT_FLAG_BUDDY_AS_TARGET 0×01|SCRIPT_FLAG_REVERSE_DIRECTION 0×02|SCRIPT_FLAG_SOURCE_TARGETS_SELF 0×04| are:
Where “A → B” means that the command is executed from A with B as target.
Value | A → B | Comment |
0 | originalSource / buddyIfProvided → originalTarget | DEFAULT |
1 | originalSource → buddy | SCRIPT_FLAG_BUDDY_AS_TARGET |
2 | originalTarget → originalSource / buddyIfProvided | SCRIPT_FLAG_REVERSE_DIRECTION |
3 | buddy → originalSource | SCRIPT_FLAG_BUDDY_AS_TARGET + SCRIPT_FLAG_REVERSE_DIRECTION |
4 | originalSource / buddyIfProvided → originalSource / buddyIfProvided | SCRIPT_FLAG_SOURCE_TARGETS_SELF |
5 | originalSource → originalSource | SCRIPT_FLAG_BUDDY_AS_TARGET + SCRIPT_FLAG_SOURCE_TARGETS_SELF |
6 | originalTarget → originalTarget | SCRIPT_FLAG_REVERSE_DIRECTION + SCRIPT_FLAG_SOURCE_TARGETS_SELF |
7 | buddy → buddy | SCRIPT_FLAG_BUDDY_AS_TARGET + SCRIPT_FLAG_REVERSE_DIRECTION + SCRIPT_FLAG_SOURCE_TARGETS_SELF |
Range in which the buddy defined in buddy_entry will be searched by the entity executing the dbscript.
& data_flags | Description |
& SCRIPT_FLAG_BUDDY_BY_GUID | creature.guid instead of creature_template.entry |
& SCRIPT_FLAG_BUDDY_IS_DESPAWNED | Dead or Despawned creature_template.entry |
& SCRIPT_FLAG_BUDDY_BY_POOL | pool_creature.pool_entry instead of creature_template.entry |
& SCRIPT_FLAG_BUDDY_BY_SPAWN_GROUP | Buddy is part of spawn_group |
& SCRIPT_FLAG_BUDDY_BY_GO | gameobject_template.entry instead of creature_template.entry |
Defined in “enum ScriptInfoDataFlags”
Decimal | Hex | Type | Description |
0 | 0×000 | DEFAULT | s/b → t |
1 | 0×001 | SCRIPT_FLAG_BUDDY_AS_TARGET | s → b |
2 | 0×002 | SCRIPT_FLAG_REVERSE_DIRECTION | t* → s* (* result after previous flag is evaluated) |
4 | 0×004 | SCRIPT_FLAG_SOURCE_TARGETS_SELF | s* → s* (* result after previous flag is evaluated) |
8 | 0×008 | SCRIPT_FLAG_COMMAND_ADDITIONAL | Only for some commands possible. |
16 | 0×010 | SCRIPT_FLAG_BUDDY_BY_GUID | Interpret search_radius as buddy_entry GUID. |
32 | 0×020 | SCRIPT_FLAG_BUDDY_IS_PET | Do not search for an npc, but for a pet. |
64 | 0×040 | SCRIPT_FLAG_BUDDY_IS_DESPAWNED | Search for a creature that is despawned or dead. |
128 | 0×080 | SCRIPT_FLAG_BUDDY_BY_POOL | buddy should be part of a pool |
256 | 0×100 | SCRIPT_FLAG_BUDDY_BY_SPAWN_GROUP | buddy is from spawn group |
512 | 0×200 | SCRIPT_FLAG_ALL_ELIGIBLE_BUDDIES | multisource/multitarget – will execute for each eligible |
1024 | 0×400 | SCRIPT_FLAG_BUDDY_BY_GO | take the buddy by GO (for commands which can target both creature and GO) |
2048 | 0×800 | SCRIPT_FLAG_BUDDY_BY_STRING_ID | targets entities by StringId (creature or GO) |
Depending on what command was used (enum ScriptCommand), the meaning and use of the fields can vary:
-
SCRIPT_COMMAND_TALK = 0
- All information of the text (type, language, associated sound, emote) is stored in the broadcast_text.id table
- datalong: dbscript_random_templates.id – will randomize between all broadcast_text.id in given template.
- dataint – dataint4: The text ID that the creature will say. See broadcast_text.id. In case more then only dataint field is filled the texts will be used randomly.
-
SCRIPT_COMMAND_EMOTE = 1
- datalong: The emote ID to play.
- dataint – dataint4: additonally to datalong, for random selection of emote between datalong + dataint – dataint4
- Resulting source must be a unit.
-
SCRIPT_COMMAND_FIELD_SET = 2 – Deprecated – e.g use SCRIPT_COMMAND_MODIFY_UNIT_FLAGS
- datalong: Index of the field.
- datalong2: Value to place at the index.
-
SCRIPT_COMMAND_MOVE_TO = 3
- datalong: dbscripts_on_relay id – executed for source and target same as this script
- datalong2: Length of the motion. This calculates as travel_speed*100. Use 0 for creature default movement.
- datalong3: enum ForcedMovement
- data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL (8) will teleport the creature to the given location.
- x: X position to move to. If position is very near to current position, or x=y=z=0, then only orientation is changed
- y: Y position to move to.
- z: Z position to move to. If x=y=0 and z !=0, then only Z position is changed (new value will be added to current ‘z’ position
- o: Orientation to face.
- Resulting source must be a creature.
Side note: If position is very near to current position, or x=y=z=0, then only orientation is changed.
-
SCRIPT_COMMAND_FLAG_SET = 4 – Deprecated – e.g use SCRIPT_COMMAND_MODIFY_UNIT_FLAGS
- datalong: Field index to be set.
- datalong2: Flag bit(s) to set.
Type | classic | tbc | wotlk | Description |
---|---|---|---|---|
UNIT_FIELD_HEALTH | 22 | 22 | 24 | Health |
UNIT_FIELD_POWER1 | 23 | 23 | 25 | Mana |
UNIT_FIELD_LEVEL | 34 | 34 | 54 | Level |
UNIT_FIELD_FLAGS | SCRIPT_COMMAND_MODIFY_UNIT_FLAGS | |||
UNIT_FIELD_BOUNDINGRADIUS | 129 | 150 | 65 | bounding_radius |
UNIT_FIELD_COMBATREACH | 130 | 151 | 66 | combat_reach |
UNIT_FIELD_BYTES_1 | SCRIPT_COMMAND_STAND_STATE | |||
UNIT_DYNAMIC_FLAGS | 143 | 164 | 79 | DynamicFlags |
UNIT_NPC_FLAGS | SCRIPT_COMMAND_MODIFY_NPC_FLAGS |
More Examples Can Be Found At: UpdateFields.h In Core
-
SCRIPT_COMMAND_FLAG_REMOVE = 5 – Deprecated – e.g use SCRIPT_COMMAND_MODIFY_UNIT_FLAGS
- datalong: Field index to be unset.
- datalong2: Flag bit(s) to unset.
-
SCRIPT_COMMAND_TELEPORT_TO = 6
- datalong: Target Map ID. See Map.dbc.
- x: Teleport target x coordinate.
- y: Teleport target y coordinate.
- z: Teleport target z coordinate.
- o: Teleport target orientation.
- The source or target must be a player.
-
SCRIPT_COMMAND_QUEST_EXPLORED = 7
- datalong: Quest ID whose external status should be satisfied.
- datalong2: Distance away from the NPC/object that the player can be and have the script still take effect.
- The source or target must be a player.
-
SCRIPT_COMMAND_KILL_CREDIT = 8
- datalong: Kill credit entry for quest (entry in quest_template.ReqCreatureOrGOId). If set to 0 then the creature source or target will be used.
- datalong2: Can be 0 = personal credit or 1 = group credit.
- The source or target must be a player.
-
SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9
- datalong: Guid of the gameobject to respawn. See gameobject.guid. Can be skipped for buddy.
- datalong2: Despawn time in seconds. If the value is < 5 seconds then 5 seconds is used instead.
-
SCRIPT_COMMAND_TEMP_SPAWN_CREATURE = 10
- datalong: Entry of the summoned creature from creature_template.entry.
- datalong2: despawn_delay (MILLIESECONDS). If set to 0 then the creature will be despawned only when killed.
- datalong3: The pathId you want the creature to immediately start moving on (if MovementType=2)
- data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL (8) will summon the creature as active object.
- dataint: SetRun (bool). 0 = off (default), 1 = on
- dataint4 = creature_spawn_data_template entry – enables customization of faction, model, equipment and more
- x: Summon target x coordinate.
- y: Summon target y coordinate.
- z: Summon target z coordinate.
- o: Summon target orientation.
-
SCRIPT_COMMAND_OPEN_DOOR = 11
- datalong: Guid of the activated door. It’s a gameobject.guid. Can be skipped if buddy is provided.
- datalong2: Delay before closing again the door. If the value is < 15 seconds then 15 seconds is used instead.
- datalong3: alternate state – bool 0 or 1
-
SCRIPT_COMMAND_CLOSE_DOOR = 12
- datalong: Guid of the activated door. It’s a gameobject.guid. Can be skipped if buddy is provided.
- datalong2: Delay before opening again the door. If the value is < 15 seconds then 15 is used instead.
-
SCRIPT_COMMAND_ACTIVATE_OBJECT = 13
- The source must be a unit and the target a gameobject.
- datalong: animation id; Used for data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL. Default is 0.
- data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL (8) will send a gameobject animation instead of standard gameobject Use() function
-
SCRIPT_COMMAND_REMOVE_AURA = 14
- datalong: Spell ID.
-
data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL (8) will remove aura from the source only for the target unit.
warning – if used with a channeled spell will not interrupt channel
-
SCRIPT_COMMAND_CAST_SPELL = 15
- datalong: Spell ID.
- datalong2: TriggerCastFlags
- buddy_entry: entry of the target
- search_radius: radius to search for buddy_entry or guid of the specific guid if data_flags is set
- data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL (8): do not pass target to spellcast
- dataint – dataint4 optional. If some of these are set to a spell id, a random spell out of datalong + dataint – dataint4 is cast.
Bit | Name | Description |
---|---|---|
0 | TRIGGERED_NONE | Not Triggered |
1 | TRIGGERED_OLD_TRIGGERED | Legacy bool support TODO: Restrict usage as much as possible. |
2 | TRIGGERED_IGNORE_HIT_CALCULATION | Will ignore calculating hit in SpellHitResult |
4 | TRIGGERED_IGNORE_UNSELECTABLE_FLAG | Ignores UNIT_FLAG_NOT_SELECTABLE in CheckTarget |
8 | TRIGGERED_INSTANT_CAST | Will ignore any cast time set in spell entry |
16 | TRIGGERED_AUTOREPEAT | Will signal spell system that this is internal autorepeat call |
32 | TRIGGERED_IGNORE_UNATTACKABLE_FLAG | Ignores UNIT_FLAG_NOT_ATTACKABLE in CheckTarget |
64 | TRIGGERED_DO_NOT_PROC | Spells from scripts should not proc – DBScripts for example |
128 | TRIGGERED_PET_CAST | Spell that should report error through pet opcode |
256 | TRIGGERED_NORMAL_COMBAT_CAST | AI needs to be notified about change of target TODO: change into TRIGGERED_NONE |
-
SCRIPT_COMMAND_PLAY_SOUND = 16
- datalong: Sound ID.
- datalong2: bitmask: 0/1=target-player, 0/2=with distance dependent, 0/4=map wide, 0/8=zone wide; 1|2 = 3 is target with distance dependent.
- data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL (8): play music instead of sound
- Source may be any object. Target may be any player.
-
SCRIPT_COMMAND_CREATE_ITEM = 17
- datalong: Item entry.
- datalong2: Amount.
- data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL (8): remove the item from player by the given amount
- Source or target must be a player.
-
SCRIPT_COMMAND_DESPAWN_SELF = 18
- datalong: Despawn delay (MILLISECONDS).
- Resulting source must be a creature.
- Despawns the target.
-
SCRIPT_COMMAND_PLAY_MOVIE = 19
- datalong: Plays a movie_id to the target player.
- Target must be a player.
-
SCRIPT_COMMAND_MOVEMENT = 20
- datalong: Change the MovementType of a creature. Possible values: 0 = Idle, 1 = Random Movement, 2 = Waypoint Movement, 3 = Cyclic Spline Movement (enum MovementGeneratorType).
- datalong2: spawndist for Random Movement (1) or creature_movement_template.pathId for Waypoint Movement (2).
- datalong3: timer (in milliseconds) – use in conjunction with MoveRandomAroundPoint to trigger usage of TimedWanderMovementGenerator
- data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL (8) will set random movement around the current position.
- dataint: enum ForcedMovement
- Resulting source must be a creature.
Value | Name | Description |
---|---|---|
0 | FORCED_MOVEMENT_NONE | Default |
1 | FORCED_MOVEMENT_WALK | Walk |
2 | FORCED_MOVEMENT_RUN | Run |
3 | FORCED_MOVEMENT_FLIGHT | Fly |
-
SCRIPT_COMMAND_SET_ACTIVEOBJECT = 21
- datalong: 0 = Off, 1 = On. Set a creature as active object, depending on the datalong value.
- Resulting source must be creature.
-
SCRIPT_COMMAND_SET_FACTION = 22
- datalong: Faction Id. If set to 0 will restore original faction from creature_template.
- Resulting source must be a creature.
- datalong2: enum TemporaryFactionFlags
Bit | Hex | Description | |
0 | 0×00 | TEMPFACTION_NONE | When no flag is used in temporary faction change, faction will be persistent. It will then require manual change back to default/another faction when changed once. |
1 | 0×01 | TEMPFACTION_RESTORE_RESPAWN | Default faction will be restored at respawn. |
2 | 0×02 | TEMPFACTION_RESTORE_COMBAT_STOP | at CombatStop() (happens at creature death, at evade or custom script among others). |
4 | 0×04 | TEMPFACTION_RESTORE_REACH_HOME | at reaching home in home movement (evade), if not already done at CombatStop(). |
8 | 0×08 | TEMPFACTION_TOGGLE_NON_ATTACKABLE | Remove UNIT_FLAG_NON_ATTACKABLE(0×02) when faction is changed (reapply when temp-faction is removed). |
16 | 0×10 | TEMPFACTION_TOGGLE_IMMUNE_TO_PLAYER | Remove UNIT_FLAG_IMMUNE_TO_PLAYER(0×100) when faction is changed (reapply when temp-faction is removed.) |
32 | 0×20 | TEMPFACTION_TOGGLE_IMMUNE_TO_NPC | Remove UNIT_FLAG_IMMUNE_TO_NPC(0×200) when faction is changed (reapply when temp-faction is removed) |
64 | 0×40 | TEMPFACTION_TOGGLE_PACIFIED | Remove UNIT_FLAG_PACIFIED(0×20000) when faction is changed (reapply when temp-faction is removed) |
128 | 0×80 | TEMPFACTION_TOGGLE_NOT_SELECTABLE | Remove UNIT_FLAG_NOT_SELECTABLE(0×2000000) when faction is changed (reapply when temp-faction is removed) |
-
SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL = 23
- datalong: Creature entry or model_id (depending on data_flags). If set to 0 then the creature will demorph.
- data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL (8) to use datalong value as model_id explicit.
- Resulting source must be a creature.
-
SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL = 24
- datalong: Creature entry or model_id (depending on data_flags). If set to 0 then the creature will dismount.
- data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL (8) to use datalong value as model_id explicit.
- Resulting source must be creature.
-
SCRIPT_COMMAND_SET_RUN = 25
- datalong: Set run to 1 = On or 0 = Off
- Resulting source must be a creature.
-
SCRIPT_COMMAND_ATTACK_START = 26
- Resulting source must be a creature and resulting target must be a unit.
-
SCRIPT_COMMAND_GO_LOCK_STATE = 27
- Resulting source must be gameobject.
- datalong:
Bit | Hex | Name |
1 | 0×01 | flag_go_lock |
2 | 0×02 | flag_go_unlock |
4 | 0×04 | flag_go_nonInteract |
8 | 0×08 | flag_go_interact |
-
SCRIPT_COMMAND_STAND_STATE = 28
- Resulting source must be a creature.
- datalong: enum UnitStandStateType
Bit | Name | Comment |
0 | UNIT_STAND_STATE_STAND | normal behavior |
1 | UNIT_STAND_STATE_SIT | sitting on ground |
2 | UNIT_STAND_STATE_SIT_CHAIR | sitting on normal chair |
3 | UNIT_STAND_STATE_SLEEP | sleeping |
4 | UNIT_STAND_STATE_SIT_LOW_CHAIR | sitting on low chair |
5 | UNIT_STAND_STATE_SIT_MEDIUM_CHAIR | sitting on medium chair |
6 | UNIT_STAND_STATE_SIT_HIGH_CHAIR | sitting on high chair |
7 | UNIT_STAND_STATE_DEAD | play dead |
8 | UNIT_STAND_STATE_KNEEL | kneel |
9 | UNIT_STAND_STATE_CUSTOM | Depends on model animation. Submerge, freeze, hide, hibernate, rest |
-
SCRIPT_COMMAND_MODIFY_NPC_FLAGS = 29
- Resulting source must be a creature.
- datalong: NPC Flags
- datalong2: 0 Remove, 1 Add
-
SCRIPT_COMMAND_SEND_TAXI_PATH = 30
- datalong: Taxi path id.
- Source or target must be a player.
-
SCRIPT_COMMAND_TERMINATE_SCRIPT = 31
- datalong: Creature entry if provided. (Or pool ID if SCRIPT_FLAG_BUDDY_BY_POOL)
- datalong2: Search distance.
- datalong3: pool id
- dataint: Change of waittime (MILLISECONDS) of a current waypoint movement type. Negative values will decrease time.
- data_flags
& data_flags | Description |
& SCRIPT_FLAG_COMMAND_ADDITIONAL 8 0×08 | If creature is found and alive, terminate script. |
! SCRIPT_FLAG_COMMAND_ADDITIONAL | If creature is not found or not alive, terminate script. |
- when used with guid or entry search, can also search for GO guid through SCRIPT_FLAG_BUDDY_BY_GO
-
SCRIPT_COMMAND_PAUSE_WAYPOINTS = 32
- datalong: 0 unpause waypoint, 1 pause waypoint
- Resulting source or target must be a creature.
-
SCRIPT_COMMAND_XP_USER = 33 — WotLK only
- datalong: Set experience gain to 1 = On or 0 = Off
- Source or target must be a player.
Side note: Only available on wotlk version.
-
SCRIPT_COMMAND_TERMINATE_CONDITION = 34
- datalong: condition_id to check.
- datalong2: Quest entry to mark as failed for the player (if provided).
- data_flags
& data_flags | Description |
& SCRIPT_FLAG_COMMAND_ADDITIONAL 8 0×08 | Terminate when condition is false. |
! SCRIPT_FLAG_COMMAND_ADDITIONAL | Terminate when condition is true. |
-
SCRIPT_COMMAND_SEND_AI_EVENT = 35
- datalong: AIEventType. Only EventAI events are accepted. Supported types see CreatureAI.h “enum AIEventType”.
- datalong2: Radius. If radius isn’t provided and the target is a creature, then send AIEvent to target.
- datalong3: miscvalue – uint32 – for use in ReceiveAIEvent handler
- Source and target must be a creature.
Value | Name | Comment |
0 | AI_EVENT_JUST_DIED | Sender = Killed Npc, Invoker = Killer |
1 | AI_EVENT_CRITICAL_HEALTH | Sender = Hurt Npc, Invoker = DamageDealer – Expected to be sent by 10% health |
2 | AI_EVENT_LOST_HEALTH | Sender = Hurt Npc, Invoker = DamageDealer – Expected to be sent by 50% health |
3 | AI_EVENT_LOST_SOME_HEALTH | Sender = Hurt Npc, Invoker = DamageDealer – Expected to be sent by 90% health |
4 | AI_EVENT_GOT_FULL_HEALTH | Sender = Healed Npc, Invoker = Healer |
5 | AI_EVENT_CUSTOM_EVENTAI_A | Sender = Npc that throws custom event, Invoker = TARGET_T_ACTION_INVOKER (if exists) |
6 | AI_EVENT_CUSTOM_EVENTAI_B | Sender = Npc that throws custom event, Invoker = TARGET_T_ACTION_INVOKER (if exists) |
7 | AI_EVENT_GOT_CCED | Sender = CCed Npc, Invoker = Caster that CCed |
8 | AI_EVENT_CUSTOM_EVENTAI_C | Sender = Npc that throws custom event, Invoker = TARGET_T_ACTION_INVOKER (if exists) |
9 | AI_EVENT_CUSTOM_EVENTAI_D | Sender = Npc that throws custom event, Invoker = TARGET_T_ACTION_INVOKER (if exists) |
10 | AI_EVENT_CUSTOM_EVENTAI_E | Sender = Npc that throws custom event, Invoker = TARGET_T_ACTION_INVOKER (if exists) |
11 | AI_EVENT_CUSTOM_EVENTAI_F | Sender = Npc that throws custom event, Invoker = TARGET_T_ACTION_INVOKER (if exists) |
-
SCRIPT_COMMAND_SET_FACING = 36
- Resulting source must be a creature; Resulting target must be a Worldobject.
- datalong != 0 Reset orientation
& data_flags | Description |
& SCRIPT_FLAG_COMMAND_ADDITIONAL 8 0×08 | Also set TargetGuid of resultingSource to resultingTarget (MUST be Creature/ Player) |
-
SCRIPT_COMMAND_MOVE_DYNAMIC = 37
- Resulting source must be a creature; Resulting target must be a Worldobject.
- datalong = 0: Move resulting source towards resulting target
- datalong != 0: Move resulting source to a random point between datalong2 and datalong around resulting target.
- datalong3 = Exact contact point distance, to be used when you want to stop moving as soon as you’re within this distance of the target
- orientation != 0: Obtain a random point around resulting target in direction of orientation
- data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL (8) Obtain a point in direction of resulting target→GetOrientation + orientation
- for resulting target == resulting source and orientation == 0 this will mean resulting source moving forward
- dataint: enum ForcedMovement
- dataint2: dbscripts_on_relay id
-
SCRIPT_COMMAND_SEND_MAIL = 38
- Resulting source should be a Creature OR NULL. Resulting target must be Player
- datalong = mailTemplateId (mail_template_dbc + mail_loot_template)
- datalong2: AlternativeSenderEntry. Use as sender-Entry of the sent mail
- datalong3: Money
- dataint: Delay (>= 0) in Seconds
-
SCRIPT_COMMAND_SET_HOVER = 39
- Resulting source must be a creature.
- datalong = bool 0=off, 1=on
- data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL (8) set/unset byte flag UNIT_BYTE1_FLAG_FLY_ANIM
-
SCRIPT_COMMAND_DESPAWN_GO = 40
- Resulting target must be a Gameobject. Please note that not all gameobject types support this command.
- datalong = despawnDelay
-
SCRIPT_COMMAND_RESPAWN = 41
- resultingSource = Creature. Requires SCRIPT_FLAG_BUDDY_IS_DESPAWNED to find dead or despawned targets
-
SCRIPT_COMMAND_SET_EQUIPMENT_SLOTS = 42
- Resulting source must be a creature.
- datalong = resetDefault: bool 0=false, 1=true
- dataint = main hand slot
- dataint2 = off hand slot
- dataint3 = ranged slot
-
SCRIPT_COMMAND_RESET_GO = 43
- Resulting target must be a Gameobject. Only works for Gameobject which are doors or buttons (GO type 0 and 1)
-
SCRIPT_COMMAND_UPDATE_TEMPLATE = 44
- Resulting source must be a Creature.
- datalong = new creature entry. Must be different than the current one
- datalong2 = faction for which the entry is updated. 0 = Alliance, 1 = Horde. No other values are allowed
-
SCRIPT_COMMAND_START_RELAY_SCRIPT= 45
- Resulting source must be a Unit. Target is not mandatory.
- datalong = dbscripts_on_relay.id which should be launched
- datalong2 = dbscript_random_templates.id which should be launched. Takes precedence over dbscripts_on_relay.id.
-
SCRIPT_COMMAND_CAST_CUSTOM_SPELL= 46
- Resulting source must be a Unit. Target is Unit.
- datalong = spellid
- datalong2 = castFlags, enum TriggerCastFlags
- dataint – dataint3 define the &bp value for the spell. At least one field is required.
-
SCRIPT_COMMAND_INTERRUPT_SPELL= 47
- Resulting source must be a Unit.
- datalong = enum CurrentSpellTypes
Value | Name |
0 | CURRENT_MELEE_SPELL |
1 | CURRENT_GENERIC_SPELL |
2 | CURRENT_AUTOREPEAT_SPELL |
3 | CURRENT_CHANNELED_SPELL |
-
SCRIPT_COMMAND_MODIFY_UNIT_FLAGS = 48
- Resulting source must be a creature.
- datalong: UnitFlags
- datalong2: 0 Remove, 1 Add
-
SCRIPT_COMMAND_SET_DATA_64 = 49
- Set instance data if it exists
- datalong – set data param1
- datalong2 – set data param2
-
SCRIPT_COMMAND_ZONE_PULSE = 50
- Pulses zone for combat and attacks closest enemy
-
SCRIPT_COMMAND_SET_GOSSIP_MENU = 52
- Resulting target must be a creature.
- datalong: gossipMenuId
-
SCRIPT_COMMAND_SET_WORLDSTATE = 53
- Sets worldstate variable to new value in current map
- dataint = worldstate variable id – must have worldstate_name entry defined
- dataint2 = new value
-
SCRIPT_COMMAND_SET_SHEATHE= 54
- Change (sheatheState) for a creature
- datalong = enum SheathState
Bit | Name | Comment |
0 | SHEATH_STATE_UNARMED | all weapons sheathed |
1 | SHEATH_STATE_MELEE | melee weapon(s) unsheathed |
2 | SHEATH_STATE_RANGED | ranged weapon(s) unsheathed |
-
SCRIPT_COMMAND_SET_STRING_ID = 55
- Sets or removes string_id#id for a WorldObject
- datalong = string_id Id
- datalong2 = apply – 0 remove, 1 add