Lua functions

SendStateCommand

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

Historical signature: SendStateCommand(spawn, new_state, player)

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

Function: SendStateCommand(spawn, new_state, player)

Description: Updates the state of the Spawn and it's behavior, can optionally be sent to a single Player. The new_state is based on the Appearance ID's https://www.eq2emu.com/developers/references by client version.

Parameters:

  • spawn (Spawn) - Spawn object representing spawn.
  • new_state (int32) - Integer value new_state.
  • player (Spawn) - Spawn object representing player.

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. A missing player queues the state command to clients in the zone. This is a contextual call pattern, not a tested standalone script.

SendStateCommand(NPC, 0)

Evidence: server/SpawnScripts/FarJourneyFreeport/CaptainVarlos.lua:78; binding EQ2Emu_lua_SendStateCommand.

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