Back-to:World

Tables: ***_scripts

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

spell_scripts: Holds scripts that can be activated by spells with effect SPELL_EFFECT_SCRIPT_EFFECT (77) or SPELL_EFFECT_DUMMY(3).

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).

waypoint_scripts: Holds scripts used in the waypoint_data table.

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

FieldTypeAttributesKeyNullDefaultExtraComment
scripts#idmediumint(8)unsigned
NO0

scripts#effIndex [1]tinyint(3)unsigned
NO0

scripts#delayint(10)unsigned
NO0

scripts#commandmediumint(8)unsigned
NO0

datalongmediumint(8)unsigned
NO0

datalong2int(10)unsigned
NO0

dataintint(11)signed
NO0

xfloatsigned
NO0

yfloatsigned
NO0

zfloatsigned
NO0

ofloatsigned
NO0

scripts#guid [2]int(11)signedPRINO0
Acts as primary key and is set automatically using the GM command 'wp event add'

1 present in spell_scripts table only. 
2 present in waypoint_scripts table only.

Description of the fields

id

For spell_scripts, it is the spell ID. See Spell.dbc

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 waypoint_scripts, it is the action ID.

effIndex

The effect index of the spell that this script is to be applied to.

delay

Delay in seconds before this current step of the script activates. 0 = instant.

command

The type of action performed by the script after scripts#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

Play emote on 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

Gives kill credit to the player.

9

RESPAWN_GAMEOBJECT

Spawns a despawned gameobject.

10

TEMP_SUMMON_CREATURE

Temporarily summons a creature.

11

OPEN_DOOR

Opens a door gameobject (type h1. 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

Plays a sound.

17

CREATE_ITEM

Creates specified amount of items for the player.

18

DESPAWN_SELF

Forces unit to despawn.

19

nuttin

There is no command 19.

20

LOAD_PATH

Load path to unit, then unit starts waypoint movement.

21

CALLSCRIPT_TO_UNIT

Calls script from one of *_scripts table with given unit as source.

22

KILL

Changes state of the creature to dead and optionally removes its corpse.

30

ORIENTATION

Changes unit's orientation (Used in Waypoint Scripts)

31

EQUIP

Sets creature equipment.

32

MODEL

Sets creature model.

33

CLOSE_GOSSIP

Closes gossip window. This command is only used for Gossip Scripts.

34

PLAYMOVIE

Plays movie.

OtherFields

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

*SCRIPT_COMMAND_TALK = 0

*SCRIPT_COMMAND_EMOTE = 1

*SCRIPT_COMMAND_FIELD_SET = 2

*SCRIPT_COMMAND_MOVE_TO = 3

*SCRIPT_COMMAND_FLAG_SET = 4

*SCRIPT_COMMAND_FLAG_REMOVE = 5

*SCRIPT_COMMAND_TELEPORT_TO = 6

*SCRIPT_COMMAND_QUEST_EXPLORED = 7

*SCRIPT_COMMAND_KILL_CREDIT = 8

*SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9

*SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10

*SCRIPT_COMMAND_OPEN_DOOR = 11

*SCRIPT_COMMAND_CLOSE_DOOR = 12

*SCRIPT_COMMAND_ACTIVATE_OBJECT = 13

*SCRIPT_COMMAND_REMOVE_AURA = 14

*SCRIPT_COMMAND_CAST_SPELL = 15

*SCRIPT_COMMAND_PLAY_SOUND = 16

*SCRIPT_COMMAND_CREATE_ITEM = 17

*SCRIPT_COMMAND_DESPAWN_SELF = 18

*SCRIPT_COMMAND_LOAD_PATH = 20

*SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT = 21

*SCRIPT_COMMAND_KILL = 22

*SCRIPT_COMMAND_ORIENTATION = 30

*SCRIPT_COMMAND_EQUIP = 31

*SCRIPT_COMMAND_MODEL = 32

*SCRIPT_COMMAND_CLOSE_GOSSIP = 33

*SCRIPT_COMMAND_PLAYMOVIE = 34

guid

Exists only for 'waypoint_scripts' and acts there as primary key; it is set automatically using the GM command 'wp event add'.