Warcraft III resources & community, 2003–2006 · archived

CountNumberOfItemOnUnit

not rated
Submitted by AIAndyFunctions0 downloads
Returns the number of items of a certain item type the unit u has.

Source

function CountNumberOfItemOnUnit takes integer itemid, unit u returns integer
  local integer i = 0
  local integer sum = 0
  loop
    exitwhen i > 5
    if GetItemTypeId(UnitItemInSlot(u, i)) == itemid then
      set sum = sum + 1
    endif
    set i = i + 1
  endloop
  return sum
endfunction

Comments

2
yes but you could use it in a multi-board or leader board
I could be wrong but couldnt you just click on the unit and count the number of that perticular item the unit has?