Method Global:RegisterUniqueCreatureEvent [-] [+]
Registers a Creature event handler for a single Creature.
enum CreatureEvents
{
CREATURE_EVENT_ON_ENTER_COMBAT = 1, // (event, creature, target) - Can return true to stop normal action
CREATURE_EVENT_ON_LEAVE_COMBAT = 2, // (event, creature) - Can return true to stop normal action
CREATURE_EVENT_ON_TARGET_DIED = 3, // (event, creature, victim) - Can return true to stop normal action
CREATURE_EVENT_ON_DIED = 4, // (event, creature, killer) - Can return true to stop normal action
CREATURE_EVENT_ON_SPAWN = 5, // (event, creature) - Can return true to stop normal action
CREATURE_EVENT_ON_REACH_WP = 6, // (event, creature, type, id) - Can return true to stop normal action
CREATURE_EVENT_ON_AIUPDATE = 7, // (event, creature, diff) - Can return true to stop normal action
CREATURE_EVENT_ON_RECEIVE_EMOTE = 8, // (event, creature, player, emoteid) - Can return true to stop normal action
CREATURE_EVENT_ON_DAMAGE_TAKEN = 9, // (event, creature, attacker, damage) - Can return true to stop normal action, can return new damage as second return value.
CREATURE_EVENT_ON_PRE_COMBAT = 10, // (event, creature, target) - Can return true to stop normal action
// UNUSED
CREATURE_EVENT_ON_OWNER_ATTACKED = 12, // (event, creature, target) - Can return true to stop normal action // Not on mangos
CREATURE_EVENT_ON_OWNER_ATTACKED_AT = 13, // (event, creature, attacker) - Can return true to stop normal action // Not on mangos
CREATURE_EVENT_ON_HIT_BY_SPELL = 14, // (event, creature, caster, spellid) - Can return true to stop normal action
CREATURE_EVENT_ON_SPELL_HIT_TARGET = 15, // (event, creature, target, spellid) - Can return true to stop normal action
// UNUSED = 16, // (event, creature)
// UNUSED = 17, // (event, creature)
// UNUSED = 18, // (event, creature)
CREATURE_EVENT_ON_JUST_SUMMONED_CREATURE = 19, // (event, creature, summon) - Can return true to stop normal action
CREATURE_EVENT_ON_SUMMONED_CREATURE_DESPAWN = 20, // (event, creature, summon) - Can return true to stop normal action
CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED = 21, // (event, creature, summon, killer) - Can return true to stop normal action // Not on mangos
CREATURE_EVENT_ON_SUMMONED = 22, // (event, creature, summoner) - Can return true to stop normal action
CREATURE_EVENT_ON_RESET = 23, // (event, creature)
CREATURE_EVENT_ON_REACH_HOME = 24, // (event, creature) - Can return true to stop normal action
// UNUSED = 25, // (event, creature)
CREATURE_EVENT_ON_CORPSE_REMOVED = 26, // (event, creature, respawndelay) - Can return true to stop normal action, can return new respawndelay as second return value
CREATURE_EVENT_ON_MOVE_IN_LOS = 27, // (event, creature, unit) - Can return true to stop normal action. Does not actually check LOS, just uses the sight range
// UNUSED = 28, // (event, creature)
// UNUSED = 29, // (event, creature)
CREATURE_EVENT_ON_DUMMY_EFFECT = 30, // (event, caster, spellid, effindex, creature)
CREATURE_EVENT_ON_QUEST_ACCEPT = 31, // (event, player, creature, quest) - Can return true
// UNUSED = 32, // (event, creature)
// UNUSED = 33, // (event, creature)
CREATURE_EVENT_ON_QUEST_REWARD = 34, // (event, player, creature, quest, opt) - Can return true
CREATURE_EVENT_ON_DIALOG_STATUS = 35, // (event, player, creature)
CREATURE_EVENT_ON_ADD = 36, // (event, creature)
CREATURE_EVENT_ON_REMOVE = 37, // (event, creature)
CREATURE_EVENT_ON_AURA_APPLY = 38, // (event, creature, aura)
CREATURE_EVENT_ON_HEAL = 39, // (event, creature, target, gain) - Can return new heal amount
CREATURE_EVENT_ON_DAMAGE = 40, // (event, creature, target, damage) - Can return new damage amount
CREATURE_EVENT_ON_AURA_REMOVE = 41, // (event, creature, aura, remove_mode)
CREATURE_EVENT_ON_MODIFY_PERIODIC_DAMAGE_AURAS_TICK = 42, // (event, creature, target, damage, spellInfo) - Can return new damage amount
CREATURE_EVENT_ON_MODIFY_MELEE_DAMAGE = 43, // (event, creature, target, damage) - Can return new damage amount
CREATURE_EVENT_ON_MODIFY_SPELL_DAMAGE_TAKEN = 44, // (event, creature, target, damage, spellInfo) - Can return new damage amount
CREATURE_EVENT_ON_MODIFY_HEAL_RECEIVED = 45, // (event, creature, target, heal, spellInfo) - Can return new heal amount
CREATURE_EVENT_ON_DEAL_DAMAGE = 46, // (event, creature, target, damage, damagetype) - Can return new damage amount
CREATURE_EVENT_COUNT
};
Synopsis
cancel = RegisterUniqueCreatureEvent( guid, instance_id, event, function )
cancel = RegisterUniqueCreatureEvent( guid, instance_id, event, function, shots )
Arguments
number guidThe GUID of a single Creature.
Valid numbers: integers from 0 to 18,446,744,073,709,551,615.
number instance_idThe instance ID of a single Creature.
Valid numbers: integers from 0 to 4,294,967,295.
number eventRefer to CreatureEvents above.
Valid numbers: integers from 0 to 4,294,967,295.
function functionFunction that will be called when the event occurs.
number shots (0)The number of times the function will be called, 0 means "always call this function".
Valid numbers: integers from 0 to 4,294,967,295.
Returns
function cancelA function that cancels the binding when called.