-
Notifications
You must be signed in to change notification settings - Fork 0
Scripts
Back to world database list of tables.
This table format is used for 7 different tables to control possible scripts activated by different actions:
- gameobject_scripts: Holds possible scripts activated by gameobjects of type GAMEOBJECT_TYPE_BUTTON (1). (Source: user)
- spell_scripts: Holds scripts that can be activated by spells with effect SPELL_EFFECT_SCRIPT_EFFECT (77). (Source: caster)
- quest_start_scripts: Holds scripts activated when a player accepts a quest. (Source: quest giver)
- quest_end_scripts: Holds scripts activated when a player finishes a quest. (Source: quest taker)
- creature_movement_scripts: Holds scripts activated while a npc is moving. (Source: creature)
- event_scripts: Holds scripts activated whenever an event is activated, be it by an object or as the spell effect SPELL_EFFECT_SEND_EVENT (61).
- gossip_scripts: Holds scripts activated on gossip_menu_option – use.
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.
Field | Type | Null | Key | Default | Extra |
id | int(11) unsigned | NO | 0 | ||
delay | int(11) unsigned | NO | 0 | ||
command | mediumint(8) unsigned | NO | 0 | ||
datalong | mediumint(8) unsigned | NO | 0 | ||
datalong2 | int(10) unsigned | NO | 0 | ||
buddy_entry | int(10) unsigned | NO | 0 | ||
search_radius | int(10) unsigned | NO | 0 | ||
data_flags | tinyint(3) unsigned | NO | 0 | ||
dataint | int(11) | NO | 0 | ||
dataint2 | int(11) | NO | 0 | ||
dataint3 | int(11) | NO | 0 | ||
dataint4 | int(11) | NO | 0 | ||
x | float | NO | 0 | ||
y | float | NO | 0 | ||
z | float | NO | 0 | ||
o | float | NO | 0 | ||
Comments | VARCHAR | NO | NULL |
For gameobject_scripts, it is the guid of the button/lever. See gameobject.guid.
For spell_scripts, it is the spell ID. See Spell.dbc
For quest_*_scripts, it is the ID that is used in StartScript or CompleteScript in the quest template definition.
For event_scripts, 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 creature_movement_script, it is the script id of the waypoint.The PROPER formatting for the ID field is as follows: Creature_ID + 2-Digit Script ID (Starting at 01). Example: c.2386 has few movement_scripts, so 2386+01 = 238601 … 23602 ..etc
For gossip_scripts, it is the action script id of the gossip option.
Delay in seconds before this current step of the script activates. 0 = instant.
The type of action performed by the script after delay seconds have passed. The value of this field affects what other fields also need to be set.
The following commands can be used:
Command | Name | Description |
---|---|---|
0 | TALK | Creature say/whisper/yell/textemote. |
1 | EMOTE | Plays emote on a player/npc. |
2 | FIELD_SET | Change the value at an index for the player. |
3 | MOVE_TO | Relocate creature to a destination |
4 | FLAG_SET | Turns on bits on a flag field at an index for the player. |
5 | FLAG_REMOVE | Turns off bits on a flag field at an index for the player. |
6 | TELEPORT_TO | Teleports the player to a location. |
7 | QUEST_EXPLORED | Satisfies the explore requirement for a quest. |
8 | KILL_CREDIT | Satisfies the kill credit requirement for a quest. |
9 | RESPAWN_GAMEOBJECT | Spawns a despawned gameobject. |
10 | TEMP_SUMMON_CREATURE | Temporarily summon a creature. |
11 | OPEN_DOOR | Opens a door gameobject (type == 0). |
12 | CLOSE_DOOR | Closes a door gameobject (type == 0). |
13 | ACTIVATE_OBJECT | Activates an object. |
14 | REMOVE_AURA | Removes an aura due to a spell. |
15 | CAST_SPELL | Casts a spell. |
16 | PLAY_SOUND | Play’s a sound. |
17 | CREATE_ITEM | Creates an item. |
18 | DESPAWN_SELF | Despawn’s a n npc with some delay. |
19 | PLAY_MOVIE | Target can only be a player. |
20 | MOVEMENT | Makes a npc move towards a different npc. |
21 | SET_ACTIVEOBJECT | |
22 | SET_FACTION | Changes faction. |
23 | MORPH_TO_ENTRY_OR_MODEL | Morphes |
24 | MOUNT_TO_ENTRY_OR_MODEL | Mounts up. |
25 | COMMAND_SET_RUN | Makes run. |
26 | COMMAND_ATTACK_START | Makes a creature attack things within a radius. |
27 | COMMAND_GO_LOCK_STATE | |
28 | COMMAND_STAND_STATE | |
29 | COMMAND_MODIFY_NPC_FLAG |
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 Note that some commands (like EMOTE) use only the resulting source for an action.
Possible combinations of the flags SCRIPT_FLAG_BUDDY_AS_TARGET = 0×01 SCRIPT_FLAG_REVERSE_DIRECTION = 0×02 SCRIPT_FLAG_SOURCE_TARGETS_SELF = 0×04 are:
0: originalSource / buddyIfProvided -> originalTarget
1: originalSource -> buddy
2: originalTarget -> originalSource / buddyIfProvided
3: buddy -> originalSource
4: originalSource / buddyIfProvided -> originalSource / buddyIfProvided
5: originalSource -> originalSource
6: originalTarget -> originalTarget
7: buddy -> buddy
Where "A -> B" means that the command is executed from A with B as target.
WILL UPDATE WITH INFORMATION ABOUT THIS FIELD
Depending on what command was used, the meaning and use for the following fields varies.
-
SCRIPT_COMMAND_TALK = 0
- datalong:
flag | Description |
---|---|
0 | SAY |
1 | YELL |
2 | TEXT_EMOTE |
3 | BOSS_EMOTE |
4 | WHISPER |
5 | BOSS_WHISPER |
6 | ZONE_YELL |
- ** datalong2: creature entry (searching for a buddy, closest to source)
- datalong3: creature search radius
- datalong4: language
- data_flags:
flag | value |
---|---|
flag_target_player_as_source | 0×01 |
flag_original_source_as_target | 0×02 |
flag_buddy_as_target | 0×04 |
- ** dataint – 4: The text ID that the creature will say. See db_script_string.. ID must be between 2000000000 and 2000010000.(In case more then only dataint is filled the text’s will be used randomly.)
-
SCRIPT_COMMAND_EMOTE = 1
- datalong: The emote ID to play.
- datalong2: creature entry
- datalong3: radius
- data_flags: flag_target_as_source = 0×01
-
SCRIPT_COMMAND_FIELD_SET = 2
- datalong: Index of the field.
- datalong2: Value to place at the index.
-
SCRIPT_COMMAND_MOVE_TO = 3
- datalong2: Length of the motion.
- x: X position to move to.
- y: Y position to move to.
- z: Z position to move to.
- o: Orientation to face.
-
SCRIPT_COMMAND_FLAG_SET = 4
- datalong: Field index to be set.
- datalong2: Flag bit(s) to set.
-
SCRIPT_COMMAND_FLAG_REMOVE = 5
- datalong: Field index to be unset.
- datalong2: Flag bit(s) to unset.
-
SCRIPT_COMMAND_TELEPORT_TO = 6
- datalong: Target Map ID. See Maps.dbc
- x: Teleport target x coordinate.
- y: Teleport target y coordinate.
- z: Teleport target z coordinate.
- o: Teleport target orientation.
-
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
-
SCRIPT_COMMAND_KILL_CREDIT = 8
- datalong: Kill credit entry for quest (entry in quest_template.ReqCreatureOrGOId)
- datalong2: 0=personal credit, 1=group credit
-
SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9
- datalong: Guid of the gameobject to respawn. See gameobject.guid.
- datalong2: Despawn time in seconds. If the value is < 5 seconds: 5 is used instead.
-
SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10
- datalong: Entry of the summoned creature from creature_template.entry.
- datalong2: Despawn time in ms.
- data_flags: 0×01 = summon as active object
- 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.
- datalong2: Delay before closing again the door. If the value is < 5 seconds: 5 is used instead.
-
SCRIPT_COMMAND_CLOSE_DOOR = 12
- datalong: Guid of the activated door. It’s a gameobject.guid.
- datalong2: Delay before opening again the door. If the value is < 5 seconds: 5 is used instead.
-
SCRIPT_COMMAND_ACTIVATE_OBJECT = 13
- The source must be a unit and the target a game object.
-
SCRIPT_COMMAND_REMOVE_AURA = 14
- datalong: Spell ID.
- datalong2: If value > 0, then cast on the source; otherwise cast on the target.
-
SCRIPT_COMMAND_CAST_SPELL = 15
- datalong: Spell ID.
- data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: cast triggered
-
SCRIPT_COMMAND_PLAY_SOUND = 16
- datalong: Sound ID.
- datalong2: bitmask: 0/1=anyone/target, 0/2=with distance dependent, so 1|2 = 3 is target with distance dependent.
Side note: Source may be any object/npc. Target may be any player.
-
SCRIPT_COMMAND_CREATE_ITEM = 17
- datalong: item entry.
- datalong2: amount.
Side note: Source or target have to be a player.
-
SCRIPT_COMMAND_DESPAWN_SELF = 18
- datalong: despawn delay.
Side note: Source or target must be creature.
-
SCRIPT_COMMAND_PLAY_MOVIE = 19
- datalong: movie_id.
-
SCRIPT_COMMAND_MOVEMENT = 20
- datalong: MovementType (0:idle, 1:random or 2:waypoint)
- datalong2: creature entry (searching for a buddy, closest to source)
- datalong3: creature search radius
-
SCRIPT_COMMAND_SET_ACTIVEOBJECT = 21
- datalong: 0=off, 1=on
- datalong2: creature entry
- datalong3: search radius
-
SCRIPT_COMMAND_SET_FACTION = 22
- datalong: factionId OR 0 to restore original faction from creature_template
- datalong2: creature entry
- datalong3: search radius
- data_flags:
TEMPFACTION_NONE | 0×00 | 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. |
TEMPFACTION_RESTORE_RESPAWN | 0×01 | Default faction will be restored at respawn |
TEMPFACTION_RESTORE_COMBAT_STOP | 0×02 | at CombatStop() (happens at creature death, at evade or custom scripte among others) |
TEMPFACTION_RESTORE_REACH_HOME | 0×04 | .. at reaching home in home movement (evade), if not already done at CombatStop() |
-
SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL = 23
- datalong: creature entry/modelid (depend on data_flags) OR 0 to demorph
- datalong2: creature entry
- datalong3: search radius
- data_flags: 0×01 to use datalong value as modelid explicit
-
SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL = 24
- datalong: creature entry/modelid (depend on data_flags) OR 0 to dismount
- datalong2: creature entry
- datalong3: search radius
- data_flags: 0×08 to use datalong value as modelid explicit
-
SCRIPT_COMMAND_SET_RUN = 25
- datalong: 0=off, 1=on
- datalong2: creature entry
- datalong3: search radius
-
SCRIPT_COMMAND_ATTACK_START = 26
- datalong2:creature_entry
- datalong3:radius
- data_flags:
flag_original_source_as_target | 0×02 |
flag_buddy_as_target | 0×04 |
-
SCRIPT_COMMAND_GO_LOCK_STATE = 27
- datalong:
flag_go_lock | 0×01 |
flag_go_unlock | 0×02 |
flag_go_nonInteract | 0×04 |
flag_go_interact | 0×08 |
- ** datalong2: go entry
- datalong3: go search radius
-
SCRIPT_COMMAND_STAND_STATE = 28
- datalong: stand state (enum UnitStandStateType)
- datalong2: creature entry (searching for a buddy, closest to source)
- datalong3: creature search radius
- data_flags:flag_target_as_source = 0×01
-
SCRIPT_COMMAND_MODIFY_NPC_FLAGS = 29
- datalong:NPCFlags
- datalong2:creature entry
- datalong3:search radius
- data_flags:
toggle | 0×00 |
add | 0×01 |
remove | 0×02 |