DBScripts - vanrhy/linguister GitHub Wiki

Back to world database list of tables.

The `dbscripts_on_*` tables

The manual reference for these tables is located in the doc/script_commands.txt file.

The information below may be outdated, use with caution!

This table format is used for different tables to control possible scripts activated by different actions:

  • `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)
  • `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.
  • `dbscripts_on_quest_start: Holds scripts activated when a player accepts a quest.
    Source: quest giver (creature); Target: player; Script execution unique by source.
  • `dbscripts_on_quest_end: Holds scripts activated when a player finishes a quest.
    Source: quest taker (creature); Target: player; Script execution unique by source.
  • `dbscripts_on_creature_movement: Holds scripts activated while a npc is moving.
    Source: moving creature; Target moving creature.
  • `dbscripts_on_creature_death: Holds scripts activated when a creature dies.
    Source: killed creature; Target: responsible killer (unit or player).
  • `dbscripts_on_event: Holds scripts activated whenever an event is activated by spell, gameobject or taxi waypoints. The following spell effects and gameobjecs 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.
  • `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.

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.

Structure

Field Type Null Key Default Extra
id int(8) unsigned NO 0
delay int(10) 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

Description of the fields

id

For gameobject_scripts, it is the guid of the button/lever. See gameobject.guid.
For gameobject_template_scripts, it is the entry of the button/lever. See gameobject_template.entry.
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_scripts, it is the script id of the waypoint.The PROPER formatting for the ID field is as follows: Creature_entry + 2-Digit Script ID (Starting at 01). Example: c.2386 has few movement_scripts, so 2386+01 = 238601 … 23602 ..etc
For creature_death_scripts, it is the entry of the creature. See creature_template.entry.
For gossip_scripts, it is the action script id of the gossip option.

delay

Delay in seconds 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 delay and then if you want script 2 to trigger 3 seconds later you would use delay value 8 for script 2 in the sequence.

command

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/creature.
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 Activate (use) a gameobject.
14 REMOVE_AURA Removes an aura due to a spell.
15 CAST_SPELL Casts a spell.
16 PLAY_SOUND Plays a sound.
17 CREATE_ITEM Creates an item.
18 DESPAWN_SELF Despawns a creature with some delay.
19 PLAY_MOVIE Plays a movie to the target player.
20 MOVEMENT Change the movement type of a creature (idle, random, waypoint).
21 SET_ACTIVEOBJECT Set a creature as active object.
22 SET_FACTION Changes the faction of a creature.
23 MORPH_TO_ENTRY_OR_MODEL Morphs a creature go a given model.
24 MOUNT_TO_ENTRY_OR_MODEL Mounts or dismounts a creature to mount entry or model.
25 SET_RUN Makes a creature start or stop running.
26 ATTACK_START Makes a creature attack things within a radius.
27 GO_LOCK_STATE Change the GO lock or interact flags.
28 STAND_STATE Change the stand state of a creature.
29 MODIFY_NPC_FLAG Change NPC flags of a creature.
30 SEND_TAXI_PATH Sends a player on a give taxi path.
31 TERMINATE_SCRIPT Stop script execution if a given creature entry meets conditions.
32 PAUSE_WAYPOINTS Pause or unpause waypoint movement.
33 XP_USER Enable or disable experience gain for a player.
34 TERMINATE_CONDITION Stop script execution when a give condition is met.
35 SEND_AI_EVENT_AROUND Send a give AI event for EventAI around the source with a given radius.
36 SET_FACING Turn resulting source to resulting target.
37 MOVE_DYNAMIC Move resulting source to a random point around resulting target or to resulting target.
38 SEND_MAIL Send mail from resulting source to resulting target.
39 SET_FLY Makes a creature start or stop flying.
40 DESPAWN_OBJECT Despawns a gameobject.
41 RESPAWN_CREATURE Respawns a creature.
42 SET_EQUIPMENT_SLOTS Change equipment slots of the resulting source.
43 RESET_OBJECT Reset a gameobject.

Buddy Concept

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.

Search Radius

Range in which the buddy defined in buddy_entry will be searched.
In case of SCRIPT_FLAG_BUDDY_BY_GUID this field is the buddy’s GUID.

Data flags

SCRIPT_FLAG_BUDDY_AS_TARGET 0×01 1
SCRIPT_FLAG_REVERSE_DIRECTION 0×02 2
SCRIPT_FLAG_SOURCE_TARGETS_SELF 0×04 4
SCRIPT_FLAG_COMMAND_ADDITIONAL 0×08 8 Only for some commands possible.
SCRIPT_FLAG_BUDDY_BY_GUID 0×10 16 Interpret search_radius as buddy’s GUID.
SCRIPT_FLAG_BUDDY_IS_PET 0×20 32 Do not search for an npc, but for a pet.
SCRIPT_FLAG_BUDDY_IS_DESPAWNED 0×40 64 Search for a creature that is despawned or dead.

OtherFields

Depending on what command was used, the meaning and use for the following fields varies.

  • SCRIPT_COMMAND_TALK = 0
    • All information of the text (type, language, associated sound, emote) is stored in the db_script_string. table
    • 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 field is filled the texts will be used randomly.
  • SCRIPT_COMMAND_EMOTE = 1
    • datalong: The emote ID to play.
    • Resulting source must be a unit.
  • 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. This calculates as travel_speed*100. Use 0 for creature default movement.
    • data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL will teleport the creature to the given location.
    • x: X position to move to.
    • y: Y position to move to.
    • z: Z position to move to.
    • 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
    • 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 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_SUMMON_CREATURE = 10
    • datalong: Entry of the summoned creature from creature_template.entry.
    • datalong2: Despawn time (MILLIESECONDS). If set to 0 then the creature will be despawned only when killed.
    • data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL will summon the creature 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. Can be skipped for buddy.
    • datalong2: Delay before closing again the door. If the value is < 15 seconds then 15 seconds is used instead.
  • SCRIPT_COMMAND_CLOSE_DOOR = 12
    • datalong: Guid of the activated door. It’s a gameobject.guid. Can be skipped for buddy.
    • 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.
  • SCRIPT_COMMAND_REMOVE_AURA = 14
  • SCRIPT_COMMAND_CAST_SPELL = 15
    • datalong: Spell ID.
    • data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL will make the cast triggered.
  • SCRIPT_COMMAND_PLAY_SOUND = 16
    • datalong: Sound ID.
    • datalong2: bitmask: 0/1=anyone/target, 0/2=with distance dependent, 0/4=map wide, 0/8=zone wide; 1|2 = 3 is target with distance dependent.
    • Source may be any object. Target may be any player.
  • SCRIPT_COMMAND_CREATE_ITEM = 17
    • datalong: Item entry.
    • datalong2: Amount.
    • Source or target must be a player.
  • SCRIPT_COMMAND_DESPAWN_SELF = 18
    • datalong: Despawn delay (MILLIESECONDS).
    • 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 movement type of a creature. Possible values: 0 = idle, 1 = random, 2 = waypoint.
    • datalong2: Wander distance (for random movement only).
    • data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL will set random movement around the current position.
    • Resulting source must be a creature.
  • SCRIPT_COMMAND_SET_ACTIVEOBJECT = 21
    • datalong: Can be defined as 1 = On or 0 = Off. 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: Temporary faction 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().
TEMPFACTION_TOGGLE_NON_ATTACKABLE 0×08 Remove UNIT_FLAG_NON_ATTACKABLE(0×02) when faction is changed (reapply when temp-faction is removed).
TEMPFACTION_TOGGLE_OOC_NOT_ATTACK 0×12 Remove UNIT_FLAG_OOC_NOT_ATTACKABLE(0×100) when faction is changed (reapply when temp-faction is removed.)
TEMPFACTION_TOGGLE_PASSIVE 0×20 Remove UNIT_FLAG_PASSIVE(0×200).
  • 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 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 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:
flag_go_lock 0×01
flag_go_unlock 0×02
flag_go_nonInteract 0×04
flag_go_interact 0×08
  • SCRIPT_COMMAND_STAND_STATE = 28
    • datalong: stand state (enum UnitStandStateType)
    • Resulting source must be a creature.
  • SCRIPT_COMMAND_MODIFY_NPC_FLAGS = 29
    • Resulting source must be a creature.
    • datalong: NPC Flags
    • datalong2:
toggle 0×00
add 0×01
remove 0×02
  • SCRIPT_COMMAND_SEND_TAXY_PATH = 30
    • datalong: Taxi path id.
    • Source or target must be a player.
  • SCRIPT_COMMAND_TERMINATE_SCRIPT = 31
    • datalong: Creature entry if provided.
    • datalong2: Search distance.
    • dataint: Change of waittime (MILLIESECONDS) of a current waypoint movement type. Negative values will decrease time.
    • data_flags:
!(data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL) If creature is not found or not alive, terminate script.
data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL If creature is found and alive, terminate script.
  • SCRIPT_COMMAND_PAUSE_WAYPOINTS = 32
    • datalong: 1 = Pause or 0 = Unpause waypoint movement.
    • Resulting source or target must be a creature.
  • SCRIPT_COMMAND_XP_USER = 33
    • 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
!(data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL) Terminate when condition is true.
data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL Terminate when condition is false.
  • SCRIPT_COMMAND_SEND_AI_EVENT_AROUND = 35
    • datalong: AI event id. Only EventAI events are accepted.
    • datalong2: Radius.
    • Source and target must be a creature.
  • SCRIPT_COMMAND_SET_FACING = 36
    • Resulting source must be a creature; Resulting target must be a Worldobject.
    • data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL also set TargetGuid of resultingSource to resultingTarget. In this case resultingTarget MUST be Creature/ Player
    • datalong != 0 Reset TargetGuid, Reset orientation
  • 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..datalong around resulting target.
    • orientation != 0: Obtain a random point around resulting target in direction of orientation
    • data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL 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
  • SCRIPT_COMMAND_SEND_MAIL = 38
    • Resulting source should be a Creature OR NULL. Resulting target must be Player
    • datalong = mailTemplateId
    • datalong2: AlternativeSenderEntry. Use as sender-Entry of the sent mail
    • dataint1: Delay (>= 0) in Seconds
  • SCRIPT_COMMAND_SET_FLY = 39
    • Resulting source must be a creature.
    • datalong = bool 0=off, 1=on
    • data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL 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.
  • 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)
⚠️ **GitHub.com Fallback** ⚠️