Lua functions

SetPosition

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

Historical signature: SetPosition(spawn, x, y, z, heading)

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

Function: SetPosition(spawn, x, y, z, heading)

Description: Sets the current position and stored origin coordinates to the supplied coordinates. A nonzero heading also updates heading; zero preserves the current heading. Player movement uses the existing movement packet path.

Spatial membership updates retain the original actor and publication epoch. Replacement cell/member nodes and bucket capacity are prepared before the membership move commits, and cleanup from an older allocation cannot remove a replacement actor's entry. This lifetime contract does not make all mutable position fields a single atomic snapshot.

Parameters:

  • spawn (Spawn) - Spawn object representing spawn.
  • x (float) - Position component or heading value.
  • y (float) - Position component or heading value.
  • z (float) - Position component or heading value.
  • heading (float) - Position component or heading value.

Returns: None.

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.

SetPosition(Spawn,-1.05, -1.21, -30.84,355)

Evidence: server/SpawnScripts/FreeportBetrayal/Chains.lua:15; binding EQ2Emu_lua_SetPosition.

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