API:AttachTrophyToLocation
From RoR Wiki
UI Lua API · Item functions
Version: WAR 1.4.8
Asks the server to attach an equipped trophy to a different point on the character.
AttachTrophyToLocation(trophyPosition, trophyLocation, trophyLocIndex)
Arguments
- trophyPosition
number– Which trophy slot, 1 to 5 (the index into the GetTrophyData table).- trophyLocation
number– Attachment point location (trophyLocationfrom GetLocationsForTrophies).- trophyLocIndex
number– Attachment point index (trophyLocIndexfrom the same table), starting at 1.
Returns
Nothing.
Details
- The request is only sent when:
- the trophy slot holds a trophy (
GameData.ItemTypes.TROPHY); - the requested location or index differs from the one the trophy already has;
- the requested location passes the client's check against the trophy's allowed locations.
- the trophy slot holds a trophy (
- Otherwise the call does nothing.
- The client does not range-check
trophyPosition. Use 1 to 5. - The function needs at least three arguments and only reads the last three.
Errors
None besides the generic Invalid Parameters message when an argument is not a number.
Example
Moving the selected trophy to the next free attachment point, from default/ea_characterwindow/source/characterwindowtrophies.lua:
local trophyData = CharacterWindow.trophyData[CharacterWindow.currentlySelectedTrophyPosition]
local startIndex = CharacterWindow.GetIndexForTrophyLoc( trophyData.trophyLocation, trophyData.trophyLocIndex )
local index, attachPointData = CharacterWindow.GetNextAvailableAttachmentPoint( trophyData, startIndex+1 )
if index ~= 0 then
AttachTrophyToLocation( CharacterWindow.currentlySelectedTrophyPosition, attachPointData.trophyLocation, attachPointData.trophyLocIndex)
end
