API:ApplyPlayerVariation
From RoR Wiki
UI Lua API · Appearance functions
Version: WAR 1.4.8
Asks the server to apply the marketing reward item in an inventory slot to the player character's appearance.
ApplyPlayerVariation(slot)
Arguments
- slot
number– Inventory slot of the item, the same slot number that SetPlayerVariation takes.
Returns
Nothing.
Details
- Nothing is sent unless the slot holds an item whose type is
GameData.ItemTypes.MARKETING. - Otherwise the client sends a request naming that inventory slot to the server. What happens to the item and the appearance is decided by the server.
- The local preview from SetPlayerVariation is not changed by this call.
- An argument error is reported with the name
SetPlayerVariation, notApplyPlayerVariation: the client checks the argument under that function's name. - The function does nothing if there is no player.
Errors
None besides the generic Invalid Parameters message when the argument is not a number (reported for SetPlayerVariation, see Details).
Example
From ea_characterwindow/source/characterwindow.lua:
function CharacterWindow.ApplyRewardItem()
--
if( CharacterWindow.marketItemDataSlot ~= -1 ) then
ApplyPlayerVariation(CharacterWindow.marketItemDataSlot)
CharacterWindow.marketItemData = nil
CharacterWindow.marketItemDataSlot = -1
