Lua functions

ChangeFaction

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

Historical signature: ChangeFaction(spawn, faction_id, increase_or_decrease)

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

Function: ChangeFaction(spawn, faction_id, increase_or_decrease)

Description:

Changes a Player's standing with a faction. Positive amounts increase standing; negative amounts decrease it. Zero uses the selected faction's default increase. Standing changes clamp at -50000 and 50000. Faction IDs 1-10 have fixed con values and their reported standing remains zero.

Parameters:

  • spawn (Spawn) - A valid Player Spawn.
  • faction_id (uint32) - A positive faction ID. Zero is rejected.
  • increase_or_decrease (sint32) - Signed change, including -2147483648; zero selects the catalogue's default increase.

Returns:

One Boolean for a valid Player: true when a positive faction ID request is accepted, or false for faction ID zero. Acceptance does not mean the standing changed: clamped values, fixed-con IDs and missing catalogue definitions still return true. An invalid/non-Player Spawn logs an error and returns no Lua values.

Ownership and delivery:

The native operation retains the original Player and connection and one complete faction catalogue version through database/message callbacks. Reload or reconnect cannot replace the metadata or Player being changed. Disconnected or superseded connections receive no standing message. Standing updates remain pending for the original Player and are retried by supported Client update processing (versions greater than 373) after failed packet preparation/delivery. This function does not immediately persist every standing change; normal character saving still applies.

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.

ChangeFaction(Target, 12, -100000)

Evidence: server/Spells/Commoner/TheOverlordsWill.lua:25; binding EQ2Emu_lua_ChangeFaction.

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