Warcraft III resources & community, 2003–2006 · archived

RemoveItemsFromUnitById

not rated
Submitted by StarcraftfreakFunctions0 downloads
Removes all items of the specified type from the specified unit.
Returns the number of removed items.

Please don't mix it up with UnitRemoveItemsById. I tried to use Blizzards naming conventions to make a difference between dropping and removing.

Source

function RemoveItemsFromUnitById takes unit whichUnit, integer itemId returns integer
    local integer removed = 0
    local integer itemSlot
    loop
        set itemSlot = GetInventoryIndexOfItemType(whichUnit,itemId)
        exitwhen itemSlot == -1
        call RemoveItem(UnitRemoveItemFromSlot(whichUnit, itemSlot))
        set removed = removed + 1
    endloop
    return removed
endfunction

Comments

0

No comments.