Warcraft III resources & community, 2003–2006 · archived

ItemNum

not rated
Submitted by Aiursrage2kVariable Change0 downloads
Searches for item number idx in a units inventory.

set itm = ItemNum(u,1) //Would return the second item of a units inventory, reguardless of what postion it was in

Source

function ItemNum takes unit u, integer idx returns item
    local integer k = 0
    local integer i = 0
    local item tmp = null

    loop
      exitwhen i > 6
      set tmp = UnitItemInSlot(u,i)
      if tmp != null then
        set k = k + 1
      endif
      if k > idx then
        return tmp
      endif
      set i = i + 1
    endloop
    return null
endfunction

Comments

0

No comments.