Lua functions

SpawnSetByDistance

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

Historical signature: SpawnSetByDistance(spawn, max_distance, variable, value)

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

Function: SpawnSetByDistance(spawn, max_distance, variable, value)

Description: Applies a supported spawn-set field to non-Player actors within the supplied radius. Requires a zoned origin, positive distance, and nonempty field/value strings. Uses the ordinary command field lookup; an unknown field produces no changes.

The operation retains its original origin and selected actor allocations. Radius cells remember original actor references and publication epochs; callbacks cannot turn a captured candidate ID into a replacement actor. Actor work runs after index locks are released. This is a selected snapshot, not an instruction to rediscover actors after each callback.

Parameters:

  • spawn (Spawn) - Origin whose zone and position define the search.
  • max_distance (float) - Positive radius using the engine's ordinary collision-aware distance.
  • variable (string) - Supported spawn-set field name.
  • value (string) - Field value, passed to the existing command handler.

Returns: None.

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.

SpawnSetByDistance(NPC, 15, "visual_state", 491)

Evidence: server/SpawnScripts/OutpostOverlord/evilgoblintent1.lua:29; binding EQ2Emu_lua_SpawnSetByDistance.

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