Lua functions

SetLocationProximityFunction

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

Historical signature: SetLocationProximityFunction(zone, x, y, z, max_variation, in_range_function, leaving_range_function)

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

Function: SetLocationProximityFunction(zone, x, y, z, max_variation, in_range_function, leaving_range_function)

Description: Adds a location trigger whose callbacks are defined in the zone script. Callbacks receive (zone, player). leaving_range_function may be omitted or empty.

Parameters:

  • zone (Zone) - The zone containing the trigger.
  • x, y, z (number) - Trigger coordinates in world units.
  • max_variation (number) - Maximum sum of absolute coordinate differences: abs(player_x-x) + abs(player_y-y) + abs(player_z-z) <= max_variation.
  • in_range_function (string) - Required nonempty enter callback name.
  • leaving_range_function (string, optional) - Leave callback name; empty means no leave callback.

Returns: None.

Behavior: Each call adds an independent trigger. For a trigger with a leave callback, a continuous visit enters once, leaving records the exit before invoking Lua, and re-entry can start a new episode. With no leave callback, membership remains recorded until session/Player cleanup or removal of the trigger. Membership belongs to the original Client, Player and session, so a replacement starts fresh. Removing triggers prevents later callback acceptance; an already accepted callback retains its original Player and trigger definition until it returns. Lua runs outside membership mutexes.

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.

SetLocationProximityFunction(zone, -36.14, -48, 762.94, 5, "EventPrep", "Leave")

Evidence: server/ZoneScripts/BloodSkullValleyMaulicsStronghold.lua:10; binding EQ2Emu_lua_SetLocationProximityFunction.

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