Region Trigger Help

Status
Not open for further replies.
Level 4
Joined
May 24, 2017
Messages
93
Can somebody explain why these triggers wont work? The first one creates the point and moves the regions but it wont add the units to the unit group when they enter/leave the regions. WHy would the unit enters/leaves a region event not work?
  • Acid Rain
    • Events
      • Player - Player 1 (Red) types a chat message containing -test as An exact match
    • Conditions
    • Actions
      • Set VariableSet Boss = |cffff0000Dark Obelisk|r 0019 <gen>
      • Set VariableSet Acid_Regions[1] = Acid 1 <gen>
      • Set VariableSet Acid_Regions[2] = Acid 2 <gen>
      • Set VariableSet Acid_Regions[3] = Acid 3 <gen>
      • Set VariableSet Acid_Regions[4] = Acid 4 <gen>
      • Set VariableSet Acid_Regions[5] = Acid 5 <gen>
      • Set VariableSet Acid_Regions[6] = Acid 6 <gen>
      • Set VariableSet Acid_ON = True
      • Region - Center Acid Rain Region <gen> on (Position of Boss)
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set VariableSet Acid_Point = (Random point in Acid Rain Region <gen>)
          • Environment - Change terrain type at Acid_Point to Felwood - Poison using variation -1 in an area of size 2 and shape Square
            • Region - Center Acid_Regions[(Integer A)] on Acid_Point
  • Enter Acid
    • Events
      • Unit - A unit enters Acid 1 <gen>
      • Unit - A unit enters Acid 2 <gen>
      • Unit - A unit enters Acid 3 <gen>
      • Unit - A unit enters Acid 4 <gen>
      • Unit - A unit enters Acid 5 <gen>
      • Unit - A unit enters Acid 6 <gen>
    • Conditions
    • Actions
      • Unit Group - Add (Triggering unit) to Acid_Damage_Group
      • Game - Display to (All players) the text: enter
  • Leave Acid
    • Events
      • Unit - A unit leaves Acid 1 <gen>
      • Unit - A unit leaves Acid 2 <gen>
      • Unit - A unit leaves Acid 3 <gen>
      • Unit - A unit leaves Acid 4 <gen>
      • Unit - A unit leaves Acid 5 <gen>
      • Unit - A unit leaves Acid 6 <gen>
    • Conditions
    • Actions
      • Unit Group - Remove (Triggering unit) from Acid_Damage_Group.
      • Game - Display to (All players) the text: leave
The text is for testing
 
Level 12
Joined
Jan 30, 2020
Messages
875
In GUI, regions are just rects (squares).

To use real Regions, you need to use Jass or Lua.
In Jass or Lua, you can add or remove rects from regions, then everything will work.

In GUI, when you move a rect, it won't update the region but just the rect as the region was registered as containing your initial rect.

In other words, to be able to make this work with GUI, you need to recreate your triggers everytime you move your rects. (I mean your triggers checking entering region events)
 
Level 4
Joined
May 24, 2017
Messages
93
So after I move the regions, I could just add the events back in and it would work? I need to delete the events and add them after I move the regions?

I also pinged the regions after they were moved and they pinged in the right places, how is this possable with your explanation?

EDIT: Does this new trigger work the way you suggested?
  • Acid Rain
    • Events
      • Player - Player 1 (Red) types a chat message containing -test as An exact match
    • Conditions
    • Actions
      • Set VariableSet Boss = |cffff0000Dark Obelisk|r 0019 <gen>
      • Set VariableSet Acid_Regions[1] = Acid 1 <gen>
      • Set VariableSet Acid_Regions[2] = Acid 2 <gen>
      • Set VariableSet Acid_Regions[3] = Acid 3 <gen>
      • Set VariableSet Acid_Regions[4] = Acid 4 <gen>
      • Set VariableSet Acid_Regions[5] = Acid 5 <gen>
      • Set VariableSet Acid_Regions[6] = Acid 6 <gen>
      • Set VariableSet Acid_ON = True
      • Region - Center Acid Rain Region <gen> on (Position of Boss)
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set VariableSet Acid_Point = (Random point in Acid Rain Region <gen>)
          • Environment - Change terrain type at Acid_Point to Felwood - Poison using variation -1 in an area of size 2 and shape Square
          • Region - Center Acid_Regions[(Integer A)] on Acid_Point
          • Custom script: call RemoveLocation(udg_Acid_Point)
      • Trigger - Add to Enter Acid <gen> the event (Unit - A unit enters Acid 1 <gen>)
      • Trigger - Add to Enter Acid <gen> the event (Unit - A unit enters Acid 2 <gen>)
      • Trigger - Add to Enter Acid <gen> the event (Unit - A unit enters Acid 3 <gen>)
      • Trigger - Add to Enter Acid <gen> the event (Unit - A unit enters Acid 4 <gen>)
      • Trigger - Add to Enter Acid <gen> the event (Unit - A unit enters Acid 5 <gen>)
      • Trigger - Add to Enter Acid <gen> the event (Unit - A unit enters Acid 6 <gen>)
      • Trigger - Add to Leave Acid <gen> the event (Unit - A unit leaves Acid 1 <gen>)
      • Trigger - Add to Leave Acid <gen> the event (Unit - A unit leaves Acid 2 <gen>)
      • Trigger - Add to Leave Acid <gen> the event (Unit - A unit leaves Acid 3 <gen>)
      • Trigger - Add to Leave Acid <gen> the event (Unit - A unit leaves Acid 4 <gen>)
      • Trigger - Add to Leave Acid <gen> the event (Unit - A unit leaves Acid 5 <gen>)
      • Trigger - Add to Leave Acid <gen> the event (Unit - A unit leaves Acid 6 <gen>)
 
Last edited:
Level 12
Joined
Jan 30, 2020
Messages
875
No you can't delete events from triggers.
You need to destroy the trigger and recreate it, but i realize in might not be possible in GUI, although it might be because my GUI knowledge has evaporated after 16 years of not using it.

But you could also use some Jass or Lua (if you are unfamiliar with both, I would strongly advise to use Lua for multiple reasons), to be able to use the native Regions, and then all that would be needed is remove the old rects from the regions and add the new ones.

This would make your problem solved.

Best thing to do would be set your scripting language (options) to Lua, then export your map script, then find your dedicated trigger, copy it, delete the GUI version from your map, create a new custom script and paste the code copied earlier in it.

Then I could help you rewrite that custom script trigger.
 
Level 4
Joined
May 24, 2017
Messages
93
I removed the events and used that trigger and my code now works. It adds and removes units after they move in and out of the new regions. Thank you anyway
 
Status
Not open for further replies.
Top