Method Global:RegisterUniqueCreatureEvent [-] [+]

Registers a Creature event handler for a single Creature.

enum CreatureEvents
{
    CREATURE_EVENT_ON_ENTER_COMBAT                    = 1,  // (event, creature, target)
    CREATURE_EVENT_ON_LEAVE_COMBAT                    = 2,  // (event, creature)
    CREATURE_EVENT_ON_TARGET_DIED                     = 3,  // (event, creature, victim)
    CREATURE_EVENT_ON_DIED                            = 4,  // (event, creature, killer)
    CREATURE_EVENT_ON_SPAWN                           = 5,  // (event, creature)
    CREATURE_EVENT_ON_REACH_WP                        = 6,  // (event, creature, type, id)
    CREATURE_EVENT_ON_AIUPDATE                        = 7,  // (event, creature, diff)
    CREATURE_EVENT_ON_RECEIVE_EMOTE                   = 8,  // (event, creature, player, emoteid)
    CREATURE_EVENT_ON_DAMAGE_TAKEN                    = 9,  // (event, creature, attacker, damage) - Can return new damage
    CREATURE_EVENT_ON_PRE_COMBAT                      = 10, // (event, creature, target)
    CREATURE_EVENT_ON_ATTACKED_AT                     = 11, // (event, creature, attacker)
    CREATURE_EVENT_ON_OWNER_ATTACKED                  = 12, // (event, creature, target)    // Not on mangos
    CREATURE_EVENT_ON_OWNER_ATTACKED_AT               = 13, // (event, creature, attacker)  // Not on mangos
    CREATURE_EVENT_ON_HIT_BY_SPELL                    = 14, // (event, creature, caster, spellid)
    CREATURE_EVENT_ON_SPELL_HIT_TARGET                = 15, // (event, creature, target, spellid)
    // UNUSED                                         = 16, // (event, creature)
    // UNUSED                                         = 17, // (event, creature)
    // UNUSED                                         = 18, // (event, creature)
    CREATURE_EVENT_ON_JUST_SUMMONED_CREATURE          = 19, // (event, creature, summon)
    CREATURE_EVENT_ON_SUMMONED_CREATURE_DESPAWN       = 20, // (event, creature, summon)
    CREATURE_EVENT_ON_SUMMONED_CREATURE_DIED          = 21, // (event, creature, summon, killer)    // Not on mangos
    CREATURE_EVENT_ON_SUMMONED                        = 22, // (event, creature, summoner)
    CREATURE_EVENT_ON_RESET                           = 23, // (event, creature)
    CREATURE_EVENT_ON_REACH_HOME                      = 24, // (event, creature)
    // UNUSED                                         = 25, // (event, creature)
    CREATURE_EVENT_ON_CORPSE_REMOVED                  = 26, // (event, creature, respawndelay) - Can return new respawndelay
    CREATURE_EVENT_ON_MOVE_IN_LOS                     = 27, // (event, creature, unit) - 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)
    // UNUSED                                         = 32, // (event, creature)
    // UNUSED                                         = 33, // (event, creature)
    CREATURE_EVENT_ON_QUEST_REWARD                    = 34, // (event, player, creature, quest, opt)
    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_COUNT
};

Synopsis

cancel = RegisterUniqueCreatureEvent( guid, instance_id, event, function )

cancel = RegisterUniqueCreatureEvent( guid, instance_id, event, function, shots )

Arguments

uint64 guid

The GUID of a single Creature.

number instance_id

The instance ID of a single Creature.

Valid numbers: integers from 0 to 4,294,967,295.

number event

Refer to CreatureEvents above.

Valid numbers: integers from 0 to 4,294,967,295.

function function

Function 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 cancel

A function that cancels the binding when called.

Generated on 11/04/2018
©2016 - Eluna Lua Engine