Warcraft III resources & community, 2003–2006 · archived

Need help on types rect and region and a releated function

3 posts
#1

Need help on types rect and region and a releated function

I was scouting around API Browser and faund a function

native IsLocationInRegion()
which takes region, location and returns boolean.

I wonder what is region type stands for?
What is the differnce between rect and region?

I found it when im trying to find a condition.
I have a unit which moves to random location around itself and it has loctus ability which makes it, can move outside from playable map area.

I dont want to use Neutral-Wander ability for some reason

And i was trying to make such a code:
    loop
       exitwhen(IsLocationInRegion (CheckPoint,GoToPoint))
       set GoToPoint = GetRandomLocInRect(CenteredRect)
    endloop


CheckPoint must be a region type variable
I also found that function releated to region:
RegionAddRect()
which takes region, rect and returns nothing

I have tried to create a region variable and add the playable map area to region and tried the condition above again with this codes but does not worked either:

local region = CreateRegion()
local rect Map = GetPlayableMapRect()
call RegionAddRect(CheckPoint,Map)
    loop
       exitwhen(IsLocationInRegion (CheckPoint,GoToPoint))
       set GoToPoint = GetRandomLocInRect(CenteredRect)
    endloop


Does anyone have something about this problem?
Ty
#2
rect (what world editor calls region for no reason) It is a rectangle

region : Can have any shape and is also used for enter/leave events .


A region is a group of points you can even add a rect to a region or remove a rect from a region, regions are cool because they can have any shape.

On normal WE you can't use region global variables because blizzard is retarded. But with some modifications you can make WE do so.
#3
so theorically
if i create a rect and aasign it forex playable map area and add that rect to a region

then region becomes playable map area?
if yes why that function newer returns true?

exitwhen(IsLocationInRegion (CheckPoint,GoToPoint))

i have tried it and it loops forever and disables the trigger.