woot
New Member
- Reaction score
- 8
Is it possible to give an item to a hero in a specific slot number? (or move an item to a specific slot) ?
If so.... how?
Thanks
I coded something that should do the trick:
If so.... how?
Thanks
I coded something that should do the trick:
JASS:
function AddItemUnitSlot takes integer itemId, unit u, integer slot returns item
local integer i = 0
local item array dummies[6]
local integer dummiesSize = 0
local item itemAdded = null
if(slot < 1 or slot > 6)then
return null
endif
if(UnitItemInSlotBJ(u, slot)!=null)then
return null
endif
set i = 1
loop
exitwhen i > slot
if(i==slot)then
set itemAdded = UnitAddItemByIdSwapped( itemId, u )
exitwhen true
else
if(UnitItemInSlotBJ(u, i)==null)then
//add DUMMY ITEM
set dummies[dummiesSize]=UnitAddItemByIdSwapped( 039;I00G039;, u )
set dummiesSize = dummiesSize+1
endif
endif
set i=i+1
endloop
//remove dummies
set i = 0
loop
exitwhen i>= dummiesSize
call RemoveItem(dummies<i>)
set dummies<i>=null
set i=i+1
endloop
return itemAdded
endfunction
</i></i>