All scripts
Материал из YTDB DataBase
|
Back to world database list of tables.
The `*_scripts` table
This table format is used for 5 different tables to control possible scripts activated by different actions:
- gameobject_scripts: Holds possible scripts activated by gameobjects of type GAMEOBJECT_TYPE_BUTTON (1).
- spell_scripts: Holds scripts that can be activated by spells with effect SPELL_EFFECT_SCRIPT_EFFECT (77).
- quest_start_scripts: Holds scripts activated when a player accepts a quest.
- quest_end_scripts: Holds scripts activated when a player finishes a quest.
- 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).
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(11) unsigned | NO | 0 | ||
delay | int(11) unsigned | NO | 0 | ||
command | int(11) unsigned | NO | 0 | ||
datalong | int(11) unsigned | NO | 0 | ||
datalong2 | int(11) unsigned | NO | 0 | ||
dataint | int(11) | NO | 0 | ||
x | float | NO | 0 | ||
y | float | NO | 0 | ||
z | float | NO | 0 | ||
o | float | NO | 0 |
Description of the fields
id
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.
delay
Delay in seconds before this current step of the script activates. 0 = instant.
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 | 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 | 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 sound. |
OtherFields
Depending on what command was used, the meaning and use for the following fields varies.
- SCRIPT_COMMAND_TALK = 0
- datalong: 0=say, 1=whisper, 2=yell, 3=text emote
- dataint: The text ID that the creature will say. See db_script_string. ID must be between 2000000000 and 2000010000.
- SCRIPT_COMMAND_EMOTE = 1
- datalong: The emote ID to play.
- 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.
- 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.
- datalong2: If value > 0, then cast on the source; otherwise cast on the target.
- 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.