Basically, I have an array of 10 regions, and I want to check whether a unit is in any of them.
However, this isn't working, and I'm wondering what the problem is...
The region is created fine, and the function will work fine if you give the regions individually (e.g. udg_Regions[1]), so I'm thinking this might be a limitation of the loop function...
Is there any way in which I can get this to work, or approximate something resembling it?
Code:
function RegionCheck takes location l returns boolean
local integer i = 0
local boolean b = false
local real x = GetLocationX(l)
local real y = GetLocationY(l)
loop
exitwhen i == 11 or b == true
if(IsPointInRegion(udg_Regions[i], x, y) == true) then
set b = true
endif
set i = i+1
endloop
return b
endfunction
However, this isn't working, and I'm wondering what the problem is...
The region is created fine, and the function will work fine if you give the regions individually (e.g. udg_Regions[1]), so I'm thinking this might be a limitation of the loop function...
Is there any way in which I can get this to work, or approximate something resembling it?