Warcraft III resources & community, 2003–2006 · archived

UnitAddItemToSlot

not rated
Submitted by weaaddarFunctions0 downloads
The counterpoint function to UnitAddItemToSlotById. Takes an already in existance item and will add it to the unit inventory in the slot specified. If the item was not added, or the units inventory does not stretch to that slot size, or there is an undroppable item in the destination slot position, it will return false.

Once again, if you start your item indices at one, then I have included a UnitAddItemToSlotBJ fluffer function:
I.e.
UnitAddItemToSlot(hero,it,5) will add an item to slot 6 of hero's inventory.
UnitAddItemToSlotBJ(hero,it,5) will add an item to slot 5 on hero's inventory.
Uses:
UnitMoveItemToSlot

Source

function UnitAddItemToSlot takes unit hero, item it,integer slot returns boolean
   local boolean b=UnitAddItem(hero,it)
   local boolean c= UnitMoveItemToSlot(hero,it,slot)
   return (b and c)
endfunction

function UnitAddItemToSlotBJ takes unit hero,item it,integer slot returns boolean
   return UnitAddItemToSlot(hero,it,slot-1)
endfunction

Comments

4
/me wonders where she can find non-gui functions like UnitMoveItemToSlot ^ ^
:!:
8)
:?