Lua functions

SpawnGroupByID

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

Historical signature: SpawnGroupByID(zone, group_id, custom_level)

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

Function: SpawnGroupByID(zone, group_id, custom_level)

Description: Creates actors from the locations registered for a spawn group, randomly selecting one entry at each location. The first successfully created actor acts as the group leader. Construction owns each allocation through prespawn; canceled or omitted allocations do not publish. Each successful actor is assigned the group ID and an optional level, then a loadable script is selected in spawn-entry, spawn-location, then spawn-database order before its spawn callback.

Parameters:

  • zone (Zone) - Destination zone.
  • group_id (uint32) - Spawn-group definition ID.
  • custom_level (integer, optional; default 0) - Read into a 16-bit unsigned level; values 0 and 65535 leave the created actor's level unchanged. Other values set its level before the spawn callback.

Returns: A 1-based Lua table of successfully created Spawn userdata, or no value (nil when assigned) when the group is unavailable, a required location is unavailable or no actor was created. Earlier actors may already exist if a later location fails. Locations with unsettled or cancelled persistent house receipts are skipped; no successful entries returns no value. Entries remain weak userdata between calls.

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.

SpawnGroupByID(zone, PropGroup, 0)

Evidence: server/SpawnScripts/antonica/BeetleController1.lua:33; binding EQ2Emu_lua_SpawnGroupByID.

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