creature_ai_scripts - cmangos/issues GitHub Wiki
Back to world database list of tables.
creature_ai_scripts for EventAI (ACID) scripted
NPCs
creature_ai_summons for Summon
IDs used in ACTION_T_SUMMON_ID (32)
The Manual-like and most-recent documentation for EventAI can be found in doc/EventAI.txt
ScriptDev2 was integrated into cmangos on 04 sept 2015 and enables us to handle DB-based scripting 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 referenced like this for the rest of this guide. A basic EventAI script works with and requires only two pieces of information: When it happens and What happens when.
The first piece of information (the When it happens) will be referred to as the event.
The second piece of information (the What happens when) will be
referred to as the action.
Currently, a single EventAI script entry can have up to three actions.
Anyone that wants to create entries for the EventAI script needs to answer the two questions above.
Some events will only occur once while others can be timed so that they occur at a specified interval.
Field | Type | Null | Key | Default | Description |
---|---|---|---|---|---|
id | NO | PRI | None |
creature_template .entry * 100 + (1 – 99), Order by Priority (lower higher prio) |
|
creature_id | NO | CreatureEntry | |||
event_type | NO | Event | |||
event_inverse_phase_mask | NO | PhaseMask | |||
event_chance | NO | Chance. Using a value of 0 in this field will make the event never occur. Values are from 0 to 100. | |||
event_flags | NO | 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_param | NO | event_param1-3 for Event | |||
action_type | NO | action_type1-3 for Event | |||
action_param | NO | action_param1-3 for action_type1-3 | |||
comment | comment describing the actions performed on event |
Example:
let’s say that a certain creature using EventAI 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 phase 2 (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 phase 0 and phase 3. This would mean that we need to ignore phase 1 and 2, 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.
EventAI can also 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 EventAI 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).
All of the events, EventFlags, actions and possible targets are summarized and described below.
- NU = Not Used*
- IC = In Combat Only*
- OOC = Out Of Combat Only*
- US = Unsupported
ID | Name | Param1 | Param2 | Param3 | Param4 | Param5 | Param6 | Description |
---|---|---|---|---|---|---|---|---|
0 | EVENT_T_TIMER_IN_COMBAT | InitialMin | InitialMax | RepeatMin | RepeatMax | IC - Expires first between (Param1) and (Param2). Will repeat every (Param3) and (Param4) | ||
1 | EVENT_T_TIMER_OOC | InitialMin | InitialMax | RepeatMin | RepeatMax | OOC - Expires first between (Param1) and (Param2). Will repeat every (Param3) and (Param4) | ||
2 | EVENT_T_HP | HPMax% | HPMin% | RepeatMin | RepeatMax | allowOutOfCombat | IC - Expires when HP% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4) | |
3 | EVENT_T_MANA | ManaMax% | ManaMin% | RepeatMin | RepeatMax | allowOutOfCombat | IC - Expires when Mana% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4) | |
4 | EVENT_T_AGGRO | NU | NU | NU | NU | Expires on Aggro | ||
5 | EVENT_T_KILL | RepeatMin | RepeatMax | PlayerOnly | NU | Expires when creature kills a unit (Player only if Param3 = 1). Will repeat every (Param1) and (Param2) | ||
6 | EVENT_T_DEATH | conditionId | NU | NU | NU | Expires on Death | ||
7 | EVENT_T_EVADE | NU | NU | NU | NU | Expires on Evade | ||
8 | EVENT_T_SPELLHIT | spellId | schoolMask | RepeatMin | RepeatMax | Expires on (Param1) spellId or on (Param2) schoolMask spellhit. Will repeat every (Param3) and (Param4) | ||
9 | EVENT_T_RANGE | MinDist | MaxDist | RepeatMin | RepeatMax | Expires when current target distance is greater than (Param1) and less than (Param2). Will repeat every (Param3) and (Param4) | ||
10 | EVENT_T_OOC_LOS | noHostile | maxRange | RepeatMin | RepeatMax | playerOnly | conditionId | OOC - Expires when a unit (friendly only if Param1 = 1) moves within (Param2) distance to creature. Will repeat every (Param3) and (Param4) |
11 | EVENT_T_SPAWNED | condition (1 = map / 2 = area) | conditionValue1 MapID or AreaID | NU | NU | Expires on Spawn, can be conditioned to Map or Area | ||
12 | EVENT_T_TARGET_HP | HPMax% | HPMin% | RepeatMin | RepeatMax | allowOutOfCombat | Expires when current target HP% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4) | |
13 | EVENT_T_TARGET_CASTING | RepeatMin | RepeatMax | NU | NU | Expires when current target is casting a spell. Will repeat every (Param1) and (Param2) | ||
14 | EVENT_T_FRIENDLY_HP | HPDeficit | Radius | RepeatMin | RepeatMax | Expires when a friendly unit (Target = 12) has at least (param1) HP missing in (param2) radius. Will repeat every (Param3) and (Param4) | ||
15 | EVENT_T_FRIENDLY_IS_CC | DispelType (US) | Radius | RepeatMin | RepeatMax | Expires when a friendly unit (Target = 12) is crowd controlled in (param2) radius. Will repeat every (Param3) and (Param4) | ||
16 | EVENT_T_FRIENDLY_MISSING_BUFF | spellId | Radius | RepeatMin | RepeatMax | inCombat (0 = Only in combat, 1 = Out and in combat, 2 = Only out of combat) | Expires when a friendly unit (Target = 12) is missing aura given by (param1) spellId in (param2) radius. Will repeat every (Param3) and (Param4) | |
17 | EVENT_T_SUMMONED_UNIT | CreatureEntry | RepeatMin | RepeatMax | NU | Expires when creature with (Param1) CreatureEntry spawned or for all spawns if (Param1 = 0). Will repeat every (Param2) and (Param3) | ||
18 | EVENT_T_TARGET_MANA | ManaMax% | ManaMin% | RepeatMin | RepeatMax | allowOutOfCombat | Expires when current target MP% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4) | |
21 | EVENT_T_REACHED_HOME | NU | NU | NU | NU | Expires on Reached Home (after Evade) | ||
22 | EVENT_T_RECEIVE_EMOTE | TextEmote | ConditionId | NU | NU | Expires when creature receives TextEmotes from player paired with a potential condition (Param 2) | ||
23 | EVENT_T_AURA | spellId | AmountInStack | RepeatMin | RepeatMax | Expires when creature has spell (Param1) aura stacks applied greater or equal to (Param2) amount. Will repeat every (Param3) and (Param4) | ||
24 | EVENT_T_TARGET_AURA | spellId | AmountInStack | RepeatMin | RepeatMax | Expires when current target have spell (Param1) aura stacks applied greater or equal to (Param2) amount. Will repeat every (Param3) and (Param4) | ||
25 | EVENT_T_SUMMONED_JUST_DIED | CreatureEntry | RepeatMin | RepeatMax | NU | Expires after creature with (Param1) CreatureEntry died or for all spawns if (Param1 = 0). Will repeat every (Param2) and (Param3) | ||
26 | EVENT_T_SUMMONED_JUST_DESPAWN | CreatureEntry | RepeatMin | RepeatMax | NU | Expires before creature with (Param1) CreatureEntry despawned or for all spawns if (Param1 = 0). Will repeat every (Param2) and (Param3) | ||
27 | EVENT_T_MISSING_AURA | spellId | AmountInStack | RepeatMin | RepeatMax | Expires when creature have spell (Param1) aura stacks applied less than (Param2) amount. Will repeat every (Param3) and (Param4) | ||
28 | EVENT_T_TARGET_MISSING_AURA | spellId | AmountInStack | RepeatMin | RepeatMax | Expires when current target have spell (Param1) aura stacks applied less than (Param2) amount. Will repeat every (Param3) and (Param4) | ||
29 | EVENT_T_TIMER_GENERIC | InitialMin | InitialMax | RepeatMin | RepeatMax | Expires first between (Param1) and (Param2). Will repeat every (Param3) and (Param4) | ||
30 | EVENT_T_RECEIVE_AI_EVENT | AIEventType | Sender-Entry | unused1 | unused2 | Expires when the creature receives an (Param1) AIEventType, sent by (Param2 != 0) Sender-Entry. If (Param2 = 0) then sent by any creature | ||
31 | EVENT_T_ENERGY | EnergyMax% | EnergyMin% | RepeatMin | RepeatMax | allowOutOfCombat | Expires when Energy% is between (Param1) and (Param2). Will repeat every (Param3) and (Param4) if Condition: between (Param1) and (Param2) are still met | |
32 | EVENT_T_SELECT_ATTACKING_TARGET | MinRange | MaxRange | RepeatMin | RepeatMax | Expires when threat table has target with distance between (Param1) and (Param2). Will repeat every (Param3) and (Param4) if Condition: between (Param1) and (Param2) are still met | ||
33 | EVENT_T_FACING_TARGET | Back(0)OrFront(1) | unused | RepeatMin | RepeatMax | Expires when creature is (behind = 0 / infront = 1 of target. Will repeat every (Param3) and (Param4) if Condition: (Param1) is still met | ||
34 | EVENT_T_SPELLHIT_TARGET | SpellID | Schoolmask | RepeatMin | RepeatMax | Expires upon Spell Hit of the NPC. When (param1) is set, it is the specific Spell ID used as the trigger. With (param2) specified, the expiration is limited to specific spell schools (–1 for all) and Spell ID value is ignored. Will repeat Event Conditions Check between every (Param3) and (Param4). Only A Spell ID or Spell School may be Specified but NOT both | ||
35 | EVENT_T_DEATH_PREVENTED | unused | NU | NU | NU | Expires when Death prevention (Action 42) kicks in | ||
36 | EVENT_T_TARGET_NOT_REACHABLE | eventId | eventId | NU | NU | |||
37 | EVENT_T_SPELL_CAST | SpellId | 0 | NU | NU | on successful spell cast |
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.
ID | Name | Param 1 | Param 2 | Param 3 | Description |
---|---|---|---|---|---|
0 | ACTION_T_NONE | NU | NU | NU | Does nothing! |
1 | ACTION_T_TEXT | broadcast_text1 | broadcast_text2 | broadcast_text3 | broadcast_text#Id. Optionally custom_text.#entry can be used as negative values |
2 | ACTION_T_SET_FACTION | factionId | TemporaryFactionFlags | NU | Changes faction for a creature. When (Param1) is zero, creature will revert to it’s default faction. Flags will determine when faction is restored to default (evade, respawn etc) |
3 | ACTION_T_MORPH_TO_ENTRY_OR_MODEL | CreatureEntry | modelId | NU | CreatureEntry OR modelId (param2) (or 0 for both to demorph) |
4 | ACTION_T_SOUND | SoundId | NU | NU | Creature plays Sound. IDs are contained in the DBC files |
5 | ACTION_T_EMOTE | emoteId | NU | NU | Creature does visual emote. IDs are contained in the DBC files |
6 | ACTION_T_RANDOM_SAY | NU | NU | NU | deprecated |
7 | ACTION_T_RANDOM_YELL | NU | NU | NU | deprecated |
8 | ACTION_T_RANDOM_TEXTEMOTE | NU | NU | NU | deprecated |
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 | spellId | target | enum CastFlags | Creature cast spell on a target with specified castFlags |
12 | ACTION_T_SPAWN | CreatureEntry | target | Duration in milliseconds | Creature spawns a creature with (Param1) CreatureEntry at Target for a given duration (infinite if zero) |
13 | ACTION_T_THREAT_SINGLE_PCT | Threat % | target | NU | Modifies target threat by a percent (–100 to +100) |
14 | ACTION_T_THREAT_ALL_PCT | Threat % | NU | NU | Modifies everyone’s threat by a percent (–100 to +100), –101 will cause Evade |
15 | ACTION_T_QUEST_EVENT | Quest ID | target | NU | Satisfies external script objective for a quest for the target (MUST be a player) |
16 | ACTION_T_CAST_EVENT | CreatureEntry | spellId | target | Emulates spell cast on the creature for the target (must be a player) [hacky] |
17 | ACTION_T_SET_UNIT_FIELD | EUnitFields | Value | target | DEPRECATED (Use dbscript for unit or npc flags instead, notify about any other needs to the devs) Sets unit field at the index to the value given for the target. More information on the field value indeces can be found at character data data |
18 | ACTION_T_SET_UNIT_FLAG | UnitFlags | target | NU | Sets flag(s) on the target |
19 | ACTION_T_REMOVE_UNIT_FLAG | UnitFlags | target | NU | Removes flag(s) from the target |
20 | ACTION_T_AUTO_ATTACK | Boolean | NU | NU | If 0 cant melee, else (1) continues/starts it |
21 | ACTION_T_COMBAT_MOVEMENT | Boolean | NU | NU | If 0 stops movement, else (1) continues/starts it |
22 | ACTION_T_SET_PHASE | Phase # | NU | NU | Sets current phase to number given. This number must be an integer between 0 and 31 inclusive |
23 | ACTION_T_INC_PHASE | Number | NU | NU | deprecated, increments (or decrements) the phase by given number |
24 | ACTION_T_EVADE | CombatOnly | NU | NU | Force creature reset. 1 Exit combat + lose threat, 0 Evade |
25 | ACTION_T_FLEE_FOR_ASSIST | 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 similar to ACTION_T_QUEST_EVENT |
27 | ACTION_T_CAST_EVENT_ALL | Quest ID | spellId | NU | Emulates spell cast on creature for all players in threat list similar to ACTION_T_CAST_EVENT |
28 | ACTION_T_REMOVEAURASFROMSPELL | target | spellId | NU | Removes all auras from a spellId from the target |
29 | ACTION_T_RANGED_MOVEMENT | Distance | Angle | NU | creature sets ranged movement generator keeping the creature at a distance. Note that specifying zero angle and distance will make it just melee instead |
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 + 1 | NU | Chooses a random phase in the range specified. This number must be an integer between 0 and 31 inclusive |
32 | ACTION_T_SUMMON_ID | CreatureEntry | target | Summon ID | Summons a creature using the data specified in the separate creature_ai_summons table |
33 | ACTION_T_KILLED_MONSTER | CreatureEntry | target | NU | Simulates a kill for a CreatureEntry given for the player from the target |
34 | ACTION_T_SET_INST_DATA | Field | 32 bit Value | NU | 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. |
35 | ACTION_T_SET_INST_DATA64 | Field | target | NU | Stores target’s GUID at the field given in the instance script |
36 | ACTION_T_UPDATE_TEMPLATE | CreatureEntry | Faction | NU | 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. Alliance(0) or Horde (1) |
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 | SheathState | NU | NU | Set SheathState for creature (0-no weapon show (not used mostly by creatures), 1-melee weapon show, 2-ranged weapon show) |
41 | ACTION_T_FORCE_DESPAWN | msDelay | NU | NU | Despawns the creature, If 0 despawn instant, other despawn after delay (in ms) |
42 | ACTION_T_SET_INVINCIBILITY_HP_LEVEL | Value | HP_Level(0) or HP_Percent(1) | NU | Set minimum health level for creature that can be set at damage as flat value or percent from max health |
43 | ACTION_T_MOUNT_TO_ENTRY_OR_MODEL | CreatureEntry | modelId | NU | CreatureEntry (param1) or modelId (param2) or 0 for both to dismount |
44 | ACTION_T_CHANCED_TEXT | Chance | broadcast_text1 | broadcast_text2 | deprecated, use 54! Chance to display broadcast_text during event. |
45 | ACTION_T_THROW_AI_EVENT | AIEventType | Radius | target | Throws an AIEventType (Param1) to friendly Npcs in range (Param2), Invoker of event is Target |
46 | ACTION_T_SET_THROW_MASK | EventTypeMask | NU | NU | Marks for which AIEvents the npc will throw AIEvents on its own. |
47 | ACTION_T_SET_STAND_STATE | UnitStandStateType | NU | NU | Set the UnitStandStateType (Param1) of the current creature |
48 | ACTION_T_CHANGE_MOVEMENT | MovementType | spawndist/PathId | NU | Change the creature MovementGeneratorType (Param1). If the movement type is Random Movement (1), the spawndist (Param2) must be provided. If the movement type is Waypoint Movement (2), (Param2) is PathId |
49 | RE_USE_ACTION_T_49 | NU | NU | NU | comment |
50 | ACTION_T_SET_REACT_STATE | ReactStates | NU | NU | Change ReactState of the creature |
51 | ACTION_T_PAUSE_WAYPOINTS | DoPause(1) UnPause(0) | NU | NU | Pause or unpause waypoints of creature. Pause 1, Unpause 0 |
52 | ACTION_T_INTERRUPT_SPELL | CurrentSpellTypes | NU | NU | Interrupt spell in given slot for creature |
53 | ACTION_T_START_RELAY_SCRIPT | RelayIDorTemplate | target | NU | Launches dbscripts_on_relay script, either static one, or when (Param1) is < 0 then random one chosen from dbscript_random_templates |
54 | ACTION_T_TEXT_NEW | broadcast_text | Target | dbscript_random_templates | Displays text, either static one or when (Param3) != 0, then random one chosen from dbscript_random_templates |
55 | ACTION_T_ATTACK_START | Target | NU | NU | Starts attacking Target |
56 | ACTION_T_DESPAWN_GUARDIANS | CreatureEntry | NU | NU | Despawns guardian with specified entry, or if 0 despawns all guardians |
57 | ACTION_T_SET_RANGED_MODE | RangeModeType | chaseDistance | NU | Enable RangeModeType, distance to chase at, NU |
58 | ACTION_T_SET_WALK | WalkSettingType | NU | NU | RUN_DEFAULT (0), WALK_DEFAULT (1), RUN_CHASE (2), WALK_CHASE (3) |
59 | ACTION_T_SET_FACING | target | Set (0), Reset (1) | NU | Sets facing, i.e. orientation to target, or resets it to last waypoint hit, or to respawn position |
60 | ACTION_T_SET_SPELL_SET | SetId | NU | NU | Set for possess |
61 | ACTION_T_SET_IMMOBILIZED_STATE | Apply | CombatOnly | NU | CombatOnly is autoremoved on combat stop (death, evade, despawn) |
62 | ACTION_T_SET_DESPAWN_AGGREGATION | Mask | Entry1 | Entry2 | Enable aggregation (despawn for summons) of guids for despawn on event (death, evade). To be used mostly on spawn. |
63 | ACTION_T_SET_IMMUNITY_SET | SetId | NU | NU | SetId - creature_immunities |
64 | ACTION_T_SET_FOLLOW_MOVEMENT | state | NU | NU | state - 0 off, 1 on |
Bit | Name | Description |
---|---|---|
1 | EFLAG_REPEATABLE | Event repeats (Does not repeat if this flag is not set) |
2 | EFLAG_NORMAL, EFLAG_DIFFICULTY_0 | Event only occurs in Normal instance difficulty + [wotlk: (10-Man Normal)] |
4 | EFLAG_HEROIC, EFLAG_DIFFICULTY_1 | Event only occurs in Heroic instance difficulty + [wotlk: (25-Man Normal)] |
8 | EFLAG_DIFFICULTY_2 | Event only occurs in [wotlk: (10-Man Heroic)] |
16 | EFLAG_DIFFICULTY_3 | Event only occurs in [wotlk (25-Man Heroic)] |
32 | EFLAG_RANDOM_ACTION | Random use action1, 2, or 3 |
64 | EFLAG_RESERVED_6 | Reserved |
128 | EFLAG_DEBUG_ONLY | Event only occurs in debug build |
256 | EFLAG_RANGED_MODE_ONLY | Event only occurs in ranged mode |
512 | EFLAG_MELEE_MODE_ONLY | Event only occurs in melee mode |
1024 | EFLAG_COMBAT_ACTION | Only one per cycle |
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. |
7 | TARGET_T_ACTION_INVOKER_OWNER | Targets unit who is responsible for Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_RECEIVE_EMOTE, EVENT_T_RECEIVE_AI_EVENT) |
8 | TARGET_T_HOSTILE_RANDOM_PLAYER | Targets Random Player on The Threat List |
9 | TARGET_T_HOSTILE_RANDOM_NOT_TOP_PLAYER | Targets Any Random Player Except Top Threat |
10 | TARGET_T_EVENT_SENDER | Creature who sent a received AIEvent - only triggered by EVENT_T_RECEIVE_AI_EVENT |
11 | TARGET_T_SPAWNER | Owner of unit if exists |
12 | TARGET_T_EVENT_SPECIFIC | Filled by specific event (works for EVENT_T_FRIENDLY_HP, EVENT_T_FRIENDLY_IS_CC, EVENT_T_FRIENDLY_MISSING_BUFF) |
13 | TARGET_T_PLAYER_INVOKER | Player who initiated hostile contact with this npc |
14 | TARGET_T_PLAYER_TAPPED | Player who currently holds to score the kill credit from the npc |
15 | TARGET_T_NONE | Default spell target - sets nullptr which should be most common spell fill |
16 | TARGET_T_HOSTILE_RANDOM_MANA | Random target with mana |
17 | TARGET_T_NEAREST_AOE_TARGET | Checks for available near aoe targets by EffectRadiusIndex[0] for the spell used |
18 | TARGET_T_HOSTILE_FARTHEST_AWAY | Farthest away target, excluding melee range |
Bit | Name | Description |
---|---|---|
1 | CAST_INTERRUPT_PREVIOUS | Interrupts any previous spell casting. |
2 | CAST_TRIGGERED | Forces the cast to be instant and ignores any mana/reagents requirements. |
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 |
8 | CAST_NO_MELEE_IF_OOM | Prevents creature from entering melee if out of mana or out of range |
16 | CAST_FORCE_TARGET_SELF | Forces the target to cast this spell on itself |
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. |
64 | CAST_IGNORE_UNSELECTABLE_TARGET | Can target UNIT_FLAG_NOT_SELECTABLE - Needed in some scripts |
128 | CAST_SWITCH_CASTER_TARGET | Switches target and caster for spell cast |
256 | CAST_MAIN_SPELL | Marks main spell for AI Type = Action 57 ACTION_T_SET_RANGED_MODE |
512 | CAST_PLAYER_ONLY | Selects only player targets - substitution for EAI not having more params |
1024 | CAST_DISTANCE_YOURSELF | Deprecated - Done automatically in RangeMode |
2048 | CAST_TARGET_CASTING | Selects only targets that are casting - EAI only |
4096 | CAST_ONLY_XYZ | Targets only coords of target and not unit |
Value | Type |
---|---|
1 | SPELL_SCHOOL_MASK_NORMAL (Physical) |
2 | SPELL_SCHOOL_MASK_HOLY |
4 | SPELL_SCHOOL_MASK_FIRE |
8 | SPELL_SCHOOL_MASK_NATURE |
16 | SPELL_SCHOOL_MASK_FROST |
32 | SPELL_SCHOOL_MASK_SHADOW |
64 | SPELL_SCHOOL_MASK_ARCANE |
124 | SPELL_SCHOOL_MASK_SPELL (without Holy) |
126 | SPELL_SCHOOL_MASK_MAGIC |
127 | SPELL_SCHOOL_MASK_ALL |
Value | Type |
---|---|
0 | DISPEL_NONE |
1 | DISPEL_MAGIC |
2 | DISPEL_CURSE |
3 | DISPEL_DISEASE |
4 | DISPEL_POISON |
5 | DISPEL_STEALTH |
6 | DISPEL_INVISIBILITY |
7 | DISPEL_ALL |
Value | Type | Sender | Invoker |
---|---|---|---|
0 | AI_EVENT_JUST_DIED | Killed Npc | Killer |
1 | AI_EVENT_CRITICAL_HEALTH | Hurt Npc | DamageDealer - Expected to be sent by 10% health |
2 | AI_EVENT_LOST_HEALTH | Hurt Npc | DamageDealer - Expected to be sent by 50% health |
3 | AI_EVENT_LOST_SOME_HEALTH | Hurt Npc | DamageDealer - Expected to be sent by 90% health |
4 | AI_EVENT_GOT_FULL_HEALTH | Healed Npc | Healer |
5 | AI_EVENT_CUSTOM_EVENTAI_A | Npc that throws custom event | TARGET_T_ACTION_INVOKER (if exists) |
6 | AI_EVENT_CUSTOM_EVENTAI_B | Npc that throws custom event | TARGET_T_ACTION_INVOKER (if exists) |
7 | AI_EVENT_GOT_CCED | CCed Npc | Caster that CCed |
8 | AI_EVENT_CUSTOM_EVENTAI_C | Npc that throws custom event | TARGET_T_ACTION_INVOKER (if exists) |
9 | AI_EVENT_CUSTOM_EVENTAI_D | Npc that throws custom event | TARGET_T_ACTION_INVOKER (if exists) |
10 | AI_EVENT_CUSTOM_EVENTAI_E | Npc that throws custom event | TARGET_T_ACTION_INVOKER (if exists) |
11 | AI_EVENT_CUSTOM_EVENTAI_F | Npc that throws custom event | TARGET_T_ACTION_INVOKER (if exists) |
Bit | Hex | Type | Description |
---|---|---|---|
0 | 0x00 | TEMPFACTION_NONE | 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 |
1 | 0x01 | TEMPFACTION_RESTORE_RESPAWN | Default faction will be restored at respawn |
2 | 0x02 | TEMPFACTION_RESTORE_COMBAT_STOP | at CombatStop() (happens at creature death, at evade or custom scripte among others) |
4 | 0x04 | TEMPFACTION_RESTORE_REACH_HOME | at reaching home in home movement (evade), if not already done at CombatStop() |
8 | 0x08 | TEMPFACTION_TOGGLE_NON_ATTACKABLE | Remove UNIT_FLAG_NON_ATTACKABLE(0x02) when faction is changed (reapply when temp-faction is removed) |
16 | 0x10 | TEMPFACTION_TOGGLE_IMMUNE_TO_PLAYER | Remove UNIT_FLAG_IMMUNE_TO_PLAYER(0x100) when faction is changed (reapply when temp-faction is removed) |
32 | 0x20 | TEMPFACTION_TOGGLE_IMMUNE_TO_NPC | Remove UNIT_FLAG_PASSIVE(0x200) when faction is changed (reapply when temp-faction is removed) |
64 | 0x40 | TEMPFACTION_TOGGLE_PACIFIED | Remove UNIT_FLAG_PACIFIED(0x20000) when faction is changed (reapply when temp-faction is removed) |
128 | 0x80 | TEMPFACTION_TOGGLE_NOT_SELECTABLE | Remove UNIT_FLAG_NOT_SELECTABLE(0x2000000) when faction is changed (reapply when temp-faction is removed) |
Type | classic | tbc | wotlk | Description |
---|---|---|---|---|
UNIT_FIELD_HEALTH | 22 | 22 | 24 | Health |
UNIT_FIELD_POWER1 | 23 | 23 | 25 | Mana |
UNIT_VIRTUAL_ITEM_SLOT_DISPLAY | 37,38,39 | 37,38,39 | 56,57,58 | WOTLK: UNIT_VIRTUAL_ITEM_SLOT_ID - Equipment offset for slot 0,1,2 (Mainhand, Offhand, Ranged) |
UNIT_FIELD_BOUNDINGRADIUS | 129 | 150 | 65 | bounding_radius |
UNIT_FIELD_COMBATREACH | 130 | 151 | 66 | combat_reach |
UNIT_DYNAMIC_FLAGS | 143 | 164 | 79 | DynamicFlags |
UNIT_NPC_FLAGS | 147 | 168 | 82 | NpcFlags |
Value | Type | Description |
---|---|---|
0 | REACT_PASSIVE | Wont attack on its own, maybe due to CallForHelp |
1 | REACT_DEFENSIVE | Will attack when attacked |
2 | REACT_AGGRESSIVE | Will attack (default) |
Value | Type | Description |
---|---|---|
0 | CURRENT_MELEE_SPELL | |
1 | CURRENT_GENERIC_SPELL | |
2 | CURRENT_AUTOREPEAT_SPELL | |
3 | CURRENT_CHANNELED_SPELL |
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) |
Value | Type | Description |
---|---|---|
0 | TYPE_NONE | Melee Mode |
1 | TYPE_FULL_CASTER | Caster Mode |
2 | TYPE_PROXIMITY | Range Mode |
3 | TYPE_NO_MELEE_MODE | Stationary Mode (No Melee, No Chase) |
4 | TYPE_DISTANCER | Distances itself whenever possible |
b2_0_sheath
Bit | Name | Comment |
---|---|---|
0 | SHEATH_STATE_UNARMED | all weapons sheathed |
1 | SHEATH_STATE_MELEE | melee weapon(s) unsheathed |
2 | SHEATH_STATE_RANGED | ranged weapon(s) unsheathed |
bytes1
Bit | Name | Comment |
---|---|---|
0 | UNIT_STAND_STATE_STAND | normal behavior |
1 | UNIT_STAND_STATE_SIT | sitting on ground |
2 | UNIT_STAND_STATE_SIT_CHAIR | sitting on normal chair |
3 | UNIT_STAND_STATE_SLEEP | sleeping |
4 | UNIT_STAND_STATE_SIT_LOW_CHAIR | sitting on low chair |
5 | UNIT_STAND_STATE_SIT_MEDIUM_CHAIR | sitting on medium chair |
6 | UNIT_STAND_STATE_SIT_HIGH_CHAIR | sitting on high chair |
7 | UNIT_STAND_STATE_DEAD | play dead |
8 | UNIT_STAND_STATE_KNEEL | kneel |
9 | UNIT_STAND_STATE_CUSTOM | Depends on model animation. Submerge, freeze, hide, hibernate, rest |
Working with phases requires a certain amount of math. You will have to know a few things before we begin.
You should have an idea of how many phases the NPC will have.
You will have to know Binary Addition. Don’t worry, I’ll show you how to
do it.
0110 = 06 (base 10)
0111 = 07 (base 10)
____ = __
1101 = 13 (base 10)
('327301','3273','11','0','100','0','0','0','0','0','0','0','57','2','35','0','0','0','0','0','0','0','0','0','Kolkar Stormer - Enable Range Mode on Spawn'),
('327305','3273','0','0','100','1281','0','0','3000','4000','0','0','11','9532','1','256','0','0','0','0','0','0','0','0','Kolkar Stormer - Cast Lightning Bolt (Range Mode)'),
('327306','3273','0','0','100','1537','0','0','5000','20000','0','0','11','9532','1','256','0','0','0','0','0','0','0','0','Kolkar Stormer - Cast Lightning Bolt (Melee Mode)'),
The ranged mode was designed to be toggled on spawn, but can effectively by toggled on phase change or on other condition when needed. It automatically reverts itself on evade. It works in connection with its modes, and automatically changes chase distance. A main casting spell, which is supposed to be lowest in priority (highest ID), needs to use 256 cast flag. This notes that when this spell returns OOM error, ranged mode automatically adjusts its behavior to melee mode. Ranged mode also responds to kicks and silence on this spell, forcing the mob into temporary melee mode. Last notable feature with ranged mode is distancing, which occurs if current victim is rooted by an aura and the npc is in melee mode. When creature is in melee mode, and the target is rooted, the creature runs away from main aggro targets melee reach.