UnitAddItemByIdSwapped

Parameters
itemIdinteger
whichHerounit
comment
patch

1.00

Source
Blizzard.j (suggest an edit or discuss on Github)
return type
item
Source code
function UnitAddItemByIdSwapped takes integer itemId, unit whichHero returns item
    // Create the item at the hero's feet first, and then give it to him.
    // This is to ensure that the item will be left at the hero's feet if
    // his inventory is full. 
    set bj_lastCreatedItem = CreateItem(itemId, GetUnitX(whichHero), GetUnitY(whichHero))
    call UnitAddItem(whichHero, bj_lastCreatedItem)
    return bj_lastCreatedItem
endfunction