API:AssignLootItem
From RoR Wiki
UI Lua API · Loot functions
Version: WAR 1.4.8
Asks the server to give an item from the open loot window to a member of the player's group or warband.
AssignLootItem(lootIndex, playerName)
Arguments
- lootIndex
number– Position of the item in the current loot list, starting at 1.- playerName
wstring– Name of the group or warband member who should receive the item.
Returns
Nothing.
Details
- The name is turned into a member ID before sending:
- In a warband, the warband's members are searched.
- Otherwise the group's members are searched. Here the comparison ignores case and only needs
playerNameto match the start of a member's name.
- If no member matches, the request is still sent, with an empty (zero) member ID.
- If
lootIndexis outside the current loot list, nothing is sent. - The request is sent for the object the player last interacted with. Nothing is sent if there is no such object or the connection is not ready.
- The client does not check that the player is allowed to assign loot. The server decides.
- The function needs at least two arguments and only reads the last two.
Errors
None besides the generic Invalid Parameters message when an argument has the wrong type.
Example
From default/ea_lootwindow/source/lootwindow.lua:
function EA_Window_Loot.OnSelectGroupMember( name ) if( EA_Window_Loot.curSlot ~= nil ) then -- Give the item to the player AssignLootItem( EA_Window_Loot.curSlot, name ) end end
