Lua functions

SetInCombat

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

Historical signature: SetInCombat(spawn, val)

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

Function: SetInCombat(spawn, val)

Description: Sets the entity's combat state. Entering combat also clears its running locations and recalculates movement with the stop flag.

Parameters:

  • spawn (Spawn): a player or other entity spawn.
  • val (boolean): true enters combat; false leaves combat.

Returns: None. Invalid or non-entity input is logged and performs no update.

Movement target ownership: Target-based movement during recalculation acquires one original selected-target loan and keeps it across distance, line-of-sight and navigation work. Changing the selected target during a callback cannot redirect the ongoing calculation to a different allocation. Native navigation retains the original actor through command execution and retirement.

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.

SetInCombat(NPC, false)

Evidence: server/SpawnScripts/BrawlersDojo/afirstcircleadept.lua:51; binding EQ2Emu_lua_SetInCombat.

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