Lua functions

SpawnByLocationID

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

Historical signature: SpawnByLocationID(zone, location_id)

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

Function: SpawnByLocationID(zone, location_id)

Description: Creates one randomly selected entry from the zone's spawn-location definition, using its placement and respawn metadata. Supports NPC, ground spawn, object, widget and sign entries. Construction owns the allocation through prespawn; canceled or omitted allocations do not publish. After creation, the function selects a loadable script in spawn-entry, spawn-location, then spawn-database order and calls spawn. The final script-selection pass uses the randomly selected entry. The operation owns a copied placement and its entry values across template and script callbacks.

Parameters:

  • zone (Zone) - Destination zone.
  • location_id (uint32) - Nonzero spawn-location definition ID.

Returns: The created Spawn userdata, or no value (nil when assigned) for invalid arguments, unavailable definitions, cancellation, omission, an unsettled or cancelled persistent house receipt, or failed creation. A returned userdata value can later expire; it does not permanently own the actor.

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.

local Spawn1 = SpawnByLocationID(zone, 133782082)

Evidence: server/SpawnScripts/antonica/afociofdecayA.lua:23; binding EQ2Emu_lua_SpawnByLocationID.

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