Lua functions

SetTradeskillLevel

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

Historical signature: SetTradeskillLevel(spawn, level)

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

Function: SetTradeskillLevel(spawn, level)

Description: Requests a tradeskill level change for a Player, or sets an NPC's tradeskill level directly. Player changes use the Player's current tradeskill level, class progression limits, maximum-level rules, and the global and original-zone on_tradeskill_level_up hooks. A hook returning -1 vetoes the change. This function does not award or consume tradeskill XP.

Parameters:

  • spawn (Spawn) - Player or other Spawn to update.
  • level (uint8) - Requested tradeskill level. Player levels must be at least 1.

Returns: None. A refused or vetoed request has no Lua return value.

Ownership and callbacks: Player changes retain the original Player and capture its connection and zone once. A disconnect or reconnect during a hook cannot redirect the level change or spell grants to a replacement Player. A newer level or XP mutation supersedes the older pending transition. Accepted changes update the original Player's tradeskill level, next XP requirement, skill caps, and eligible tradeskill spells. UI delivery requires the original connection, session, packet context, and transition revision to remain current. An offline Player can receive backend changes; configured hooks still apply. Each later Lua call observes its own current connection.

An exception after the level commits can still interrupt later effects; this function does not provide a durable completion or retry guarantee. It does not extend the lifetime of unrelated Lua 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.

SetTradeskillLevel(Spawn,2)

Evidence: server/SpawnScripts/Baubbleshire/RalaEurocarry.lua:48; binding EQ2Emu_lua_SetTradeskillLevel.

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