HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Basics of Regions

09-01-2006, 03:08 PM#1
Archian
Basics of Regions
Originally posted by ragingspeedhorn, with some edits by Archian.

Index Of Content:

- What Is A Region?
- Where Do I Find The Place To Add Regions?
- What Do I Use These Regions For?
- You Also Mentioned Custom Weather, What Is That?
- Also Ambient Sound, What Is That? ...And Why Is It Turned Off?!
- Conclusion.



Note: In this tutorial I will explain to you the basics of working with regions, what a region is and some other usefull tips. This tutorial is in no way geared towards experienced modders but is meant as a helpfull hand to the newbeginners within Wc3 modding.

What Is A Region?

A region is a invisible field (ingame that is, in the editor your region is visible when you are using the region palette (but only when using the region palette, though you can change it so it's viewable while you're working in any of the other palettes)) used for triggered events, custom weather for certain areas (the area the region stretches over) and for ambient sound.
The last two being choosable in the individual regions properties and the first in the trigger editor.

The regions that this tutorial is about are called rects in JASS, that is because they are rectangular.
Besides rects JASS does also have the type region which is composed of many tiny sqares, so that you can have regions with any shape you want (for example a circle). These however are NOT available in GUI and can't be created in the region palette.
Contributed by: PitzerMike.

Now for the 'Unit enters/leaves Rect'-event: When this event is registered with a trigger, WC creates a temporary rectangular JASS-region with the same dimension as the GUI-region that was specified in the trigger editor. And the event will be registered for that temporary JASS-region, not for the rect (because rects technically don't even have Enter/Leave-Events). That's why triggers will still fire for the old position, even if you used the 'Move region' to move the region to a different position.
Contributed by: PitzerMike.


Where Do I Find The Place To Add Regions?

Go up in "Layer" and select "Regions", then the "Region Palette" pops up and from that you are able to manage and add new regions. You add the new regions through the grey button.

This is what the Region Palette looks like.
Click image for larger version

Name:	1reg.jpg
Views:	135
Size:	36.9 KB
ID:	11872

This is how the regions looks like.
Click image for larger version

Name:	2reg.jpg
Views:	141
Size:	33.5 KB
ID:	11873

As you can see the regions on the picture has different colors, you can change the color of the region inside the region properties (acces the properties by double clicking the region which you wish to change).
Click image for larger version

Name:	3reg.jpg
Views:	94
Size:	75.2 KB
ID:	11874

What Do I Use These Regions For?

As said before regions are mostly used for triggered events.
Here is some basic examples of a simple trigger involving the "Unit enters region" event:

Trigger:
Test Trigger
Collapse Events
Unit - A unit enters Region 000 <gen>
Collapse Conditions
Unit type of (Entering unit) Equal to (Footman)
Collapse Actions
Unit - Kill (Entering unit)

This trigger will kill any units that enters region "000" if they are of the type Footman.
It is a pretty basic example, a commonly used trigger which involves a region.

Trigger:
Region Trigger
Collapse Events
Unit - A unit enters Region 000 <gen>
Collapse Conditions
(Owner of (Triggering unit)) Equal to Player 1 (Red)
Collapse Actions
Unit - Order (Entering unit) to Move To (Center of Region 001 <gen>)

This trigger makes the unit entering "Region 000" move to Region 001 if the entering unit is owned by Player 1.

Trigger:
Region Spawn Trigger
Collapse Events
Unit - A unit enters Region 000 <gen>
Conditions
Collapse Actions
Unit - Create 1 Footman for Player 1 (Red) at (Center of Region 001 <gen>) facing Default building facing degrees

This trigger creates a Footman unit at the center (middle) of Region 001 when a unit owned by any player enters Region 000.

You Also Mentioned Custom Weather, What Is That?

The custom weather is the Weather Effect box. If you wish to have let's say an area where it is raining you create a region over the desired area like shown below.
Click image for larger version

Name:	4reg.jpg
Views:	52
Size:	31.5 KB
ID:	11875

Once that is done you open up the Region Properties and check out the Weather Effect box.
Click image for larger version

Name:	5reg.jpg
Views:	81
Size:	16.2 KB
ID:	11876

Once that is done you can choose your desired effect, as an example I have used "Ashenvale Rain (Heavy)".
Click image for larger version

Name:	6reg.jpg
Views:	114
Size:	53.9 KB
ID:	11877

The Weather Effects which you have to choose from are all the different effects premade by Blizzard which they used in the RoC & TFT campaigns, there are 21 in total. Also you are able to import your own custom Weather Effects, check out THIS tutorial made by CryoniC.

Also Ambient Sound, What Is That? ...And Why Is It Turned Off?!

The reason why you are not able to choose a Ambient Sound right away is because you can only use sounds once you have added them to your map as sounds through the Sound Editor (if you add them as music you will not be able to use them as Ambient Sounds, it needs to be as a sound). As shown below I have added the Credits theme as a sound file and then it becomes selectable in the Region Properties.
Click image for larger version

Name:	7reg.jpg
Views:	84
Size:	66.2 KB
ID:	11878

Click image for larger version

Name:	8reg.jpg
Views:	68
Size:	31.4 KB
ID:	11879

Conclusion.
Hopefully with this tutorial you have learned abit more about regions and their basic use, if you got any suggestions for improvements or such please leave a comment :)
Attached Images
File type: jpg1reg.jpg (36.9 KB)
File type: jpg2reg.jpg (33.5 KB)
File type: jpg3reg.jpg (75.2 KB)
File type: jpg4reg.jpg (31.5 KB)
File type: jpg5reg.jpg (16.2 KB)
File type: jpg6reg.jpg (53.9 KB)
File type: jpg7reg.jpg (66.2 KB)
File type: jpg8reg.jpg (31.4 KB)
09-01-2006, 03:35 PM#2
blu_da_noob
It might be a good idea (to avoid confusion) to have a note about the fact that GUI 'regions' are actually just 'rects'.
09-05-2006, 08:53 PM#3
Captain Griffen
Quote:
Originally Posted by Captain Griffen
Quote:
A region is a invisible field (ingame that is, in the editor your region is visible when you are using the region palette (but only when using the region palette))

You can check an option in the WE to be able to see them.

Quote:
used as rally points for triggered events

Wrong, though you can generate a location (point in GUI) in the middle of one. Unit enters/leaves events are not rally points, by the way.


You also completely failed to talk about the rect/region complex GUI has (which can be very important, even in GUI) or creating/destroying them, or in fact much.
09-05-2006, 09:07 PM#4
PipeDream
While the WE does use rects, they get routed internally to proper regions. Talking about what regions are could save people from a lot of bugs, particularly with weather and unit enters region events.
09-07-2006, 08:03 AM#5
Archian
I've edited some of the tutorial, however, you're talking about what regions are?

Quote:
Originally Posted by PipeDream
save people from a lot of bugs, particularly with weather and unit enters region events.
With the unit enters region thing, i was wondering are you talking about the fact that when you first make a region without any Off function, the trigger will keep triggering the action each time a unit enters the region etc.?
And bugs with weather? I'm sorry guys but what do you mean actually?

Please refresh my memmory, bugs with weather etc. i'm afaid i can't remember those bugs.
09-10-2006, 06:37 PM#6
PitzerMike
Ok, here's the deal, Archian:

The regions that your tutirial is about are called rects in JASS, that is because they are rectangular.
Besides rects JASS does also have the type region which is composed of many tiny sqares, so that you can have regions with any shape you want (for example a circle)

Now for the 'Unit enters Rect'-event: When this event is registered with a trigger, WC creates a temporary rectangular JASS-region with the same dimension as your GUI-region that you specified in the trigger editor. And the event will be registered for that temporary JASS-region, not for the rect (because rects technically don't even have Enter/Leave-Events).

So anyway, if you later on use the 'Move Region' trigger action, the rect will be moved, but not the temp region used in the event. So the Event will still fire on the old position of the rect and not the new position.


I think it's important for a tutorial about regions to work out the difference between JASS and GUI regions.
09-13-2006, 02:04 PM#7
Archian
Oh yes, yes i see, thank you PitzerMike, rep to you

Anyway do you want me to simply include this within the tutorial?
09-13-2006, 07:43 PM#8
PitzerMike
You should (if you find my wording appropriate).
09-18-2006, 08:14 PM#9
PitzerMike
Approved.