HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger Help :/

01-29-2004, 11:18 PM#1
|LMM|Duff_Man
i know this might sound stupid however...........


How do you make it when a unit enters a certain region an event?
it probablyis extremely simple , but in the Event-Unit-Enters a region, the only choices you have are Create a Region, No region and triggering region, but in the conditions i can't manage to find a way to say "Triggering Region = Region BLAH

thanks guys i know this probably such a simple problem
~Duff
01-29-2004, 11:25 PM#2
FallenDarkness
Scroll down in the events log until you come to the section of units right under the TIME section. Where is says "Unit Enters Region," click that and then it will come up and say "A unit enters (Your Region Here)"

There you have it.
01-29-2004, 11:43 PM#3
|LMM|Duff_Man
god damnit, i swear , i think it's UMSWE but i know what you mean usally under vairables it will have an option of selecting a region but i swearit doesn't have regions as an option


~Duff


EDIT : wait i was using it as a region not a rect, whats the difference?
01-29-2004, 11:57 PM#4
Shadow_Strike
no difference b/w region and rect
01-30-2004, 12:00 AM#5
LegolasArcher
There is. From my understanding rects are the normal WE's regions. Regions arnt all rectangular. you can onkly use variables by adding the event in a different trigger.
01-30-2004, 12:37 AM#6
|LMM|Duff_Man
wait are you telling me i can essential free hand draw a region in UMSWE? Like a triange region or a circle?
If it's true ,, nice :)
01-30-2004, 12:45 AM#7
Dark Illidan
no what you do is take 2 or more rects and with triggers make the game think of them as one, but i wish there was a freehand rect tool that would be great:ggani:
01-30-2004, 01:33 AM#8
|LMM|Duff_Man
yeah that would be delicious , how do you combine regions?
01-30-2004, 02:12 AM#9
Dark Illidan
there should be a read me in the UMSWE you DL ed. it is in there, i dont remember how to.

found it


Usage of Regions in UMSWE 4

Tutorial Version 1.0

A) Introduction:

This tutorial will show you how to use Regions in UMSWE 4. You can review the steps explained in chapter D in a sample map provided with UMSWE: regionsample.w3m.


B) What is a Region?:

Most mappers know regions from the World Editor. There is a Region Palette, where you can place new regions or edit existing ones. When it comes to triggers, especially custom script, some of you might have noticed that all variables of the regions are of type rect. In common.j (main script library for Warcraft III) there are two types defined: rect and region. For the sake of simplicity Blizzard named rects "Regions" and hid away the real regions.
In UMSWE 4 you won't find a "Region Palette", but instead a "Rect Palette". The reason for this change is that a region is something entire different, when compared with a rect. A rect is that, what is used to you as Region.
The main difference is that a region can consist of multiple rects. It doesn't have to be quadrangular and it needn't be one part only. The following pictures should serve as examples:


Image 1: Two non-overlapping rects define a region.


Image 2: Two overlapping rects define a region.



C) Why do we need regions?:

While we can continue to work without regions, there are some specific tasks, that can be simplified when using regions. In some cases it can save a lot of time and work. Just think of a map, where you want to perform some actions, when a unit enters one of two (or more) rects. Without regions you would have to set up two (or more) nearly equal triggers.


D) How to use regions?:

This step by step guide shows how to set up a trigger, that fires, if a unit enters the region, which consists of 2 (or more) rects.

1.) Before you can use regions, you maybe want to place some rects, which resemble the parts of the region.

2.) Create a new Region variable:

Go to the Trigger Editor and open the Variables dialog (Edit -> Variables...).

Create a new variable (click at the green icon or press Ctrl+N).

Enter a variable name (e.g.: myregion).

Set the Variable Type to "Region".

Confirm the new variable with OK.

3.) Initialize the new variable:
To initialize region variables I suggest to create a new trigger, that runs at Map Initialization.

Create a new trigger and name it "Initialize Regions".

Add the event Map initialization.

Add for each rect you want to add the action "Region - Add Rect".

After these steps the trigger should look similiar to that:

Initialize Regions
Events
Map initialization
Conditions
Actions
Region - To myregion add Rect 000 <gen>
Region - To myregion add Rect 001 <gen>

Note: If you want to initialize more than one region, I suggest to put them all into this trigger, but sepparate the parts with comments.

4.) Create the main trigger:
This is the trigger, that fires, if a unit enters your region.

Create a new trigger and name it "Enter myregion".

You might want to add a new event "Unit - Unit enters Region". You will notice that you can't select your region variable, as events require generated variables. The reason for this is simple. All triggers are created when the map loads. So the variable has to be defined BEFORE any trigger runs. You can't use your variable, as it will be defined AFTER the creation of the triggers. But this doesn't mean, that you can't make that event. You have to go back to the "Initialize Regions" trigger and add an additional action:

Trigger - Add to Enter myregion <gen> the event (Unit - A unit enters myregion)

So the "Initialize Regions" trigger looks like:

Initialize Regions
Events
Map initialization
Conditions
Actions
Region - To myregion add Rect 000 <gen>
Region - To myregion add Rect 001 <gen>
Trigger - Add to Enter myregion <gen> the event (Unit - A unit enters myregion)

Now you can setup your trigger, that fires, when a unit enters your region. In my example, I just added a simple effect:

Actions
Special Effect - Create a special effect at (Center of (Playable map area)) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl

This looks now like a huge load of work, but for some very extensive tasks, this can save a lot of time and work. Now that you have learned the basics of regions, you can use your creativity to create amazing effects.

E) Trigger reference:

In this section all events/conditions/actions/functions that are useful when working with regions are listed:

Events:
Unit - A unit enters <Region>
Unit - A unit enters <Region> Matching: <Condition>
Unit - A unit leaves <Region>
Unit - A unit leaves <Region> Matching: <Condition>

Conditions:
-

Actions:
Region - To <Region> add <Rect>
Region - From <Region> remove <Rect>
Region - To <Region> add cell at offset(<X>, <Y>)
Region - To <Region> add cell at <Point>
Region - Remove <Region>
Region - From <Region> remove cell at offset(<X>, <Y>)
Region - From <Region> remove cell at <Point>

Functions that return a region:
Event Response - Triggering Region
Region - Create Region

Functions that take a region as parameter:
<Region> contains offset(<X>, <Y>)
<Region> contains <Point>
In <Region> there is <Unit>


ya
01-30-2004, 02:34 AM#10
|LMM|Duff_Man
Cool thanks man

~Duff

BTW there is no reason for this thread to continue to get posts, if it gets any it's spam,MODS: you can lock this now, if you feel the need : /