• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to use and create and clean regions?

Status
Not open for further replies.
Example of adding and removing a rect to a region. (you can add as many rects as you want to your region)
JASS:
local region r = CreateRegion()     // create region
call RegionAddRect(r, yourRect)     // adds "yourRect" to your region
call RegionClearRect(r, yourRect)   // removes "yourRect" from your region
call RemoveRegion(r)                //removes the region
set r = null

There are also events for region, enter/leave region:
JASS:
native TriggerRegisterEnterRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event
native TriggerRegisterLeaveRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event

Here is a full list of functions for regions: http://jass.sourceforge.net/doc/api/common_j-types-region.shtml
 
In GUI you can't directly work with regions.

In GUI you could say Region == Rect. (there only may exist 1 rect for 1 region)
In JASS you can't, because you can manipulate the region by yourself with adding multiple rects or single coordinates to your region.

You can't directly define the size of a region, because a region is just the sum of all rects/coordinates you add to your region.
But you can define the size of the rects, that you add to your region:

native Rect takes real minx, real miny, real maxx, real maxy returns rect

And you asked how to check if a unit is in a region:

native IsUnitInRegion takes region whichRegion, unit whichUnit returns boolean

Hope it helped, but now I don't quite understand. Do you suppose to work with jass or with gui with these regions?
 
Status
Not open for further replies.
Top