Lua functions

SetEquippedItemByID

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

Historical signature: SetEquippedItemByID(…) via current binding

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

Function: SetEquippedItemByID(entity, slot, item_id)

Description: Copies the item definition into a fresh owned allocation and requests admission to an empty requested equipment slot. It does not overwrite the item already in that slot. Failed admission releases the private copy. This trusted grant path does not run gameplay equip hooks. For a Player, ordinary items retain the setup function's force-slot behavior, subject to native two-hand and canonical bag constraints. A two-handed Player grant can move an existing secondary item into inventory when native placement permits it.

A Player requires a current original connection and zone; a disconnected or headless Player returns false unchanged. Accepted Player work retains the original actor and exact slot while transfer, appearance, packet and save work complete. An NPC admits the fresh allocation directly into its empty slot and updates its appearance. The NPC path validates construction custody, the native slot range, an empty target and unique identity; it does not run the Player class, skill, two-hand or allowed-item-slot policy.

Parameters: entity: Player or NPC Entity spawn. slot: integer native equipment slot from 0 through 24. item_id: item definition ID to copy.

Returns: Boolean admission result. Player true acknowledges owned in-memory work, which may defer or cancel if the original intent becomes stale; it does not promise synchronous slot mutation or a durable database commit. Invalid entity, missing definition, or an invalid, fractional, negative or out-of-range slot returns no value (nil).

Checked example

No checked example is published for this function yet. No suitable maintained runtime-script example passed the argument and source review.

Current registration: WorldServer/Lua/LuaInterface.cpp.