Merging Regions?

AaronPwner

Member
Reaction score
0
How can I merge a region, or atleast create an abnormal shape (not a square/rectangle) as ONE region, I want to add visibility to an area I'm creating, but it's not a perfect rectangle, and I don't want to repeat the visibility command for like 8 regions.
 

Moridin

Snow Leopard
Reaction score
144
I haven't heard of any region merging system as of now......but if you want to add visibility to a certain region without the hassle of multiple regions...have you tried using dummies placed at certain points?
 

Romek

Super Moderator
Reaction score
963
A region can be any shape already. o_O
Rects are the square things that you use in GUI.

Rects can be added to regions.
 

AaronPwner

Member
Reaction score
0
How do I merge them then, or use these "rects" you speak of?

I'm sure it'll all make sense once I find whatever tool I am missing here.
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
Regions are only accessible in Jass, what you thought about regions is about to change.

In GUI, you only work with the data type "rect", not "region".
Rects are rectangles which can have a "center of rect", while regions are not bound the the limits of rects.
However, rects don't have any events with them. The trigger editor just converts the rect to a region and adds a event to a region firing the trigger once a unit enters the "region".
This is why there is no such thing as "Get Triggering Rect", because it can't be bound to events, While "Get Triggering Region" does exist.

Regions can exist all over the map, and don't have to be connected with one each other. The bad side of this is that you won't have a "center of region". This can only be done with rects as I said before.

You can merge the rects to a region with little skill of Jass required, however I say again, Get center of "rect" will not work correctly because you don't have refference to which rect actually fired the region event.
This method however will require you to change your trigger to custom text.
If you are willing to give that up, then do the following. If not, learn some real vJass and you'll be on your way creating results exactly how you want it.

Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • -------- Do your actions --------


Convert your trigger to custom text

JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    // Do your actions
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_Untitled_Trigger_001, gg_rct_Region_000 )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction


Note: gg_rct_Region_000
Where: gg_rct_Region_000 == your region name > "Region 000"
Change the results of where you see "CreateTrigger( )" to this:

JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    // Do your actions
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    local region g = CreateRegion()
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    
    call RegionAddRect( g, gg_rct_Region_000 )
    call RegionAddRect( g, gg_rct_Region_001 )
    // Add many more rects as you please.
    
    // Change this as well, by removing the call to the "RectSimple" function.
    call TriggerRegisterEnterRegion( gg_trg_Untitled_Trigger_001, g )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )

    set g = null
endfunction


However, all of this has the same effect as this..

Trigger:
  • Untitled Trigger 001
    • Events
      • Unit - A unit enters Region 000 <gen>
      • Unit - A unit enters Region 001 <gen>
    • Conditions
    • Actions
      • -------- Do your actions --------

It's just a little faster.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top