Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Advertisement


Returns information about the companions you have. New in Patch 3.0

creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("type", id)

Parameters

Arguments

("type")
type
String - The TypeID to query (e.g. "CRITTER", or "MOUNT")
id
Integer - The slot id to query (starts at 1).

Returns

creatureID
Integer - The NPC ID of the companion.
creatureName
String - The name of the companion.
creatureSpellID
Integer - The spell ID to cast the companion. This is not passed to CallCompanion, but can be used with, e.g., GetSpellInfo.
icon
String - The texture of the icon for the companion.
issummoned
integer - 1 if the companion is summoned, nil if it's not

Known Issues

If called early in the loading process, before COMPANION_UPDATE fires, GetCompanionInfo returns companions in the order that they were learned by the current character. After COMPANION_UPDATE has fired at least once, GetCompanionInfo returns companions in alphabetical order. This information is accurate as of WoW 3.1.2.

Example

for i=1,GetNumCompanions("CRITTER"),1 do
local creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("CRITTER", i);
ChatFrame1:AddMessage(creatureID .. " " .. creatureSpellID .. " " .. creatureName .. " " .. icon .. " " .. issummoned) end

Result

Prints all the information regarding your pets to the chat frame.
7555 Hawk Owl 10706 Interface\Icons\Ability_EyeOfTheOwl 1 
7553 Great Horned Owl 10707 Interface\Icons\Ability_EyeOfTheOwl nil
Advertisement