• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Calling(/creating) Dynamic Regions

Status
Not open for further replies.
Level 4
Joined
Dec 6, 2008
Messages
84
How do you reference dynamic regions using GUI? For example:
Unit drops an item; create <Region> centered at item being manipulated.
The event - A unit enters region - only works for regions that are created at initialization and do not keep track of region placement updates.
I need to know when a unit enters this <Region> but the region is constantly changing position. I've tried every all sorts of different methods but nothing seems to work =/
 
Level 12
Joined
Aug 22, 2008
Messages
911
Regions cannot be created via triggers, neither GUI or JASS. However you can center a region (move it from its center) to a certain point..
I think a more suitable function would be to use the event (A unit comes within range of unit).

I'm clueless since you did not describe the problematic situation, so please explain yourself literally.
In other words, explain- your thread was a bit narrow.
 
Level 4
Joined
Dec 6, 2008
Messages
84
okay this is my problem:
A unit is carrying a flag. Once that unit dies, it drops the flag. Once he drops it, a stationary region is created from the center of this item. I need a trigger that knows when any unit enters this region. "Unit within range" does not work since it is an item and it only works for other units.
 
Level 12
Joined
Aug 22, 2008
Messages
911
When the unit drops the item, center the region on the item.
Create a trigger that will be initially disabled with the event 'A unit enters region', and enable it only when the item is dropped.
NOTE: Enable, not run.
When the item is picked again, disable the trigger.
There you have it.
 
Level 4
Joined
Dec 6, 2008
Messages
84
That was the first thing I tried, but it doesn't work; the region moves but the event is still called only when the unit enters the region defined at initialization. By "enable" you mean turn on/off correct? I unchecked the box "initally on" on the trigger that checks if a unit enters region and turn it on right after the region has been centered on the item, but doesn't work o_o
 
Level 12
Joined
Aug 22, 2008
Messages
911
  • Crazy Trigger
    • Events
      • Unit - A unit dies
    • Conditions
      • (Triggering unit) has the item YourItem equal to True
    • Actions
      • Make the item be at the position of the unit blablabla
      • ---------------Assume the region you created at the start is called ItemThing----------------------------
      • Region - Center ItemThing <gen> at Position of (Triggering Unit)
      • Trigger - Turn on Crazy Trigger 2
  • Crazy Trigger 2 //NOT INITIALLY ON
    • Events
      • Unit - A unit enters ItemThing
    • Conditions
    • Actions
      • Unit - Do anything to want to (Triggering Unit), in the end don't forget to disable the trigger using:
      • Trigger - Turn off (This trigger)
I know this is not very helpful, but this is the best I can do. Good luck!
 
Level 4
Joined
Dec 6, 2008
Messages
84
Thanks a lot for that, it helps to see it but that's what I tried first and I remember it didn't work, but I'll try again when I can and get back to you about it. The problem is that "ItemThing" remains the value it was at first given.
 
Level 4
Joined
Dec 6, 2008
Messages
84
I knew that would be my other option, and it will probably work, and having a circular region is also favorable. I was wondering if it was at all possible with regions, I guess not.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
Regions cannot be created via triggers, neither GUI or JASS.

What a load of rubbish, it is one of the biggest lies I have ever heard. Firstly, if JASS could not create them, then there would be no way to create them as they are indeed created by JASS appon map save (all regions are saved in the trigger script). Basically, you use the same natives that WE uses to make them in your scripts to make them.

Secondly, they are not actually regions, but rects. A region and rect object are different and what you make in the WE are rects. A region object is a container for rects, kind of like a group object is a container for units.

And yes, it is possiable to add region events at any time, like you can do for any kind of event for that mater. You simply make your rect, store it in a rect variable and then call your correct event creator and pass it the trigger and rect.
 
Level 4
Joined
Dec 6, 2008
Messages
84
And yes, it is possiable to add region events at any time, like you can do for any kind of event for that mater. You simply make your rect, store it in a rect variable and then call your correct event creator and pass it the trigger and rect.

Sounds cool but I have no idea what it means >.> mind explaining in more detail? I'm only used to GUI, so is there a way to do this with GUI?
 
Level 11
Joined
Oct 20, 2007
Messages
342
What a load of rubbish, it is one of the biggest lies I have ever heard. Firstly, if JASS could not create them, then there would be no way to create them as they are indeed created by JASS appon map save (all regions are saved in the trigger script). Basically, you use the same natives that WE uses to make them in your scripts to make them.
agree, xD LOL

Sounds cool but I have no idea what it means >.> mind explaining in more detail? I'm only used to GUI, so is there a way to do this with GUI?
try create a variable (crtl+B),
variable name: as you like (i name as "r1")
variable type: region


try this:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set r1 = (Region centered at (Position of (Triggering unit)) with size (100.00, 100.00))
(r1 has register as a variable, i will use it below)

other option to create rect:
  • Set r1 = (Region centered at (Point) with size (real,real))
  • Set r1 = (Region(real, real, real, real))
  • Set r1 = (Region((Point(real, real)), (Point(real, real))))
(Real is an Integer with decimal place)

A problem u will facing is you can't create an event like:
  • Unit - A unit enters r1 <gen>
using a "variable" region in event is not allowed.

but a way to fix this is:
make the trigger that you wanna use the event(Unit - A unit enters r1 <gen>).
like this:
  • Enter Region
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) the text: A unit has entered ...
and a trigger to fix the problem like this:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set r1 = (Region centered at (Player 1 (Red) start location) with size (100.00, 100.00))
      • Trigger - Add to Enter Region <gen> the event (Unit - A unit enters r1)
 
Level 4
Joined
Dec 6, 2008
Messages
84
Aha! So that's how you do it. This will simplify a lot of things in the future... Thanks lots!

Axel

EDIT:
Actually, it didn't work =/ The position of the region does not update....
 
Last edited by a moderator:
Level 4
Joined
Dec 6, 2008
Messages
84
Okay I got it. For dynamic variables, instead of doing "Trigger - Add to <Trigger> the <Event> in initialization, you can put it right after the position of the unit/region has been reassigned, and there you go! It updates for every change! But I still wouldn't have known the use of this command without all of your help.
 
Status
Not open for further replies.
Top