Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:SetPlayerVariation

From RoR Wiki
Revision as of 19:49, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UI Lua API · Appearance functions
Version: WAR 1.4.8

Shows the player character with the appearance that a marketing reward item in the inventory would give, without applying it.

SetPlayerVariation(slot)

Arguments

slot
number – Inventory slot of the item, as used to index DataUtils.GetItems(). The stock UI passes Cursor.Data.SourceSlot for an item picked up from the inventory.

Returns

Nothing.

Details

  • Nothing happens unless the slot holds an item whose type is GameData.ItemTypes.MARKETING.
  • The item carries an appearance slot number and a variation value. The client writes that value into the player's appearance data for that slot (only for slot numbers below 15) and updates the character's look.
  • This is a local preview only. Nothing is sent to the server. Use ApplyPlayerVariation to apply the item, or RevertPlayerVariation to undo the preview.
  • The client remembers the slot and its previous value for RevertPlayerVariation. Only one previous value is kept, so a second call replaces it.
  • The function returns nothing if there is no player.

Errors

None besides the generic Invalid Parameters message when the argument is not a number.

Example

From ea_characterwindow/source/characterwindow.lua, when a marketing item is dropped on the character window:

local itemData = DataUtils.GetItems()[Cursor.Data.SourceSlot]
if( Cursor.Data.Source == Cursor.SOURCE_INVENTORY and itemData.type == GameData.ItemTypes.MARKETING) then
    local slot = Cursor.Data.SourceSlot
    CharacterWindow.marketItemData = itemData
    CharacterWindow.marketItemDataSlot = slot
    -- ...
    SetPlayerVariation(slot)

See also