<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AAssignLootItem</id>
	<title>API:AssignLootItem - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AAssignLootItem"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:AssignLootItem&amp;action=history"/>
	<updated>2026-10-17T17:06:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:AssignLootItem&amp;diff=30176&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:AssignLootItem&amp;diff=30176&amp;oldid=prev"/>
		<updated>2026-10-16T19:40:27Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=Loot}}&lt;br /&gt;
Asks the server to give an item from the open loot window to a member of the player&amp;#039;s group or warband.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AssignLootItem(lootIndex, playerName)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;lootIndex : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – Position of the item in the current loot list, starting at 1.&lt;br /&gt;
;playerName : &amp;lt;code&amp;gt;wstring&amp;lt;/code&amp;gt; – Name of the group or warband member who should receive the item.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Nothing.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The name is turned into a member ID before sending:&lt;br /&gt;
** In a warband, the warband&amp;#039;s members are searched.&lt;br /&gt;
** Otherwise the group&amp;#039;s members are searched. Here the comparison ignores case and only needs &amp;lt;code&amp;gt;playerName&amp;lt;/code&amp;gt; to match the start of a member&amp;#039;s name.&lt;br /&gt;
* If no member matches, the request is still sent, with an empty (zero) member ID.&lt;br /&gt;
* If &amp;lt;code&amp;gt;lootIndex&amp;lt;/code&amp;gt; is outside the current loot list, nothing is sent.&lt;br /&gt;
* 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.&lt;br /&gt;
* The client does not check that the player is allowed to assign loot. The server decides.&lt;br /&gt;
* The function needs at least two arguments and only reads the last two.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
None besides the generic &amp;#039;&amp;#039;Invalid Parameters&amp;#039;&amp;#039; message when an argument has the wrong type.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;default/ea_lootwindow/source/lootwindow.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function EA_Window_Loot.OnSelectGroupMember( name )&lt;br /&gt;
	if( EA_Window_Loot.curSlot ~= nil )&lt;br /&gt;
	then&lt;br /&gt;
		-- Give the item to the player&lt;br /&gt;
		AssignLootItem( EA_Window_Loot.curSlot, name )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:LootItem|LootItem]]&lt;br /&gt;
* [[API:SelectItemRollChoice|SelectItemRollChoice]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>