• 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] Help on Taking Over Zones

Status
Not open for further replies.
Level 2
Joined
Sep 10, 2007
Messages
16
I need some help on a trigger that would be in a Territories Map.

So far I have this...

  • Midzone
  • Events
  • Unit - A Unit enters Midzone (Region)
  • Conditions
  • ((Triggering Unit) belongs to an enemy of (Owner of Control Point)) equals to True
  • Actions
  • Unit Group - Add all units of (Units in Midzone owned by (Owner of Control Point)) to midzoneD
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Condtions
  • (midzoneD is empty) Equal to true
  • Then - Actions
  • Unit - Change ownership of Control Point to (Owner of (triggering unit)) and Change color
  • Else - Actions
  • Do nothing

midzoneD is a Unit Group Variable
Midzone is a region around the control point

For some reason this trigger doesn't seem to do anything. Any help would be greatly appreciated.

I dont usually post on the forums so I dont really get how to use the Trigger wraps please bear with me :p.
 
Level 2
Joined
Sep 10, 2007
Messages
16
Control Point is just a circle of power that is under Blues control. I'm trying to make it so when a Red unit enters the circle it checks to make sure there's no blue unit in the circle and if there isn't, then it changes to Reds control.

BTW I'm horrible at explaining things.
 
Level 6
Joined
Sep 13, 2008
Messages
261
The circle of power is a unit in the area so what you have to do is this.

Right after you add all the units to the group immediately remove the control point from the group, but leave all other units and your trigger should work.
 
Level 2
Joined
Sep 10, 2007
Messages
16
The circle of power is a unit in the area so what you have to do is this.

Right after you add all the units to the group immediately remove the control point from the group, but leave all other units and your trigger should work.

I tried what you said (I removed the circle from the last created unit group) But still nothing happened. Any other ideas?
 
Level 6
Joined
Sep 13, 2008
Messages
261
Tt wouldn't be last created unit group. It would be midzoneD(which is a global group I believe).

Remove it from that group instead.

And to prevent further problems at very end of your trigger you should empty the whole unit group so it doesn't keep the ones from the previous check in it.
 
Level 2
Joined
Sep 10, 2007
Messages
16
Alright here's what I got now...

  • Midzone
  • Events
  • Unit - A Unit enters Midzone (Region)
  • Conditions
  • ((Triggering Unit) belongs to an enemy of (Owner of Control Point)) equals to True
  • Actions
  • Unit Group - Add all units of (Units in Midzone owned by (Owner of Control Point)) to midzoneD
  • Unit Group - Remove Circle of Power from MidzoneD
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Condtions
  • (midzoneD is empty) Equal to true
  • Then - Actions
  • Unit - Change ownership of Control Point to (Owner of (triggering unit)) and Change color
  • Unit Group - Remove all units from midzoneD
  • Else - Actions
  • Do nothing

Still no success on this one. Does everything seem like its in order?
 
Level 6
Joined
Sep 13, 2008
Messages
261
Alright here's what I got now...



Still no success on this one. Does everything seem like its in order?

no you capitalized midzoneD in the remove circle of power part lol. and you replaced Circle of Power in part of the trigger. typing this instead of copy as text isnt recommended.

  • Untitled Trigger 001
    • Events
      • Unit - A unit enters MidZone
    • Conditions
      • ((Entering unit) belongs to an enemy of (Owner of Control Point)) Equal to True
    • Actions
      • Unit Group - Add all units of (Units in MidZone owned by (Owner of Control Point)) to (midzoneD)
      • Unit Group - Remove Control Point
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random unit from (midzoneD)) Equal to No unit
        • Then - Actions
          • Unit - Change ownership of Control Point to (Owner of (Entering unit)) and Change color
          • Unit Group - Remove all units of (midzoneD) from (midzoneD)
        • Else - Actions
          • Unit Group - Remove all units of (midzoneD) from (midzoneD)
try this if it doesn't work let us know.
 
Level 2
Joined
Sep 10, 2007
Messages
16
no you capitalized midzoneD in the remove circle of power part lol. and you replaced Circle of Power in part of the trigger. typing this instead of copy as text isnt recommended.

  • Untitled Trigger 001
    • Events
      • Unit - A unit enters MidZone
    • Conditions
      • ((Entering unit) belongs to an enemy of (Owner of Control Point)) Equal to True
    • Actions
      • Unit Group - Add all units of (Units in MidZone owned by (Owner of Control Point)) to (midzoneD)
      • Unit Group - Remove Control Point
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random unit from (midzoneD)) Equal to No unit
        • Then - Actions
          • Unit - Change ownership of Control Point to (Owner of (Entering unit)) and Change color
          • Unit Group - Remove all units of (midzoneD) from (midzoneD)
        • Else - Actions
          • Unit Group - Remove all units of (midzoneD) from (midzoneD)
try this if it doesn't work let us know.

Sigh... still no success on this one. My trigger is exactly like the one you suggested and still nothing happens. Could it have something to do with my Variable?
 
Level 6
Joined
Sep 13, 2008
Messages
261
LeaksI've never really messed with Unit-change ownership.

Only other thing I can think of is Pick all units in area then add them to the group one at a time, but I don't know how that would be any different.

  • Unit Group - Pick every unit in (Units in MidZone owned by (Owner of Control Point)) and do (Actions)
    • Loop - Actions
      • Unit Group - Add (Picked unit) to (midzoneD)
It leaks but you need to learn to clean them yourself.
 
Level 2
Joined
Sep 10, 2007
Messages
16
LeaksI've never really messed with Unit-change ownership.

Only other thing I can think of is Pick all units in area then add them to the group one at a time, but I don't know how that would be any different.

  • Unit Group - Pick every unit in (Units in MidZone owned by (Owner of Control Point)) and do (Actions)
    • Loop - Actions
      • Unit Group - Add (Picked unit) to (midzoneD)
It leaks but you need to learn to clean them yourself.

Alright I tried a different way of doing the actions part. Instead of using a 'Unit Group' trigger I went 'Set Variable' trigger and put down

  • Actions
  • -Set midzoneD = (Units in Midzone owned by (Owner of Control Point) equal to True)
So now It works when I move a unit into the area...but if there's a blue unit defending the control point even if I kill him the trigger wont run. Any idea on why that would happen?
 
Level 6
Joined
Sep 13, 2008
Messages
261
The reason why that happens is the event(unit enters region) only triggers when they enter and not while they are inside.

But now that your trigger is working we'll worry about that.

I'll edit this post in a bit with a new trigger.

How many Players is this map?
 
Last edited:
Level 2
Joined
Sep 10, 2007
Messages
16
The reason why that happens is the event(unit enters region) only triggers when they enter and not while they are inside.

But now that your trigger is working we'll worry about that.

I'll edit this post in a bit with a new trigger.

How many Players is this map?

On my map that I'm working on there is only two players. But I might at another two later to seeing how well it works out. Do you think I might have to make a trigger that constantly checks the region so that the other team can capture it?
 
Level 4
Joined
Aug 1, 2007
Messages
66
In my map I have a region to be controlled. I have 2 teams and an 2 integer variables for each team. One variable keeps track of how many heroes are in the zone and the other calculates each teams score towards capturing the zone. It's calculated every second along with all of the scoreboard calculations. It's calculated like this:

set udg_CenterControlKing = ( udg_CenterControlKing + ( ( ( udg_CenterKingHeros * 2 ) - ( udg_CenterQueenHeros * 2 ) ) - 1 ) )

So each team loses 1 point per second and gains 2 points per second for each hero in the zone above the number of heroes the enemy has in the zone. Basically you have to have more heroes in the zone than the enemy. After this score is calculated, if it's more than 50 it's set to 50 and if it's below 0 it's set to 0. So it just has a 0-50 range. After that's set, if a team hit's 50 and the zone is currently uncontrolled they capture it. There's also a few triggers to add heroes who enter the zone to the number of heroes in the zone and remove them if they leave it. I also use a boolean for each team to keep track of who controls it, then use that boolean to give out the reward. In my case the zone is a gold mine and the team that holds it gets some extra gold.

Not sure if this is anything like what you're lookin for, just thought I'd throw it out there. There's alot of other things in my trigger that calculates this so I didn't bother posting it, but I'll post it if your interested.
 
Level 6
Joined
Sep 13, 2008
Messages
261
On my map that I'm working on there is only two players. But I might at another two later to seeing how well it works out. Do you think I might have to make a trigger that constantly checks the region so that the other team can capture it?

Yes dependent on how time important it is you could check every .01 sec or every sec or every 5 secs.
 
Level 2
Joined
Sep 10, 2007
Messages
16
Alright I finally figured out why it wasn't working with a unit defending the zone. The trigger was counting his corpse as a unit so I had to wait till the corpse disappeared before I could take it over. So all I need to do is either make it so none of my units leave corpses or make it so the trigger won't read corpses as a unit...sigh...I think I'll go with the no unit corpses. Thanks a bunch Howl2000! Never would have figured this out without ya!
 
Status
Not open for further replies.
Top