Lua functions

SummonCosmeticPet

Registered in this checkout as EQ2Emu_lua_SummonCosmeticPet; implementation found at WorldServer/Lua/LuaFunctions.cpp:6414.

Historical signature: SummonCosmeticPet(spawn, pet_id)

Parameter and behavior details in the historical explanation are under review against the current implementation.

Function: SummonCosmeticPet(spawn, pet_id)

Description: Create a noncombat cosmetic pet from an NPC database definition during a spell callback. The pet uses the owner's level and faction, a configured random pet name, a noncombat brain, and the summoning spell identity. It is not attackable. Owner, pet category, brain and appearance setup finish before publication; construction and retirement each have an explicit allocation owner.

Parameters:

  • spawn (Spawn) - Player or NPC entity that will own the pet.
  • pet_id (uint32) - Nonzero NPC database spawn ID.

Returns: The created pet Spawn object, or nil for an invalid owner, an existing pet in this category, missing/invalid NPC definition, unavailable or resisted spell, or rejected admission. Failed construction retires its allocation without retaining a dangling pet address.

Connection lifetime: Each player or group-member connection resolved by this function is retained through the native call. A disconnect or reconnect during a callback cannot destroy that retained connection or switch the ongoing call to a replacement. A later Lua call resolves the current connection. This does not extend the lifetime of unrelated spawn or item userdata.

Checked example

Active call in a local runtime Lua script. Argument count matches current fixed C++ readers. This is a contextual call pattern, not a tested standalone script.

SummonCosmeticPet(Caster, 6538)

Evidence: server/Spells/Commoner/SummonSatyr.lua:12; binding EQ2Emu_lua_SummonCosmeticPet.

Current registration: WorldServer/Lua/LuaInterface.cpp. Historical explanation: EQ2Emu Lua documentation.