Skip to content

Creature_ai_scripts

Schmoozerd edited this page Apr 26, 2013 · 4 revisions

Event AI Tables

Creature_ai_scripts

creature_ai_summons

creature_ai_texts

Event AI Documentation

The Manual-like and most-recent documentation for EventAI can be found in doc/EventAI.txt

Event AI Guide

NOTICE: This guide will assume that you have ScriptDev2 Rev 220+ successfully and completely installed. It is in no way designed to help in the installation procedures of ScriptDev2.

SD2 Revision when this guide was last updated: 838 (could be incomplete)

Now on to the fun stuff…

Starting with revision 220, ScriptDev2 has implemented a DB-based scripting design that allows the use of a database (MySQL only right now) to specify the actions that a creature script will do. The script is called eventAI and will be so called throughout the rest of this guide. A basic eventAI script works with and requires only two pieces of information: What to do and When to do it. The first piece of information (the What) will be referred to as the action. Currently, a single eventAI script entry can have up to three actions. The second piece of information (the When) will be referred to as the event. Anyone that wants to create entries for the eventAI script needs to answer the two questions above. Throughout the script’s lifecycle, it will continually perform the actions given when a defined event happens. Some events will only occur once while others can be timed so that they occur at a specified interval.

Now that the basic idea of the script has been explained, let’s get down to the fun details. For convenience, reference tables will be provided at the end of this article that will contain short descriptions for fast lookup. Here will be included longer and more thorough descriptions. We shall first start out with what events are currently defined by the eventAI script. An event can use up to three different parameters and these parameters control different things depending on the event. If a parameter isn’t specifically named for the event, it will not be used for that event.

One more thing: event AI can support phases. A "phase" is just a way to group certain events + actions together so that the creature will perform certain actions based on what event it is currently on. The way the phase system works in event AI is that for every event added, it needs to be specified under which phases the event SHOULD NOT occur. This is a bit confusing at first, so let’s look at it more closely. A creature can have more than one phase, up to a max of 32 different phases (with the first one being phase 0, and last one being phase 31). How the phase selection field works is that it contains a 32bit number. Each bit in the number represents a possible phase, with the bit in the least significant position signifying phase 0 and the most significant bit signifying phase 31. The default value of zero in this field has no bits set and since the field controls when the event should NOT trigger, it would then mean that the event will always be triggered independent of the current phase the creature is in. Therefore, if you want to specify what phases the event should occur in, you need to add up all of the corresponding bits for all the other phases where the event shouldn’t trigger in (confusing…yes).

For example, let’s say that a certain creature using event AI will have a max of four phases. We are then dealing with a 4 bit number in this field. Let’s further say that that certain creature has an event that will only trigger in its third phase (a timed spell cast for instance). Then the field should contain all of the phases the event SHOULDN’T be triggered in…then out of the four bits, we leave the third bit alone (off) and turn on all of the other bits so we get 1011 which is equal to 11, so we put in 11 as the inverse phase mask for the event entry. As another example, let’s say that the same creature previously mentioned has another event that is only triggered in the first and fourth phases. This would mean that we need to ignore the second and third phases, so our bitmask would be 0110 which is equal to 6 so we put in 6 for this event’s inverse phase mask field. Please note that both examples were tailored for a creature with four and only four phases. If you decide to add more phases later on, you will have to redefine all of the nonzero bitmasks for all of the mob’s events.

Every event also has a chance field that controls the chance of that event actually occurring. Using a value of 0 in this field will make the event never occur. Values are from 0 to 100.

Event Explanations


  • 0 = EVENT_T_TIMER: COMBAT ONLY! – Expires first between (Param1) and (Param2) and then between every (Param3) and (Param4).
    • Parameter 1: InitialMin
    • Parameter 2: InitialMax
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 1 = EVENT_T_TIMER_OOC: OUT OF COMBAT – Expires first between (Param1) and (Param2) and then between every (Param3) and (Param4).
    • Parameter 1: InitialMin
    • Parameter 2: InitialMax
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 2 = EVENT_T_HP: Expires when HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4).
    • Parameter 1: HPMax%
    • Parameter 2: HPMin%
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 3 = EVENT_T_MANA: Expires once Mana% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4).
    • Parameter 1: ManaMax%
    • Parameter 2: ManaMin%
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 4 = EVENT_T_AGGRO: Expires upon initial aggro (does not repeat).
  • 5 = EVENT_T_KILL: Expires upon killing a player. Will repeat every (Param1) and (Param2).
    • Parameter 1: RepeatMin
    • Parameter 2: RepeatMax
  • 6 = EVENT_T_DEATH: Expires upon Death.
  • 7 = EVENT_T_EVADE: Expires upon creature EnterEvadeMode().
  • 8 = EVENT_T_SPELLHIT: Expires upon Spell hit. If (param1) is set will only expire on that spell. If (param2) will only expire on spells of that school. Will repeat every (Param3) and (Param4) .
    • Parameter 1: SpellID
    • Parameter 2: School
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 9 = EVENT_T_RANGE: Expires when the highest threat target distance is greater than (Param1) and less than (Param2). Will repeat every (Param3) and (Param4) .
    • Parameter 1: MinDist
    • Parameter 2: MaxDist
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 10 = EVENT_T_OOC_LOS: Expires when a Player moves within visible distance to creature. Does not expire for Hostile Players if (Param1) is not 0. Does not expire for Friendly Players if (Param2) is not 0. Will repeat every (Param3) and (Param4) . Does not expire for creatures or pet or when the creature is in combat.
    • Parameter 1: NoHostile
    • Parameter 2: NoFriendly
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 11 = EVENT_T_SPAWNED: Expires at initial spawn and at creature respawn (useful for setting ranged movement type)
  • 12 = EVENT_T_TARGET_HP: Expires when Current Target’s HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4) .
    • Parameter 1: HPMax%
    • Parameter 2: HPMin%
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 13 = EVENT_T_TARGET_CASTING: Expires when the player is casting a spell. Will repeat every (Param1) and (Param2) .
    • Parameter 1: RepeatMin
    • Parameter 2: RepeatMax
  • 14 = EVENT_T_FRIENDLY_HP: Expires when a friendly unit in radius(param2) has at least (param1) hp missing. Will repeat every (Param3) and (Param4) .
    • Parameter 1: HPDeficit
    • Parameter 2: Radius
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 15 = EVENT_T_FRIENDLY_IS_CC: Expires when a friendly unit is Crowd controlled within the given radius (param2). Will repeat every (Param3) and (Param4) .
    • Parameter 1: DispelType
    • Parameter 2: Radius
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 16 = EVENT_T_MISSING_BUFF: Expires when a friendly unit is missing aura’s given by spell (param1) within radius (param2). Will repeat every (Param3) and (Param4) .
    • Parameter 1: SpellId
    • Parameter 2: Radius
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 17 = EVENT_T_SUMMONED_UNIT: Expires after creature with entry(Param1) is spawned or for all spawns if param1 = 0. Will repeat every (Param2) and (Param3) .
    • Parameter 1: CreatureId
    • Parameter 2: RepeatMin
    • Parameter 3: RepeatMax
  • 18 = EVENT_T_TARGET_MANA:
    • Parameter 1: ManaMax%
    • Parameter 2: ManaMin%
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 21 = EVENT_T_REACHED_HOME: Expires when creature reach it’s home(spawn) location after Evade.
  • 22 = EVENT_T_RECEIVE_EMOTE: Expires when creature receive emote with text emote id(enum TextEmotes). Condition can be defined. If set, then most conditions has additional value (see table enum ConditionType below.)
    • Parameter 1: EmoteId
    • Parameter 2: Condition
    • Parameter 3: CondValue1
    • Parameter 4: CondValue2
  • 23 = EVENT_T_BUFFED: Expires when creature have spell (Param1) auras applied stack greater or equal provided in Param2 amount. Will repeat every (Param3) and (Param4).
    • Parameter 1: SpellId
    • Parameter 2: AmmountInStack
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 24 = EVENT_T_TARGET_BUFFED: Expires when target unit have spell (Param1) auras applied stack greater or equal provided in Param2 amount. Will repeat every (Param3) and (Param4).
    • Parameter 1: SpellId
    • Parameter 2: AmmountInStack
    • Parameter 3: RepeatMin
    • Parameter 4: RepeatMax
  • 25 = EVENT_T_SUMMONED_JUST_DIED: Expires after creature with entry(Param1) is die or for all spawns if param1 = 0. Will repeat every (Param2) and (Param3) .
    • Parameter 1: CreatureId
    • Parameter 2: RepeatMin
    • Parameter 3: RepeatMax
  • 26 = EVENT_T_SUMMONED_JUST_DESPAWN: Expires before creature with entry(Param1) is despawned or for all spawns if param1 = 0. Will repeat every (Param2) and (Param3) .
    • Parameter 1: CreatureId
    • Parameter 2: RepeatMin
    • Parameter 3: RepeatMax

Now that all of the supported events have been listed and described, we shall now move on to the actions that can be performed. Each event can take up to three actions. The actions will all be performed when the event is triggered and they will be performed in the order that they have been defined. This means that, for a certain event, action 1 will be performed first, followed by action 2, then lastly by action 3. Just like event definitions, each action can use up to three different parameters but not all actions will use all three parameters. If a parameter isn’t mentioned for an action, then that action does not need that parameter.

Before we start to list and explain the different actions that can be taken, we must first look at how the eventAI targeting system works. Due to technical reasons in how targetting is handled, the eventAI script cannot target anything or anyone that is not in its threat list or is not the scripted creature itself. It also can’t currently target anyone specific in its threat list except by their position in the threat list. However, even then it can only target specifically the current victim, the second unit in its threat list, and the last unit in its threat list. It can also target units in its threat list at random and has two options for that: anyone in its threat list at random, or anyone in its threat list excluding the unit with the most threat. Aside from all of those external targets, the script can always target itself. More information on the target types can be found in the reference tables at the end of this guide.

One last note before we start looking at individual actions is about the texts. The eventAI script has support for localized text entries. Therefore, you can define what the mob will say in more than one language all in another table and the script will show the corresponding localized text to the corresponding client (english text to enUS/enGB clients, german text to deDE clients, etc). All of the localized text entries will have a unique text ID assigned to them and it is that text ID that will be used by any actions that require textual input.

Action Explanations


  • 0 = ACTION_T_NONE: Does nothing!
  • 1 = ACTION_T_SAY: Displays the -TextId as defined. In case -TextId2 and optionally -TextId3, the output will be randomized. Type text are defined in the eventai_texts table (say, yell, whisper, etc) along with other options for the text. All values are required to be negative.
    • Parameter 1: The entry of the text that the NPC should use from eventai_texts table. Optionally a entry from other tables can be used (such as custom_texts are required to be negative and exist in a *_texts-table. The type text to be displayed are defined in the texts-table itself (Say, Yell, Whisper, Emote Text, Boss Whisper, Boss Emote)Other options are also to be defined in the texts-table, such as a sound to be heard with the text and the language used in output (common, dwarvish, etc).In case this entry has a localized version of the text, the localized text will be displayed in client that support this locale.
    • Parameter 2: Optional. TextId can be defined in addition. The same apply to this as explained above, however eventAI will randomize between the two.
    • Parameter 3: Optional, if Parameter 2 exist. In this case, eventAI will randomize between three.
  • 2 = ACTION_T_YELL: UNUSED
  • 3 = ACTION_T_TEXTEMOTE: UNUSED
  • 4 = ACTION_T_SOUND: When activated, the creature will play the specified sound.
    • Parameter 1: The sound ID to be played. Sound IDs are contained in the DBC files.
  • 5 = ACTION_T_EMOTE: When activated, the creature will perform a visual emote. Unlike a text emote, a visual emote is one where the creature will actually move or perform a gesture.
    • Parameter 1: The emote ID that the creature should perform. Emote IDs are also contained in the DBC but they can be found in the mangos source as well.
  • 6 = ACTION_T_RANDOM_SAY: UNUSED
  • 7 = ACTION_T_RANDOM_YELL: UNUSED
  • 8 = ACTION_T_RANDOM_TEXTEMOTE: UNUSED
  • 9 = ACTION_T_RANDOM_SOUND: Similar to the ACTION_T_SOUND action, when this action is activated, it will choose at random a sound to play. This action needs all three parameters to be filled and it will pick a random entry from the three. NOTE: (1)
    • Parameter 1: The sound ID to be played as choice one.
    • Parameter 2: The sound ID to be played as choice two.
    • Parameter 3: The sound ID to be played as choice three.
  • 10 = ACTION_T_RANDOM_EMOTE: Similar to the ACTION_T_EMOTE action, when this action is activated, it will choose at random an emote ID to emote visually. This action needs all three parameters to be filled and it will pick a random entry from the three. NOTE: (1)
    • Parameter 1: The emote ID that the creature should perform as choice one.
    • Parameter 2: The emote ID that the creature should perform as choice two.
    • Parameter 3: The emote ID that the creature should perform as choice three.
  • 11 = ACTION_T_CAST: When activated, the creature will cast a spell specified by a spell ID on a target specified by the target type.
    • Parameter 1: The spell ID to use for the cast. The value used in this field needs to be a valid spell ID.
    • Parameter 2: The target type defining who the creature should cast on. The value in this field needs to be a valid target type as specified in the reference tables below.
    • Parameter 3: This field can only be 0 or 1. If it is 1, then the spell cast will interrupt any spells that are already in the progress of being casted; otherwise if the creature is already casting a spell and this field is 0, then this action will be skipped.
  • 12 = ACTION_T_SUMMON: When activated, the creature will summon another creature at the same spot as itself that will attack the specified target.
    • Parameter 1: The creature template ID to be summoned. The value here needs to be a valid creature template ID.
    • Parameter 2: The target type defining who the summoned creature will attack. The value in this field needs to be a valid target type as specified in the reference tables below. NOTE: Using target type 0 will cause the summoned creature to not attack anyone.
    • Parameter 3: The duration until the summoned creature should be unsummoned. The value in this field is in milliseconds or 0. If zero, then the creature will not be unsummoned until it leaves combat, but only works with t_type !=0.
  • 13 = ACTION_T_THREAT_SINGLE_PCT: When activated, this action will modify the threat of a target in the creature’s threat list by the specified percent.
    • Parameter 1: Threat percent that should be modified. The value in this field can range from -100 to +100. If it is negative, threat will be taken away and if positive, threat will be added.
    • Parameter 2: The target type defining on whom the threat change should occur. The value in this field needs to be a valid target type as specified in the reference tables below.
  • 14 = ACTION_T_THREAT_ALL_PCT: When activated, this action will modify the threat for everyone in the creature’s threat list by the specified percent.
    • Parameter 1: The percent that should be used in modifying everyone’s threat in the creature’s threat list. The value here can range from -100 to +100. NOTE: Using -100 will cause the creature to reset everyone’s threat to 0 so that everyone has the same amount of threat. It does NOT make any changes as to who is in the threat list.
  • 15 = ACTION_T_QUEST_EVENT: When activated, this action will satisfy the external completion requirement for the quest for the specified target defined by the target type. This action can only be used with player targets so it must be ensured that the target type will point to a player.
    • Parameter 1: The quest template ID. The value here must be a valid quest template ID. Furthermore, the quest should have SpecialFlags | 2 as it would need to be completed by an external event which is the activation of this action.
    • Parameter 2: The target type defining whom the quest should be completed for. The value in this field needs to be a valid target type as specified in the reference tables below.
  • 16 = ACTION_T_CASTCREATUREGO: When activated, this action will call CastedCreatureOrGO() function for the player. It can be used to give quest credit for casting a spell on the creature.
    • Parameter 1: The quest template ID. The value here must be a valid quest template ID.
    • Parameter 2: The spell ID to use to simulate the cast. The value used in this field needs to be a valid spell ID.
    • Parameter 3: The target type defining whom the quest credit should be given to. The value in this field needs to be a valid target type as specified in the reference tables below.
  • 17 = ACTION_T_SET_UNIT_FIELD: When activated, this action can change the target’s unit field values. More information on the field value indeces can be found at character data data.
    • Parameter 1: The index of the field number to be changed. Use character data data for a list of indeces and what they control. Note that a creature shares the same indeces with a player except for the PLAYER_* ones.
    • Parameter 2: The new value to be put in the field.
    • Parameter 3: The target type defining for whom the unit field should be changed. The value in this field needs to be a valid target type as specified in the reference tables below.
  • 18 = ACTION_T_SET_UNIT_FLAG: When activated, this action changes the target’s flags by adding (turning on) more flags. For example, this action can make the creature unattackable/unselectable if the right flags are used.
    • Parameter 1: The flag(s) to be set. Multiple flags can be set by using bitwise-OR on them (adding them together).
    • Parameter 2: The target type defining for whom the flags should be changed. The value in this field needs to be a valid target type as specified in the reference tables below.
  • 19 = ACTION_T_REMOVE_UNIT_FLAG: When activated, this action changes the target’s flags by removing (turning off) flags. For example, this action can make the creature normal after it was unattackable/unselectable if the right flags are used.
    • Parameter 1: The flag(s) to be removed. Multiple flags can be set by using bitwise-OR on them (adding them together).
    • Parameter 2: The target type defining for whom the flags should be changed. The value in this field needs to be a valid target type as specified in the reference tables below.
  • 20 = ACTION_T_AUTO_ATTACK: This action controls whether or not the creature should stop or start the auto melee attack.
    • Parameter 1: If zero, then the creature will stop its melee attacks. If non-zero, then the creature will either continue its melee attacks (the action would then have no effect) or it will start its melee attacks on the target with the top threat if its melee attacks were previously stopped.
  • 21 = ACTION_T_COMBAT_MOVEMENT: This action controls whether or not the creature will always move towards its target.
    • Parameter 1: If zero, then the creature will stop moving towards its victim (if its victim gets out of melee range) and will be stationary. If non-zero, then the creature will either continue to follow its victim (the action would have no effect) or it will start to follow the target with the top threat if its movement was disabled before.
  • 22 = ACTION_T_SET_PHASE: When activated, this action sets the creature’s event to the specified value.
    • Parameter 1: The new phase to set the creature in. This number must be an integer between 0 and 31 inclusive.
  • 23 = ACTION_T_INC_PHASE: When activated, this action will increase (or decrease) the current creature’s phase.
    • Parameter 1: The number of phases to increase or decrease. Use negative values to decrease the current phase. After increasing or decreasing the phase by this action, the current phase must not be lower than 0 or exceed 31.
  • 24 = ACTION_T_EVADE: When activated, the creature will immediately exit out of combat, clear its threat list, and move back to its spawn point. Basically, this action will reset the whole encounter.
  • 25 = ACTION_T_FLEE: When activated, the creature will try to flee from combat. Currently this is done by it casting a fear-like spell on itself called "Run Away".
  • 26 = ACTION_T_QUEST_EVENT_ALL: This action does the same thing as the ACTION_T_QUEST_EVENT does but it does it for all players in the creature’s threat list. Note that if a player is not in its threat list for whatever reason, he/she won’t get the quest completed.
    • Parameter 1: The quest ID to finish for everyone.
  • 27 = ACTION_T_CASTCREATUREGO_ALL: This action does the same thing as the ACTION_T_CASTCREATUREGO does but it does it for all players in the creature’s threat list. Note that if a player is not in its threat list for whatever reason, he/she won’t receive the cast emulation.
    • Parameter 1: The quest template ID.
    • Parameter 2: The spell ID used to simulate the cast.
  • 28 = ACTION_T_REMOVEAURASFROMSPELL: This action will remove all auras from a specific spell from the target.
    • Parameter 1: The target type defining for whom the unit field should be changed. The value in this field needs to be a valid target type as specified in the reference tables below.
    • Parameter 2: The spell ID whose auras will be removed.
  • 29 = ACTION_T_RANGED_MOVEMENT: This action changes the movement type generator to ranged type using the specified values for angle and distance. Note that specifying zero angle and distance will make it just melee instead.
    • Parameter 1: The distance the mob should keep between it and its target.
    • Parameter 2: The angle the mob should use.
  • 30 = ACTION_T_RANDOM_PHASE: Randomly sets the phase to one from the three parameter choices. NOTE: (1)
    • Parameter 1: A possible random phase choice.
    • Parameter 2: A possible random phase choice.
    • Parameter 3: A possible random phase choice.
  • 31 = ACTION_T_RANDOM_PHASE_RANGE: Randomly sets the phase between a range of phases controlled by the parameters.
    • Parameter 1: The minimum of the phase range.
    • Parameter 2: The maximum of the phase range. The number here must be greater than the one in parameter 1.
  • 32 = ACTION_T_SUMMON: Summons a creature using the data specified in the separate summons table.
    • Parameter 1: The creature template ID to be summoned. The value here needs to be a valid creature template ID.
    • Parameter 2: The target type defining who the summoned creature will attack. The value in this field needs to be a valid target type as specified in the reference tables below. NOTE: Using target type 0 will cause the summoned creature to not attack anyone.
    • Parameter 3: The summon ID from the eventai_summons table controlling the position (and spawntime) where the summoned mob should be spawned at.
  • 33 = ACTION_T_KILLED_MONSTER: When activated, this action will call KilledMonster() function for the player. It can be used to give creature credit for killing a creature (note that it can be ANY creature including certain quest specific triggers). In general if the quest is set to be accompished on different creatures (e.g. "Credit" templates).
    • Parameter 1: The creature template ID. The value here must be a valid creature template ID.
    • Parameter 2: The target type defining whom the quest kill count should be given to. The value in this field needs to be a valid target type as specified in the reference tables below.
  • 34 = ACTION_T_SET_INST_DATA: Sets data for the instance. Note that this will only work when the creature is inside an instantiable zone that has a valid script (ScriptedInstance) assigned.
    • Parameter 1: The field to change in the instance script. Again, this field needs to be a valid field that has been already defined in the instance’s script.
    • Parameter 2: The value to put at that field index. The number here must be a valid 32 bit number.
  • 35 = ACTION_T_SET_INST_DATA64: Sets GUID (64 bits) data for the instance based on the target. Note that this will only work when the creature is inside an instantiable zone that has a valid script (ScriptedInstance) assigned.
    • Parameter 1: The field to change in the instance script. Again, this field needs to be a valid field that has been already defined in the instance’s script.
    • Parameter 2: The target type to use to get the GUID that will be stored at the field index. The value in this field needs to be a valid target type as specified in the reference tables below.
  • 36 = ACTION_T_UPDATE_TEMPLATE: This function temporarily changes creature entry to new entry, display is changed, loot is changed, but AI is not changed. At respawn creature will be reverted to original entry.
    • Parameter 1: The creature template ID. The value here must be a valid creature template ID.
    • Parameter 2: Use model_id from team : Alliance(0) or Horde (1).
  • 37 = ACTION_T_DIE: Kills the creature
  • 38 = ACTION_T_ZONE_COMBAT_PULSE: Places all players within the instance into combat with the creature. Only works in combat and only works inside of instances.
  • 39 = ACTION_T_CALL_FOR_HELP: Call any friendly creatures (if its not in combat/etc) in radius attack creature target.
    • Parameter 1: Radius from creature.
  • 40 = ACTION_T_SET_SHEATH: Let set sheath state for creature (0-no weapon show (not used mostly by creatures), 1-melee weapon show, 2-ranged weapon show)
    • Parameter 1: Sheath state of the creature.
  • 41 = ACTION_T_FORCE_DESPAWN: Despawns the creature.
    • Parameter 1: Despawn delay.

(1) = Use -1 to specify that if this param is picked to do nothing. Random is constant between actions within an event. So if you have a random Yell and a random Sound they will match up (ex: param2 with param2)

Reference Tables


All of the events, actions, and target types are summarized in tabular format for convenience purposes and fast lookup. NU = Not Used; * – optional

Events

ID Name Param 1 Param 2 Param 3 Param 4 Description
0 EVENT_T_TIMER InitialMin InitialMax RepeatMin RepeatMax COMBAT ONLY – Expires first between (Param1) and (Param2) and then between every (Param3) and (Param4).
1 EVENT_T_TIMER_OOC InitialMin InitialMax RepeatMin RepeatMax OUT OF COMBAT – Expires first between (Param1) and (Param2) and then between every (Param3) and (Param4).
2 EVENT_T_HP HPMax% HPMin% RepeatMin RepeatMax Expires when HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4).
3 EVENT_T_MANA ManaMax% ManaMin% RepeatMin RepeatMax Expires once Mana% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4).
4 EVENT_T_AGGRO n/a n/a n/a n/a Expires upon initial aggro (does not repeat).
5 EVENT_T_KILL RepeatMin RepeatMax n/a n/a Expires upon killing a player. Will repeat every (Param1) and (Param2).
6 EVENT_T_DEATH n/a n/a n/a n/a Expires upon Death.
7 EVENT_T_EVADE n/a n/a n/a n/a Expires upon creature EnterEvadeMode().
8 EVENT_T_SPELLHIT SpellID School RepeatMin RepeatMax Expires upon Spell hit. If (param1) is set will only expire on that spell. If (param2) will only expire on spells of that school. Will repeat every (Param3) and (Param4) .
9 EVENT_T_RANGE MinDist MaxDist RepeatMin RepeatMax Expires when the highest threat target distance is greater than (Param1) and less than (Param2). Will repeat every (Param3) and (Param4) .
10 EVENT_T_OOC_LOS NoHostile NoFriendly RepeatMin RepeatMax Expires when a Player moves within visible distance to creature. Does not expire for Hostile Players if (Param1) is not 0. Does not expire for Friendly Players if (Param2) is not 0. Will repeat every (Param3) and (Param4) . Does not expire for creatures or pet or when the creature is in combat.
11 EVENT_T_SPAWNED n/a n/a n/a n/a Expires at initial spawn and at creature respawn (useful for setting ranged movement type)
12 EVENT_T_TARGET_HP HPMax% HPMin% RepeatMin RepeatMax Expires when Current Target’s HP is between (Param1) and (Param2). Will repeat every (Param3) and (Param4) .
13 EVENT_T_TARGET_CASTING RepeatMin RepeatMax n/a n/a Expires when the player is casting a spell. Will repeat every (Param1) and (Param2) .
14 EVENT_T_FRIENDLY_HP HPDeficit Radius RepeatMin RepeatMax Expires when a friendly unit in radius(param2) has at least (param1) hp missing. Will repeat every (Param3) and (Param4) .
15 EVENT_T_FRIENDLY_IS_CC DispelType Radius RepeatMin RepeatMax Expires when a friendly unit is Crowd controlled within the given radius (param2). Will repeat every (Param3) and (Param4) .
16 EVENT_T_MISSING_BUFF SpellId Radius RepeatMin RepeatMax Expires when a friendly unit is missing aura’s given by spell (param1) within radius (param2). Will repeat every (Param3) and (Param4) .
17 EVENT_T_SUMMONED_UNIT CreatureId RepeatMin RepeatMax n/a Expires after creature with entry(Param1) is spawned or for all spawns if param1 = 0. Will repeat every (Param2) and (Param3) .
18 EVENT_T_TARGET_MANA ManaMax% ManaMin% RepeatMin RepeatMax
21 EVENT_T_REACHED_HOME n/a n/a n/a n/a Expires when creature reach it’s home(spawn) location after Evade.
22 EVENT_T_RECEIVE_EMOTE EmoteId Condition]] CondValue1 CondValue2 Expires when creature receive emote with text emote id(enum TextEmotes). Condition can be defined. If set, then most conditions has additional value (see enum ConditionType)
23 EVENT_T_BUFFED SpellId AmmountInStack RepeatMin RepeatMax Expires when creature have spell (Param1) auras applied stack greater or equal provided in Param2 amount. Will repeat every (Param3) and (Param4).
24 EVENT_T_TARGET_BUFFED SpellId AmmountInStack RepeatMin RepeatMax Expires when target unit have spell (Param1) auras applied stack greater or equal provided in Param2 amount. Will repeat every (Param3) and (Param4).
25 EVENT_T_SUMMONED_JUST_DIED CreatureId RepeatMin RepeatMax n/a Expires after creature with entry = (Param1) is die (Param1 = 0 means all spawns). Will repeat every (Param2) and (Param3).
26 EVENT_T_SUMMONED_JUST_DESPAWN CreatureId RepeatMin RepeatMax n/a Expires before creature with entry = (Param1) is despawn (Param1 = 0 means all spawns). Will repeat every (Param2) and (Param3).

Actions

ID Name Param 1 Param 2 Param 3 Description
1 ACTION_T_SAY -TextId1, -TextId2, -TextId3 Displays the -TextId as defined. In case -TextId2 and optionally -TextId3, the output will be randomized. Type text are defined in the text table itself(say, yell, whisper, etc) along with other options for the text. All values are required to be negative.
2 ACTION_T_YELL UNUSED UNUSED UNUSED UNUSED
3 ACTION_T_TEXTEMOTE UNUSED UNUSED UNUSED UNUSED
4 ACTION_T_SOUND Sound ID NU NU Creature plays sound
5 ACTION_T_EMOTE Emote ID NU NU Creature does visual emote
6 ACTION_T_RANDOM_SAY UNUSED UNUSED UNUSED UNUSED
7 ACTION_T_RANDOM_YELL UNUSED UNUSED UNUSED UNUSED
8 ACTION_T_RANDOM_TEXTEMOTE UNUSED UNUSED UNUSED UNUSED
9 ACTION_T_RANDOM_SOUND Sound ID 1 Sound ID 2 Sound ID 3 Picks a sound ID at random and plays it; -1 = action skipped if chosen
10 ACTION_T_RANDOM_EMOTE Emote ID 1 Emote ID 2 Emote ID 3 Picks an emote ID at random and does visual emote; -1 = action skipped if chosen
11 ACTION_T_CAST Spell ID T-Type]] Cast Flag Casts spell on a target with specified cast flags (see table below).
12 ACTION_T_SUMMON Creature ID T-Type]] Duration* Summons a creature at itself for a given duration (infinite if zero, only with t_type != 0) that will attack a target.
13 ACTION_T_THREAT_SINGLE_PCT Threat % T-Type]] NU Modifies the target’s threat by a percent
14 ACTION_T_THREAT_ALL_PCT Threat % NU NU Modifies everyone’s threat by a percent
15 ACTION_T_QUEST_EVENT Quest ID T-Type]] NU Satisfies external script objective for a quest for the target (must be a player)
16 ACTION_T_CASTCREATUREGO Quest ID Spell ID T-Type]] Emulates spell cast on the creature for the target (must be a player)
17 ACTION_T_SET_UNIT_FIELD index ]] Value T-Type]] Sets unit field at the index to the value given for the target
18 ACTION_T_SET_UNIT_FLAG Flag(s) T-Type]] NU Sets flag(s) on the target
19 ACTION_T_REMOVE_UNIT_FLAG Flag(s) T-Type]] NU Removes flag(s) from the target
20 ACTION_T_AUTO_ATTACK Boolean NU NU If 0, stops auto melee; else continues/starts it
21 ACTION_T_COMBAT_MOVEMENT Boolean NU NU If 0, stops combat movement; else continues/starts it
22 ACTION_T_SET_PHASE Phase # NU NU Sets current phase to number given
23 ACTION_T_INC_PHASE Number NU NU Increments (or decrements) the phase by given number.
24 ACTION_T_EVADE NU NU NU Force creature reset. Exit combat + lose threat
25 ACTION_T_FLEE NU NU NU Force creature to flee from combat
26 ACTION_T_QUEST_EVENT_ALL Quest ID NU NU Satisfies external objective for a quest for all players in threat list
27 ACTION_T_CASTCREATUREGO_ALL Quest ID Spell ID NU Emulates spell cast on creature for all players in threat list
28 ACTION_T_REMOVEAURASFROMSPELL T-Type]] Spell ID NU Removes all auras from a spell ID from the target.
29 ACTION_T_RANGED_MOVEMENT Distance Angle NU Uses ranged movement generator keeping the creature at a distance.
30 ACTION_T_RANDOM_PHASE Phase 1 Phase 2 Phase 3 Randomly chooses a phase from the list of three phases.
31 ACTION_T_RANDOM_PHASE_RANGE Min Phase Max Phase NU Chooses a random phase in the range specified.
32 ACTION_T_SUMMON Creature ID T-Type]] Summon ID Summons a creature at the coords specified for the given summon id that will attack a target.
33 ACTION_T_KILLED_MONSTER Creature ID T-Type]] NU Simulates a kill for a mob of ID given for the player from the target type.
34 ACTION_T_SET_INST_DATA Field]] Value NU Sets new value for the field given in the instance script.
35 ACTION_T_SET_INST_DATA64 Field]] T-Type]] NU Stores target’s GUID at the field given in the instance script.
36 ACTION_T_UPDATE_TEMPLATE Entry Fraction NU Temporarily changes creature entry to new entry.
37 ACTION_T_DIE NU NU NU Kills the creature.
38 ACTION_T_ZONE_COMBAT_PULSE NU NU NU Places all players within the instance into combat with the creature. Only works in combat and only works inside of instances.
39 ACTION_T_CALL_FOR_HELP Radius NU NU Call any friendly creatures (if its not in combat/etc) in radius attack creature target.
40 ACTION_T_SET_SHEATH Sheath NU NU Let set sheath state for creature (0-no weapon show (not used mostly by creatures), 1-melee weapon show, 2-ranged weapon show)
41 ACTION_T_FORCE_DESPAWN delay NU NU Despawns the creature, If 0 despawn instant, other despawn after delay (in ms)

Target Types

(T-Type)

ID Name Description
0 TARGET_T_SELF Targets itself
1 TARGET_T_HOSTILE Targets the current victim (usually the one with the most threat)
2 TARGET_T_HOSTILE_SECOND_AGGRO Targets the unit with the second most threat in the threat list
3 TARGET_T_HOSTILE_LAST_AGGRO Targets the unit with the least threat in the threat list
4 TARGET_T_HOSTILE_RANDOM Targets a random unit from the threat list
5 TARGET_T_HOSTILE_RANDOM_NOT_TOP Targets a random unit from the threat list excluding the one with the most threat
6 TARGET_T_ACTION_INVOKER Targets the unit that caused the event; only for certain events only.

Cast Flags

Bit / Value Name Description
0 / 1 CAST_INTURRUPT_PREVIOUS Interrupts any previous spell casting.
1 / 2 CAST_TRIGGERED Forces the cast to be instant and ignores any mana/reagents requirements.
2 / 4 CAST_FORCE_CAST Forces spell to cast even if the target is possibly out of range or the creature is possibly out of mana
3 / 8 CAST_NO_MELEE_IF_OOM Prevents creature from entering melee if out of mana or out of range
4 / 16 CAST_FORCE_TARGET_SELF Forces the target to cast this spell on itself
5 / 32 CAST_AURA_NOT_PRESENT Only casts the spell on the target if the target does not have the aura from that spell on itself already.

Condition Type

(For Event_type 22)

Condition Value 1 Value 2* Description
0 None 0 0 Nothing.
1 Aura SpellID "effindex" If the SpellID’s aura is on you.
2 Item ItemID Amount If you have the item in your inventory.
3 Item Equipped ItemId Amount If you have the item equipped on your character.
4 Zone ID ZoneID 0 Taken from AreaTable.dbc.
5 Reputation FactionID Minimum Rank Taken from FactionTemplate.dbc. Exalted is 42000.
6 Team Team# 0 In "Team#" use 469 if alliance, 67 if Horde.
7 Skill SkillID Min Amount Values taken from SkillLine.dbc.
8 Quest Rewarded QuestID 0 If you have already completed that QuestID.
9 Quest Taken QuestID 0 If you are currently on that QuestID.
12 Active Event EventID 0 This is not from your database. This value is from the DBC file enum HolidayIds.

* – If the value is listed as 0, then leave it as 0.

Event Flags

Bit / Value Name Description
0 / 1 EFLAG_REPEATABLE Event repeats (Does not repeat if this flag is not set)
1/2 EFLAG_NORMAL Event only occurs in Normal instance difficulty
2/4 EFLAG_HEROIC Event only occurs in Heroic instance difficulty
5/32 EFLAG_RANDOM Random use action1, 2, or 3
7 / 128 EFLAG_DEBUG_ONLY Not yet impletmented!

Instance_Data_Flags

Value Type Description
1 aggro Creature SetInCombat
2 evade Creature remove from Combat
3 death Creature just die
4 special Need for more as one enemy in a fight (like 4 horseman)
Clone this wiki locally