HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Move Region

03-15-2009, 10:04 PM#1
Waynebebay
I created a simple trigger to when a building is built then a region would center on it. I have tested it multiple times and the region seems to stay in place.

Trigger:
Constructed Chamber
Collapse Events
Unit - A unit Finishes construction
Collapse Conditions
(Unit-type of (Constructed structure)) Equal to Conversion Chamber
Collapse Actions
Set Conv_Chamber = (Constructed structure)
Region - Center CONV CHAMBER <gen> on (Random point in (Playable map area))

It says random point so I could just monitor it's movement or there lack of.

I don't know any JASS or programming languages for the WE

Please help.
03-15-2009, 10:10 PM#2
Michael Peppers
Quote:
Originally Posted by Waynebebay
I created a simple trigger to when a building is built then a region would center on it. I have tested it multiple times and the region seems to stay in place.

Trigger:
Constructed Chamber
Collapse Events
Unit - A unit Finishes construction
Collapse Conditions
(Unit-type of (Constructed structure)) Equal to Conversion Chamber
Collapse Actions
Set Conv_Chamber = (Constructed structure)
Region - Center CONV CHAMBER <gen> on (Random point in (Playable map area))

It says random point so I could just monitor it's movement or there lack of.

I don't know any JASS or programming languages for the WE

Please help.

The tooltip says "this has no effect unless the specified region is a variable", set a variable for the region you're using at it should go fine.
03-15-2009, 10:15 PM#3
TheKid
No, what that means is that it cannot be something like "Current Camera Bounds". When a region is converted to JASS (it is a rect) and it looks like gg_rct_Rect_Name, so that qualifies as a variable.

The reason its not working is because instead of using "Random point in (Playable map area)" you should be using "Position of (Triggering unit)". Hope this helps.
03-15-2009, 11:06 PM#4
Waynebebay
Quote:
Originally Posted by TheKid
The reason its not working is because instead of using "Random point in (Playable map area)" you should be using "Position of (Triggering unit)". Hope this helps.

Yea I tried putting the positioning as the position of the constructed building and it still didn't work.

I just tried this

Trigger:
Set CONV_REG = CONV CHAMBER <gen>

then added this to the main trigger:

Trigger:
Region - Center CONV_REG on (Position of Conv_Chamber)

And it didn't work.
03-15-2009, 11:41 PM#5
TheKid
Where did this "CONV_REG" variable come from?

Why don't you just set the region "CONV CHAMBER" to something like this:
Trigger:
Untitled Trigger 003
Collapse Events
Unit - A unit Finishes construction
Collapse Conditions
(Unit-type of (Constructed structure)) Equal to Scout Tower
Collapse Actions
Set TempRect = (Region centered at (Position of (Constructed structure)) with size (64.00, 64.00))

This would set 'TempRect' to a box around the constructed structure with height/width of 64 units.
03-16-2009, 12:52 AM#6
Captain Griffen
Region != region. Heck, in GUI, region is not always equal to region...

GUI regions are a total and utter mess.

Also, don't name variables the same names as each other but differentiated only by case. Bad shit happens.
03-16-2009, 02:33 AM#7
ShadowWolf
Griffen is right, you're treating two different things the same when they shouldn't be.

What you're doing is like trying to change a constant. Moving "regions" only works on regions created with triggers (then assigned to a variable). You can't move regions placed in the WE afaik.
03-16-2009, 07:01 AM#8
Bobo_The_Kodo
Quote:
You can't move regions placed in the WE afaik.
Yes you can move around rects placed in the WE

They aren't different from any other rect
03-16-2009, 08:10 AM#9
Fledermaus
What are you trying to do with the Region after its position is set? If you're trying to use "Unit - A unit enters CONV CHAMBER <gen>", it will fail because of how that GUI function works.
03-16-2009, 02:29 PM#10
Waynebebay
Yes I want to make it so when the building is built and a certain unit enters it's area then an even happens. That is exactly what I want to do.

Alright some of this makes sense and some of it doesn't... Let me explain what I did.

I set up a region in the Editor named CONV CHAMBER, placed it in some trees just as a place holder. I am setting up this trigger to move the region around the actual chamber when it is finished constructing. There is a certain unit that I want to bring into the vicinity of the chamber and have an event happen.

Now some of you are saying it won't work and I don't understand the explanations. I assigned the CONV_REG region in the Init triggers to register the variable right off the bat.

Listen if I could just only use a trigger saying "Unit comes within [range] of conversion chamber" then I would BUT that range trigger is confusing to me because it doesn't use the variables i register... I dunno it's weird.

Sorry if I am pissing some of you off, I wish I had time and tolerance to learn JASS and other languages but I just don't understand them, let alone C.
03-16-2009, 03:31 PM#11
Fledermaus
Trigger:
Unit - A unit enters CONV CHAMBER <gen>
becomes
Collapse JASS:
function TriggerRegisterEnterRectSimple takes trigger trig, rect r returns event
    local region rectRegion = CreateRegion()
    call RegionAddRect(rectRegion, r)
    return TriggerRegisterEnterRegion(trig, rectRegion, null)
endfunction
What this does is takes the "Region" (actually a rect) that you use it on (in your case, CONV CHAMBER <gen>) and adds it to a region and then registers the EnterRegion event to the trigger.
Then when you use
Trigger:
Region - Center CONV CHAMBER <gen> on (Position of Conv_Chamber)
it moves the "Region" (again, actually a rect). However this does not effect the region that the EnterRegion event has registered. So the trigger with the "Unit - A unit enters CONV CHAMBER <gen>" event will only trigger when a unit enters the region (not the "Region").

Ahhh, I hope all this makes sense.. It's 4am xD



tldr: here's how you fix your problem:
Trigger:
Constructed Chamber
Collapse Events
Unit - A unit Finishes construction
Collapse Conditions
(Unit-type of (Constructed structure)) Equal to Conversion Chamber
Collapse Actions
Set Conv_Chamber = (Constructed structure)
Set Conv_Region = (Region centered at (Position of Conv_Chamber) with size (width, height))
Trigger - Add to Some Trigger the event (Unit - A unit enters Conv_Region)
where Some Trigger is the trigger that responds to the Unit Entering the "Region".
03-16-2009, 10:30 PM#12
Waynebebay
So what you are saying is that when the region is registered it is registered to that exact location and that when the region is moved the new location isn't the registered one?

Either way I tried this:

Trigger:
Constructed Chamber
Collapse Events
Unit - A unit Finishes construction
Collapse Conditions
(Unit-type of (Constructed structure)) Equal to Conversion Chamber
Collapse Actions
Set Conv_Chamber = (Constructed structure)
Set CONV_REG = (Region centered at (Position of Conv_Chamber) with size (64.00, 64.00))

Which is all fine and dandy BUT when I create a new trigger for the unit entering the region it WON'T use variables, instead the event (Unit - unit enters region) only wants regions that aren't variables.
03-16-2009, 11:32 PM#13
Fledermaus
Quote:
Originally Posted by Waynebebay
So what you are saying is that when the region is registered it is registered to that exact location and that when the region is moved the new location isn't the registered one?
Correct.

Quote:
Originally Posted by Waynebebay
Either way I tried this:

Trigger:
Constructed Chamber
Collapse Events
Unit - A unit Finishes construction
Collapse Conditions
(Unit-type of (Constructed structure)) Equal to Conversion Chamber
Collapse Actions
Set Conv_Chamber = (Constructed structure)
Set CONV_REG = (Region centered at (Position of Conv_Chamber) with size (64.00, 64.00))

Which is all fine and dandy BUT when I create a new trigger for the unit entering the region it WON'T use variables, instead the event (Unit - unit enters region) only wants regions that aren't variables.
Which is why you don't register the Unit Enters Region event in the trigger but rather after you have created the region with
Trigger:
Trigger - Add to Some Trigger the event (Unit - A unit enters Conv_Region)
03-17-2009, 07:20 PM#14
Waynebebay
So if the trigger adds an event I don't need to make an event. Does it just add the event and keep the trigger running or do i have to turn it on with another trigger?

This is what I got now:

Trigger:
Constructed Chamber
Collapse Events
Unit - A unit Finishes construction
Collapse Conditions
(Unit-type of (Constructed structure)) Equal to Conversion Chamber
Collapse Actions
Set Conv_Chamber = (Constructed structure)
Set CONV_REG = (Region centered at (Position of Conv_Chamber) with size (150.00, 150.00))
Trigger - Add to Conversion <gen> the event (Unit - A unit enters CONV_REG)

And then here is Conversion <gen>

Trigger:
Conversion
Events
Collapse Conditions
(Unit-type of (Entering unit)) Equal to Empty Corpse
Collapse Actions
Set HERO_RANDOM = (Random integer number between 1 and 9)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HERO_RANDOM Equal to 1
Collapse Then - Actions
Unit - Create 1 Paladin for Player 3 (Teal) at (Position of Hero_War) facing Default building facing degrees
Unit - Remove Hero_War from the game
Set Hero_War = (Last created unit)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HERO_RANDOM Equal to 2
Collapse Then - Actions
Unit - Create 1 Death Knight for Player 3 (Teal) at (Position of Hero_War) facing Default building facing degrees
Unit - Remove Hero_War from the game
Set Hero_War = (Last created unit)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HERO_RANDOM Equal to 3
Collapse Then - Actions
Unit - Create 1 Beastmaster for Player 3 (Teal) at (Position of Hero_War) facing Default building facing degrees
Unit - Remove Hero_War from the game
Set Hero_War = (Last created unit)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HERO_RANDOM Equal to 4
Collapse Then - Actions
Unit - Create 1 Sylvanas for Player 3 (Teal) at (Position of Hero_War) facing Default building facing degrees
Unit - Remove Hero_War from the game
Set Hero_War = (Last created unit)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HERO_RANDOM Equal to 5
Collapse Then - Actions
Unit - Create 1 Tyrande for Player 3 (Teal) at (Position of Hero_War) facing Default building facing degrees
Unit - Remove Hero_War from the game
Set Hero_War = (Last created unit)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HERO_RANDOM Equal to 6
Collapse Then - Actions
Unit - Create 1 Naga Sea Witch for Player 3 (Teal) at (Position of Hero_War) facing Default building facing degrees
Unit - Remove Hero_War from the game
Set Hero_War = (Last created unit)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HERO_RANDOM Equal to 7
Collapse Then - Actions
Unit - Create 1 Blood Mage for Player 3 (Teal) at (Position of Hero_War) facing Default building facing degrees
Unit - Remove Hero_War from the game
Set Hero_War = (Last created unit)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HERO_RANDOM Equal to 8
Collapse Then - Actions
Unit - Create 1 Furion for Player 3 (Teal) at (Position of Hero_War) facing Default building facing degrees
Unit - Remove Hero_War from the game
Set Hero_War = (Last created unit)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HERO_RANDOM Equal to 9
Collapse Then - Actions
Unit - Create 1 Firelord for Player 3 (Teal) at (Position of Hero_War) facing Default building facing degrees
Unit - Remove Hero_War from the game
Set Hero_War = (Last created unit)
Else - Actions

It still doesn't work.
03-17-2009, 08:52 PM#15
ShadowWolf
You could also just refer to that region with a variable, and when you "move" the region, create a new but similar region in the place you want it, assign it to that variable, and remove the old region.