Checking if a unit is in the area

Status
Not open for further replies.
Level 2
Joined
Jul 16, 2023
Messages
5
I'm doing a creep wave system.
I need to change the creep wave when I improve a building.
I wanted to make a trigger to check if the building (unit) is in a certain area, if it is a level 1 barracks, then certain units come out, if it is already a level 2 barracks, then other units.
Can you advise how to implement this correctly?
I am a beginner, so if the answers will be very detailed and with examples, I will be very grateful.
 
Level 30
Joined
Aug 29, 2012
Messages
1,382
If you're upgrading using the standard WC3 way like scout tower > watch tower, you can do this

  • Upgrade
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (MyRegion <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • -------- Do stuff here --------
        • Else - Actions
The condition is a boolean comparison "unit in region"
 
Level 2
Joined
Jul 16, 2023
Messages
5
If you're upgrading using the standard WC3 way like scout tower > watch tower, you can do this

  • Upgrade
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (MyRegion <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • -------- Do stuff here --------
        • Else - Actions
The condition is a boolean comparison "unit in region"
I can't find the features I need :cry:
Can you send me the file with the trigger, if you don't mind?
It is still difficult for me to navigate and search for the right parameters in triggers
 
Level 30
Joined
Aug 29, 2012
Messages
1,382
It was just a temporary map I made, I don't have it any longer, but here are the actions:

The first is an if/then/else

1702206911311.png


And the condition is here


1702206986800.png
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
What's kind of relevant is if this check only needs to happen once per area or per player (or per player per area), and what should happen if the unit dies. In the Do stuff here section you'll probably want to set boolean variable to true, then check the value of that boolean when you create the units:
  • -------- Do stuff here --------
  • Set UpgradedBarracks = True
  • If (All conditions are true) then do (Then actions) else do (Else actions)
    • If - Conditions
      • UpgradedBarracks equal to False
    • Then - Actions
      • -------- do normal stuff --------
    • Else - Actions
      • -------- do upgraded stuff --------
 
Status
Not open for further replies.
Top