• 🏆 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!

[Trigger] Move a Region

Status
Not open for further replies.
Level 40
Joined
Dec 14, 2005
Messages
10,532
I suspect the issue you're having is that WC3's implementation of regions (rects) in GUI is really bad.

Basically, what GUI calls a region (actually called a rect) is a square on the map. However, what a region actually is is a collection of points on the map which can be of any arbitrary shape. When you register any rect event in GUI, what the game is doing behind the scenes is adding that rect to a region and registering an enter region event:

JASS:
function TriggerRegisterEnterRectSimple takes trigger trig, rect r returns event

    local region rectRegion = CreateRegion()

    call RegionAddRect(rectRegion, r)

    return TriggerRegisterEnterRegion(trig, rectRegion, null)

endfunction

As a result, if you modify the rect after the fact, any associated triggers won't notice since they aren't actually tracking the rect, but the underlying region.

Possible solutions:

  1. Code relevant triggers in JASS so that you have direct access to the region variable.
  2. Destroy the trigger and re-create it with a new event whenever you move the region.
 
Last edited:
Level 29
Joined
Oct 24, 2012
Messages
6,543
Move region does work.

The reason you may think that it does not work is that when you create an event that is where they are created. Events never get updated.

Example: Unit enters region 1
Move region 1 to new location
Region does move but the event unit enters region still points to the original region.

To make this work you have to add the event again to the region.
 
Level 12
Joined
Mar 17, 2007
Messages
412
Move region does work.

The reason you may think that it does not work is that when you create an event that is where they are created. Events never get updated.

Example: Unit enters region 1
Move region 1 to new location
Region does move but the event unit enters region still points to the original region.

To make this work you have to add the event again to the region.

Right, it also shows that it needs a variable for example what I did was already set a region using the "editor" then I set [RegionVariable] = [RegionEditorGround]

When I order the move I get minimap screen flicker & sometimes forces my screen to move center and I'm left a bit confused.

I've also tried moving it with & without the variable & both at the sametime = same result
 
Status
Not open for further replies.
Top