FindNextItem
not ratedReturns the item next to the given location.
//============================================================================================================
//
// For more JASS scripts, visit us at http://www.wc3JASS.com
//
//============================================================================================================
function GetNextItemEnum takes nothing returns nothing
if DistanceBetweenPoints(GetItemLoc(GetEnumItem()),GetRectCenter(bj_isUnitGroupInRectRect)) < bj_randomSubGroupChance then
set bj_itemRandomCurrentPick = GetEnumItem()
set bj_randomSubGroupChance = DistanceBetweenPoints(GetItemLoc(GetEnumItem()),GetRectCenter(bj_isUnitGroupInRectRect))
endif
endfunction
function FindNextItem takes location L returns item
local real TempR = bj_randomSubGroupChance
local item TempI = bj_itemRandomCurrentPick
local item TempItm
local rect R = bj_isUnitGroupInRectRect
set bj_randomSubGroupChance = 1000000
set bj_isUnitGroupInRectRect = RectFromLoc(Location(0,0),Location(2,2))
call MoveRectToLoc(bj_isUnitGroupInRectRect,L)
call EnumItemsInRect(GetEntireMapRect(),null,function GetNextItemEnum)
set bj_randomSubGroupChance = TempR
call RemoveRect(bj_isUnitGroupInRectRect)
set bj_isUnitGroupInRectRect = R
set R = null
set TempItm = bj_itemRandomCurrentPick
set bj_itemRandomCurrentPick = TempI
set TempI = null
return TempItm
endfunctionNo comments.