server/doc/script_commands.txt

262 lines
13 KiB
Text

-- --------------------------
## Script processing
-- --------------------------
This file is part of the CMaNGOS Project. See AUTHORS file for Copyright information
-- --------------------------
## id
-- --------------------------
creature_movement_scripts DB project self defined id
event_scripts Event id. Several sources: spell effect 61, taxi/transport nodes, gameobject_template data
gameobject_scripts Gameobject guid
gameobject_template_scripts Gameobject entry
gossip_scripts DB project self defined id
quest_end_scripts DB project self defined id (generally quest entry)
quest_start_scripts DB project self defined id (generally quest entry)
spell_scripts Spell id
-- --------------------------
## delay
-- --------------------------
Delay in seconds
The order of which each step are executed.
-- --------------------------
## command
-- --------------------------
The action to execute.
-- --------------------------
## datalong
-- --------------------------
2 multipurpose fields, store raw data as unsigned values
-- --------------------------
## buddy_entry
-- --------------------------
1 field to store the entry of a "buddy" (depending on command can be both GameObject and Creature entry)
-- --------------------------
## search_radius
-- --------------------------
Range in which the buddy defined in buddy_entry will be searched
-- --------------------------
## data_flags
-- --------------------------
Field which holds a combination of these flags:
SCRIPT_FLAG_BUDDY_AS_TARGET = 0x01
SCRIPT_FLAG_REVERSE_DIRECTION = 0x02
SCRIPT_FLAG_SOURCE_TARGETS_SELF = 0x04
SCRIPT_FLAG_COMMAND_ADDITIONAL = 0x08 (Only for some commands possible)
Detailed meaning described below!
-- --------------------------
## dataint
-- --------------------------
4 multipurpose fields, store raw data as signed values
Note: currently used only for text ids
-- --------------------------
## x y z o
-- --------------------------
Map coordinates for commands that need it.
-- --------------------------
## origin of script and source/target in scripts
-- --------------------------
creature_movement_scripts
`creature_movement` `creature_movement_template`
Source: creature. Target: creature
event_scripts
Flight path
Source: player. Target: player
Transport path
Source: transport GO. Target: Transport GO
`gameobject_template`
Source: User (player/creature). Target: GO
Spell (effect 61)
Source: caster. Target: Target
gameobject_scripts
gameobject_template_scripts
Gameobject use
Source: user: Target: GO
gossip_scripts
`gossip_menu_option`
Source: creature. Target: player (in case of NPC-Gossip)
Source: player. Target: GO (in case of GO-Gossip)
quest_end_scripts
`quest_template`
Source: quest taker (creature/GO). Target: player
quest_start_scripts
`quest_template`
Source: quest giver (creature/GO). Target: player
spell_scripts
Spell (effect 77 - SCRIPT_EFFECT)
Spell (effect 3 - DUMMY)
Spell (effect 64 - TRIGGER_SPELL, with non-existing triggered spell)
Source: caster: Target: target of spell (Unit)
-- --------------------------
## 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 = 0x01
SCRIPT_FLAG_REVERSE_DIRECTION = 0x02
SCRIPT_FLAG_SOURCE_TARGETS_SELF = 0x04
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.
-- --------------------------
## Each command has different parameters, and are as follows:
-- --------------------------
0 SCRIPT_COMMAND_TALK resultingSource = WorldObject, resultingTarget = Unit/none
* datalong (see enum ChatType for supported CHAT_TYPE_'s)
* datalong2 = language
* dataint = text entry from db_script_string -table. dataint2-dataint4 optionally, for random selection of text
1 SCRIPT_COMMAND_EMOTE resultingSource = Unit, resultingTarget = Unit/none
* datalong = emote_id
2 SCRIPT_COMMAND_FIELD_SET source = any
* datalong = field_id
* datalong2 = field value
3 SCRIPT_COMMAND_MOVE_TO resultingSource = Creature
If position is very near to current position, or x=y=z=0, then only orientation is changed
* datalong2 = travel_speed*100 (use 0 for creature default movement)
* data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: teleport unit to position
* x/y/z/o
4 SCRIPT_COMMAND_FLAG_SET source = any
* datalong = field_id
* datalong2 = bitmask
5 SCRIPT_COMMAND_FLAG_REMOVE source = any
* datalong = field_id
* datalong2 = bitmask
6 SCRIPT_COMMAND_TELEPORT_TO source or target with Player
* datalong = map_id
* x/y/z
7 SCRIPT_COMMAND_QUEST_EXPLORED one from source or target must be Player, another GO/Creature
* datalong = quest_id
* datalong2 = distance or 0
8 SCRIPT_COMMAND_KILL_CREDIT source or target with Player
* datalong = creature entry, or 0; If 0 the entry of the creature source or target is used
* datalong2 = bool (0=personal credit, 1=group credit)
9 SCRIPT_COMMAND_RESPAWN_GAMEOBJECT source = any, target = any
* datalong=db_guid (can be skipped for buddy)
* datalong2 = despawn_delay
10 SCRIPT_COMMAND_TEMP_SUMMON_CREATURE source = any, target = any
* datalong = creature entry
* datalong2 = despawn_delay
* data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: summon as active object
11 SCRIPT_COMMAND_OPEN_DOOR source = any
* datalong = db_guid (can be skipped for buddy)
* datalong2 = reset_delay
12 SCRIPT_COMMAND_CLOSE_DOOR source = any
* datalong = db_guid (can be skipped for buddy)
* datalong2 = reset_delay
13 SCRIPT_COMMAND_ACTIVATE_OBJECT source = unit, target=GO
14 SCRIPT_COMMAND_REMOVE_AURA resultingSource = Unit
* datalong = spell_id
15 SCRIPT_COMMAND_CAST_SPELL resultingSource = Unit, cast spell at resultingTarget = Unit
* datalong = spell id
* data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: cast triggered
16 SCRIPT_COMMAND_PLAY_SOUND source = any object, target=any/player
* datalong = sound_id
* datalong2 (bitmask: 0/1=target-player, 0/2=with distance dependent, 0/4=map wide, 0/8=zone wide;
so 1|2 = 3 is target with distance dependent)
17 SCRIPT_COMMAND_CREATE_ITEM source or target must be player
* datalong = item entry
* datalong2 = amount
18 SCRIPT_COMMAND_DESPAWN_SELF resultingSource = Creature
* datalong = despawn delay
19 SCRIPT_COMMAND_PLAY_MOVIE target can only be a player
* datalog = movie id
20 SCRIPT_COMMAND_MOVEMENT resultingSource = Creature
* datalong = MovementType (0:idle, 1:random or 2:waypoint)
* datalong2 = wanderDistance (for random movement)
* data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: RandomMovement around current position
21 SCRIPT_COMMAND_SET_ACTIVEOBJECT resultingSource = Creature
* datalong=bool 0=off, 1=on
22 SCRIPT_COMMAND_SET_FACTION resultingSource = Creature
* datalong=factionId OR 0 to restore original faction from creature_template
* datalong2=enum TemporaryFactionFlags
TEMPFACTION_NONE = 0x00, // 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 = 0x01, // Default faction will be restored at respawn
TEMPFACTION_RESTORE_COMBAT_STOP = 0x02, // ... at CombatStop() (happens at creature death, at evade or custom scripte among others)
TEMPFACTION_RESTORE_REACH_HOME = 0x04, // ... at reaching home in home movement (evade), if not already done at CombatStop()
23 SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL resultingSource = Creature
* datalong=creature entry/modelid (depend on data_flags) OR 0 to demorph
* data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: use datalong value as modelid explicit
24 SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL resultingSource = Creature
* datalong=creature entry/modelid (depend on data_flags) OR 0 to dismount
* data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: use datalong value as modelid explicit
25 SCRIPT_COMMAND_SET_RUN resultingSource = Creature
* datalong= bool 0=off, 1=on
26 SCRIPT_COMMAND_ATTACK_START resultingSource = Creature, resultingTarget = Unit
27 SCRIPT_COMMAND_GO_LOCK_STATE resultingSource = GO
* datalong = flag_go_lock = 0x01, flag_go_unlock = 0x02,
flag_go_nonInteract = 0x04, flag_go_interact = 0x08
28 SCRIPT_COMMAND_STAND_STATE resultingSource = Creature
* datalong = stand state (enum UnitStandStateType)
29 SCRIPT_COMMAND_MODIFY_NPC_FLAGS resultingSource = Creature
* datalong=NPCFlags
* datalong2= 0x00=toggle, 0x01=add, 0x02=remove
30 SCRIPT_COMMAND_SEND_TAXI_PATH resultingTarget or Source must be Player
* datalong = taxi path id