Region triggers

DonMushroom

Member
Reaction score
4
Hi again :)

I was wondering if it is possible to make a trigger that reviles the player when there opponent has a unit in 4 different regions? :)



So if player 1 holds region 1,2,3 and 4 then player 2 is relieved to everyone on players 1's team.
 

DonMushroom

Member
Reaction score
4
OK so i can reveal the map when i want it to :)

Events
Timer - Every 1.0 seconds of Game Time
Local Variables
P = 0 <Integer>
Conditions
Actions
General - For each integer P from 1 to 8 with increment 1, do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Number of Living units in (Any units in Region 001 M owned by player P matching Excluded: Structure, Missile, Cloaked, Dead, Hidden, with at most Any Amount)) > 0
(Number of Living units in (Any units in Region 002 M owned by player P matching Excluded: Structure, Missile, Cloaked, Dead, Hidden, with at most Any Amount)) > 0
(Number of Living units in (Any units in Region 003 M owned by player P matching Excluded: Structure, Missile, Cloaked, Dead, Hidden, with at most Any Amount)) > 0
(Number of Living units in (Any units in Region 004 M owned by player P matching Excluded: Structure, Missile, Cloaked, Dead, Hidden, with at most Any Amount)) > 0
(Number of Living units in (Any units in Region 005 M owned by player P matching Excluded: Structure, Missile, Cloaked, Dead, Hidden, with at most Any Amount)) > 0
(Number of Living units in (Any units in Region 006 M owned by player P matching Excluded: Structure, Missile, Cloaked, Dead, Hidden, with at most Any Amount)) > 0
(Number of Living units in (Any units in Region 007 M owned by player P matching Excluded: Structure, Missile, Cloaked, Dead, Hidden, with at most Any Amount)) > 0
(Number of Living units in (Any units in Region 008 M owned by player P matching Excluded: Structure, Missile, Cloaked, Dead, Hidden, with at most Any Amount)) > 0
Then
Visibility - Create a visibility revealer for player P within (Entire map)
Else


So when a unit holds the all the points the map reveals :)

I am now having trouble with removing the revealer when one or more of the points is lost :(


How would i go about this? :D
 

Kyuft

Member
Reaction score
11
Instead of "Action: Every 1 second game time", wouldn't it be more efficient to do "Unit enters Region" and make the action run for the triggering player.

-Kyuft:shades:
 

Kyuft

Member
Reaction score
11
Are revealers considered units? If so, you could make an action under the "Else" tag that kills all units of unit type Revealer owned by the player.

-Kyuft:shades:
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
Revealers is a seperate object type (You can save it in a Revealer variable).

I'd do something similar to what Kyuft suggested. Have a trigger with events for "Unit enters region" for all your four regions and then check if the owner of the triggering unit has units in all the regions. If he does, create a new revealer and save it in a revealer variable array with size 15(Just to make sure you fit all possible players). Save it in RevealArray[(Triggering Player)]. You might want to check if RevealArray[(Triggering Player)] == No revealer, before you create it. Just so you'll prevent it from creating additional revealers if you enter with more units.

Next up, have a trigger that triggers if a unit leaves any of the four regions. Remove RevealArray[(Triggering Player)].

I think both me and DonMushroom would be grateful if someone with a bit of triggering experience could take what I just wrote and turn it into actual triggers to post here. Assuming what I wrote is correct, which is not always the case. I would do it myself but Physics finals, laptop, no editor etc.
 

Dave312

Censored for your safe viewing
Reaction score
269
I need a couple of clarifications as to how this is supposed to work so I can post some triggers:

1) Do you want to reveal the entire map or just the opposing players units?
2) If just revealing the opposing players units, should it be revealing the units of every player on that team?
3) Does the same player need to have units in every region or should it also reveal provided that team has one unit in each region? (ie, if players 5,6,7 and 8 are on the same team, should it reveal the opposition if Player 5 has a unit in Region 1, Player 6 has a unit in Region 2, Player 7 has a unit in Region 3 and Player 8 has a unit in Region 4?
 

MissKerrigan

Active Member
Reaction score
23
hey what you guys all doing difficould here with variables and stuff, just create conditions 'unit is in region and make action 'create revealer'. Create another trigger if unit leaves region, remove revailer

I assuming it's something like a 'xel naga tower'?
 

DonMushroom

Member
Reaction score
4
Dave :)

1) Opposing players units
2) Every player on team that does not have points
3) The team has all the points between them

Kerrigan :)

I need all that because im trying to link 16 regions to a revieler to work with different combinations of the regions being held by different players :D
 

Dave312

Censored for your safe viewing
Reaction score
269
First of all I wouldn't be using revealers to grant the vision but instead use the Set Alliance Aspect action to grant one directional shared vision of the players units. This makes things easier because you don't need to worry about using variables to keep track of all the revealers and Shared Vision can be simply turned off.


Just to confirm: There are 16 regions which players "control". When a team controls 4 or more, any players on the opposing team that do not control any regions are revealed. If a team with granted shared vision loses regions and controls less than 4, shared vision is lost. If player who has shared vision against them gains control over a region then opposing players lose shared vision against them. Is this correct?
 

DonMushroom

Member
Reaction score
4
There are 16 regions :)
8 players (4 each team)
If a team controls all 16 the other team gets relieved.
If a team has all 16 and loses 1 the other team is no longer reviled :)

I have put the current version of the map in members projects so everyone can see how its coming along :)
 

Dave312

Censored for your safe viewing
Reaction score
269
Sorry I had to do this in a rush so hopefully I haven't made any mistakes. The long condition uses a Number of Units In Unit Group function where the Unit Group parameter is set to the Units In Region With Alliance To Player. If you have any problems/questions, let me know.

Trigger:
  • Player Gains Region
    • Events
      • Unit - Any Unit Enters Region01
      • Unit - Any Unit Enters Region02
      • Unit - Any Unit Enters Region03
      • etc...
    • Local Variables
      • i = 0 &lt;Integer&gt;
      • j = 0 &lt;Integer&gt;
    • Conditions
    • Actions
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • (Number of Living units in (Units in (Region01) having alliance Ally with player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most 1)) == 1
          • (Number of Living units in (Units in (Region02) having alliance Ally with player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most 1)) == 1
          • (Number of Living units in (Units in (Region03) having alliance Ally with player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most 1)) == 1
          • etc...
        • Then
          • Player Group - For each player j in (Enemies of player (Triggering player)) do (Actions)
            • Actions
              • Player - Turn player j Shared Vision On towards player (Triggering player)
              • Player Group - For each player i in (Allies of player (Triggering player)) do (Actions)
                • Actions
                  • Player - Turn player j Shared Vision On towards player i
        • Else

Trigger:
  • Player Loses Region
    • Events
      • Unit - Any Unit Leaves Region01
      • Unit - Any Unit Leaves Region02
      • Unit - Any Unit Leaves Region03
      • etc...
    • Local Variables
      • i = 0 &lt;Integer&gt;
      • j = 0 &lt;Integer&gt;
    • Conditions
    • Actions
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • (Number of Living units in (Units in (Region01) having alliance Ally with player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most 1)) == 1
          • (Number of Living units in (Units in (Region02) having alliance Ally with player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most 1)) == 1
          • (Number of Living units in (Units in (Region03) having alliance Ally with player (Triggering player) matching Excluded: Missile, Dead, Hidden, with at most 1)) == 1
          • etc...
        • Then
        • Else
          • Player Group - For each player j in (Enemies of player (Triggering player)) do (Actions)
            • Actions
              • Player - Turn player j Shared Vision Off towards player (Triggering player)
              • Player Group - For each player i in (Allies of player (Triggering player)) do (Actions)
                • Actions
                  • Player - Turn player j Shared Vision Off towards player i
 

DonMushroom

Member
Reaction score
4
I cant seem to get the first part working :p. I have copied the gains region trigger but just used 1 region as a test but vision is not shared :(
 

Dave312

Censored for your safe viewing
Reaction score
269
What I missed was that the Allies of player (Triggering player) function doesn't return the triggering player. So it was working, it was just giving your allies the shared vision of your enemies but not you. I have updated my previous post with revised triggers that will work (I have tested them this time).
 

DonMushroom

Member
Reaction score
4
I changed the second trigger to

(Number of Living units in (Units in Region 001 G having alliance Ally with player (Triggering player) matching Excluded: Missile, Cloaked, Dead, Hidden, with at most 0)) == 0

It seems to work now :) Thanks again Dave :D
 

DonMushroom

Member
Reaction score
4
Ok scrap that :p.

The first region in the event list works. The rest don't seem to have any effect :(
If a unit dies in the region none of the events work at all. :(
The one region that works reviles the whole map. (This works fine for me :) Just letting you know)
 

Dave312

Censored for your safe viewing
Reaction score
269
I changed the second trigger to

(Number of Living units in (Units in Region 001 G having alliance Ally with player (Triggering player) matching Excluded: Missile, Cloaked, Dead, Hidden, with at most 0)) == 0

It seems to work now :) Thanks again Dave :D

I don't think that would work. What would happen is it would search for units in that region and stop searching when it reaches the At Most amount. In this case it would stop searching when it finds 0 units (hence it wouldn't search at all) and you are saying the condition passes when the player doesn't have any units in that region.

The previous way I had it said that it had to find at least 1 unit, which is what you wanted.

When I did my testing I worked with 2 regions and it worked perfectly. However I didn't even consider what happens when a unit dies. You can easily solve this by adding a Unit Dies event to the Loses Region trigger.
 

DonMushroom

Member
Reaction score
4
Ok so got the first one working spot on :) (forgot to add all the if's)

Cant get the second one to work though. (with your trigger copied exactly) Just cant get the map to revile again :(

Sorry about this Dave :(
 

Dave312

Censored for your safe viewing
Reaction score
269
I'm not sure why you are unable to get it to work, so I've attached a test map so hopefully you can figure what's wrong. The regions you need to enter are marked by the concrete with landing lights (should be pretty obvious). I've also added the Unit Dies event to the "Loses Region" trigger so it will work if a unit is killed.
 

Attachments

  • RegionSharedVision.SC2Map
    33.6 KB · Views: 224
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