1
0
EQ2Emu/docs/lua_functions/GetCharmedPet.md

534 B

Function: GetCharmedPet(Spawn)

Description: Returns the NPC that the given player or NPC has charmed, if any. When a player charms an NPC (through a spell), that NPC becomes a pet under their control — this function retrieves it.

Parameters:

  • spawn (Spawn) - Spawn object representing spawn.

Example:

-- From Spells/Mage/Enchanter/Charm.lua
function remove(Caster, Target)
    local pet = GetCharmedPet(Caster)
    if pet ~= nil then
        RemoveSpellBonus(pet)
        DismissPet(pet)
    end