• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Regions have strange behaviour

Status
Not open for further replies.
Level 9
Joined
Dec 31, 2016
Messages
320
This works only when a unit enter a region from bottom or left side, otherwise it will not work. What is this? How can you check if the region contains the unit, as this works only half?

  • Untitled Trigger 001
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Playable map area) contains (Entering unit)) Equal to (==) True
    • Actions
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
 
Level 9
Joined
Dec 31, 2016
Messages
320
I wrote "playable map area", but actually I mean by that you can put any region instead of the map area. :D So if you wrote there any custom made region (not entire map area or something like that), then it would work as I wrote before.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
Look at the underlying JASS code, it all makes sense.

The event fires when a unit enters a region. GUI does not support regions. GUI "regions" are JASS rects. The region used by the event is generated by filling from the supplied rect. The area represented by the region is not the same as the rect. Testing if the unit is in the region in response to region entry will always work, but testing if the unit is in the rect (GUI region) used to fill the region will not work.
 
create variable of type boolean named EntersRegion_boolean
instead of this:
  • EntersRegion000 bugged
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Region 000 <gen> contains (Entering unit)) Equal to True
        • Then - Actions
        • Else - Actions
use this one
  • EntersRegion000 OK
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • Set tempUnit = (Entering unit)
      • Custom script: set udg_EntersRegion_boolean = IsUnitInRegion(GetTriggeringRegion(), udg_tempUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • EntersRegion_boolean Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: inside region
          • -------- tempUnit is in region --------
        • Else - Actions
          • Game - Display to (All players) the text: NOT inside region
          • -------- tempUnit is NOT in region --------
this will work for checking if unit is in region (gui) w/o bugs
 
Level 9
Joined
Dec 31, 2016
Messages
320
I do not understand the differences between region and rect, but I have found this to work. (with UMSWE)
  • Untitled Trigger 001
    • Events
      • Unit - A unit enters Trosky <gen>
    • Conditions
      • (Is (Entering unit) near (Center of Trosky <gen>) and within a range of 200.00) Equal to (==) True
    • Actions
      • Unit - Remove (Entering unit) from the game
 
Level 7
Joined
Mar 10, 2013
Messages
366
I do not understand the differences between region and rect, but I have found this to work. (with UMSWE)
  • Untitled Trigger 001
    • Events
      • Unit - A unit enters Trosky <gen>
    • Conditions
      • (Is (Entering unit) near (Center of Trosky <gen>) and within a range of 200.00) Equal to (==) True
    • Actions
      • Unit - Remove (Entering unit) from the game
This does not does the same as you wanted. The unit does not need too be inside de region, just close to it and the condition will be true.
 
The first shown trigger does not make very much sense, because if a unit triggers one region, that you don't need to make a new condition that checks for it again.
But to the problem, DSG explained about the offset -- for ones who are interested in reading more about it, [General] - game does not realise when region contains unit.
 
Status
Not open for further replies.
Top