Warcraft III resources & community, 2003–2006 · archived

JASS #281

not rated
Submitted by BertTheJasserFunctions0 downloads
This counts all Items in an "rect" of type.

Source

constant function WhichItemType takes nothing returns integer
  return 'XXXX'
endfunction

function CountItem takes nothing returns nothing
  set bj_forLoopAIndex=bj_forLoopAIndex+1
endfunction

function IsItemType takes nothing returns boolean
  return GetItemTypeId(GetFilterItem())==WhichItemType()
endfunction

function CountFolianteInRect takes rect r returns integer
 local integer n
  set bj_forLoopAIndex=0
  call EnumItemsInRect(r,Condition(function IsItemType),function CountItem)
  set n=bj_forLoopAIndex
return n
endfunction

Comments

0

No comments.