- Joined
- Nov 30, 2007
- Messages
- 1,202
I want to search a region for a tilesets of type how would I create such a function?
actually i want to search around a region
so if a given area is 3*3*(128) I want to search everything outside that in this case 5*5*(128) would be the outlying region. They have the same center.
Other examples: takes region 1*1*(128) search 5*5*(128), takes region 2*2*(128) search 4*4*(128)
Well, I began like this anyway: looks like a dumb way, and not sure how to loop through dubble, tripple rows and how to exit these loops
Basically it goes round the box. Not working yet Obviously.
The Image is what I had in mind. Each lap starts at the pink region and ends befor the following white, where next loop start seen above. Dunno exactly what parameters I need for these. The Red Regions I dont want to search. The black is the center and also not needed to be searched. (The regions are only to show you what I mean.)
I don't know how to keep track when it has gone 4 respectivly 2 regions distance (the distance changes depending on the lap it is on.)
Anyway, how would you do it?
actually i want to search around a region
so if a given area is 3*3*(128) I want to search everything outside that in this case 5*5*(128) would be the outlying region. They have the same center.
Other examples: takes region 1*1*(128) search 5*5*(128), takes region 2*2*(128) search 4*4*(128)
Well, I began like this anyway: looks like a dumb way, and not sure how to loop through dubble, tripple rows and how to exit these loops
Basically it goes round the box. Not working yet Obviously.
JASS:
function SearchForTerrain takes real x, real y, real xDist, real yDist real searchRadian returns boolean
set real x = x + searchRadian*128
set real y = y - searchRadian*128
loop // Something about the rows that I want to circle around this box.
loop
if GetTerrainType(x,y) == 'A000' then
return TRUE
endif
set x = x - 128
endloop
loop
if GetTerrainType(x,y) == 'A000' then
return TRUE
endif
set y = y + 128
endloop
loop
if GetTerrainType(x,y) == 'A000' then
return TRUE
endif
set x = x + 128
endloop
loop
if GetTerrainType(x,y) == 'A000' then
return TRUE
endif
set y = y - 128
endloop
endloop
return FALSE
endfunction
The Image is what I had in mind. Each lap starts at the pink region and ends befor the following white, where next loop start seen above. Dunno exactly what parameters I need for these. The Red Regions I dont want to search. The black is the center and also not needed to be searched. (The regions are only to show you what I mean.)
I don't know how to keep track when it has gone 4 respectivly 2 regions distance (the distance changes depending on the lap it is on.)
Anyway, how would you do it?
Attachments
Last edited: