I've taken quite a bit of knowledge from this site and thought it's about time I give something back
One of the issues I had was getting a flawless region capturing system in place. Previously in my map 'conquest' I had to use 1 trigger per outpost, it was a little messy duplicating all that and it had 1 problem which i've seen a lot in many maps. If there is a unit on that region, and you move into it, but they leave. The capturing would not initialise, you'd have to walk away and re-enter. This was due to the limitations of the 'unit enters region' event handler. There is no 'unit is in region' event. Along with a few others such as dying on a point etc.... however this addresses all those issues and it should work for just about any map with any amount of 'capturables' with minor modification
The Goal: A trigger that allows you to add or remove as many capturable regions/points/structures as you'd like, with very little modification. It also MUST work in realtime and not just when a unit enters an area. It has to account for units dying mid-way through the capture, or leaving the capture zone. It must be 'pausable/blockable' when defending units appear in the area. It must have easy control over the time it takes to capture
So onto it...
Firstly create some global variables. I'm not going to post a screenshot for this but you want to label them like this..
Outpost - unit - array of 6 (Can be changed to Point if you'd prefer)
UnitsInCapRadius - unit group - array of 6
CapTimer - integer - array of 6
CapProgress - integer - array of 6
CapProgressDialog - dialog
CapProgressBar - dialog item
where 6 is however many capturable regions you have on your map, if it's 8 change the array size to 8 etc. And from now on any instances of 'from 1 to 6' change the 6 to however many you have
Now go ahead and assign each Outpost item to their respective structures through the 'set variable' command
Create a new trigger called 'Cap - AddPlayer' and lay it out like so....
You need a 'unit enters' event for each and every location on your map that is capturable. Set the distance to how close a unit has to be to the building
Under conditions you want to specify units that are NOT allowed to be added to capture, or stop a capture. If your map is like mine you have some minerals and a structure that are capturable, but of course you don't want minerals to be able to capture the structure, nor do you want the structure to be able to capture itself. So you'd add structure and resource as 'excluded'. It would also be a very good idea to ensure you don't have 'dead' units being added, exclude those as well
The IF THEN statement is not usually necessary, however I have on very rare occasion ran into a bug where a unit was added when it shouldn't have been, you can most likely omit it but i've left it in just in case
Create another trigger called Cap - RemovePlayer
As before you need a 'unit enters' event for every region you have, but change 'enters' to 'leaves'. Also include the 'unit dies' event.
This one is pretty self explanatory so I won't go into much detail, but it's worth noting that it is also checking if there are any enemies of the current owner of the outpost structure within range. If not then it resets the countdown period for that tower
Create an action definition called Create Progress Bar
All this is doing is making a dialog item, and giving it a default progress bar, you may change this to suit the style you'd prefer
The 2nd and 3rd lines from the bottom simply change the border colour of the progress bar for each player. The way I have it set is all players on Team1 have a dark green border to indicate they are capturing it for team1. And team2 has a violet border indicating their team's color. If your map is all vs all then it's probably better to either omit these lines and use the default colouring. Or change it to a 'pick each player in all players' and assign it to their own colour
Create another action definition called Display Countdown
This one isn't entirely necessary and could simply be included amongst the next trigger, however I will be expanding on this later within my own map. And since all i'm doing is copying this from my map, you're going to have to live with it so there :P
The only thing to take note of here is the value 25, which equates to 5 seconds. Change this if you want it to modify the capture time. You'll see why 25 = 5 seconds in the next trigger.
Ok create the final trigger called Capture Countdown
We'll start with the initial setup. The conditions are simply stating that this trigger will only run if there are any units present on any of the capturable regions. These conditions are not necessary however it does save a teeny-tiny bit of cpu power by not running the trigger when it's not needed
And finally we have the meat of the whole operation. This may look a little daunting but it's actually quite simple
The first IF THEN statement is checking if there any units present that have 'capturing' priveledges. Now in my map there are creeps controlled by the AI and players only use a single hero. I want creeps to be able to block captures, but not actually capture the region themselves. So way back up in the first trigger i'm ALLOWING creeps to be added to the 'UnitsInCapRegion' unit group. But here in this trigger only 'heroic' units are allowed to perform captures.
Directly underneath that condition is another. this checks to see if there are no units allied to the current owner within range. If you changed it to say < [The above condition] instead of = 0 then it would allow capturing if the attacker has more units present than the current owner/defender
I won't explain it all too much, but moving down to where it says if CapTimer[i] >= 26 means if you have been capturing it for 5 seconds. The reason it's 26 is because 0.2s is how quickly this trigger executes. Thats 5 times per second, multiplied by 5 seconds, plus an additional 1. The reason it must be +1 is because this is executed AFTER it increases the timer, in other words it's always 1 step ahead, so make it run one more time to ensure it's 5.0s and not 4.8s. I could have changed the order around but I got lazy :(
The only other things to change in this trigger is 'SlotNumberAI#' refers to my teams computer controller. If you have a team based map, change this value to any player on Team1/Team2/Team3/Team4 etc. if you have a FFA map change the line
(Number of Living units in (Units in UnitsInCapRadius[i] having alliance Ally with SlotNumberAI1, with at most Any Amount)) > 0
to
(Number of Living units in (Units in UnitsInCapRadius[i] owned by player 1, with at most Any Amount)) > 0
and the 'change ownership' command to player 1 as well. Then duplicate the IF THEN statement and change to player 2, 3, 4, 5 etc
Finally omit the line 'Run - Update Leaderboard', if you don't use a trigger for updating a leaderboard in your map
Once you're up and running it should look a little something like....
You're very welcome. I assume you got it working for your map no problems?
I've had some people ask me for assistance getting this to work within their own map because of varying needs. If anybody else is having trouble you can just send me a PM or post here. I might also rewrite this into a proper step-by-step tutorial that covers multiple variants and situations if needed
I was wondering if anyone would be able to help me get this trigger working? The two links provided are now inactive and Millenium7 also seems to be inactive. In my debugging window the only thing that gets an error is the conditions in the Capturecountdown second part. i'm trying to get this to work with two teams of four players. I have made each out post have an integre like this
Variable - Set Outpost[1] = FlagPost [209.00, 131.00]
Variable - Set Outpost[2] = FlagPost [123.00, 181.00]
Variable - Set Outpost[3] = FlagPost [70.00, 140.00]
Variable - Set Outpost[4] = FlagPost [131.00, 71.00]
Variable - Set Outpost[5] = FlagPost [133.00, 128.00]
Then i have added each player to teams this way.
Player Group - Add player 1 to Team1
Player Group - Add player 2 to Team1
Player Group - Add player 3 to Team1
Player Group - Add player 4 to Team1
Player Group - Add player 5 to Team2
Player Group - Add player 6 to Team2
Player Group - Add player 7 to Team2
Player Group - Add player 8 to Team2
Team1 and Team2 are Global Variables of the player Group variety. The problem I take it I am having is the lines that include SlotnumberA/1 are his own globals. So as a noob to this learning the editor I thought simplay changing it too.
(Number of Living units in (Units in UnitsInCapRadius[i] having alliance Ally with (Player 1 from (Allies of player 1)), with at most Any Amount)) > 0
Unit - Change ownership of i2 to player 1 and Change Color
Still getting debug errors in capture countdown.
So any help will be appreciated and I am one of those ppl who have to keep going until the problem is solved :D
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I've taken quite a bit of knowledge from this site and thought it's about time I give something back One of the issues I had was getting a flawless region capturing system in place. Previously in my map 'conquest' I had to use 1 trigger per outpost, it was a little messy duplicating all that and it had 1 problem which i've seen a lot in many maps. If there is a unit on that region, and you move into it, but they leave. The capturing would not initialise, you'd have to walk away and re-enter. This was due to the limitations of the 'unit enters region' event handler. There is no 'unit is in region' event. Along with a few others such as dying on a point etc.... however this addresses all those issues and it should work for just about any map with any amount of 'capturables' with minor modification
So onto it...
Firstly create some global variables. I'm not going to post a screenshot for this but you want to label them like this..
Outpost - unit - array of 6 (Can be changed to Point if you'd prefer)
UnitsInCapRadius - unit group - array of 6
CapTimer - integer - array of 6
CapProgress - integer - array of 6
CapProgressDialog - dialog
CapProgressBar - dialog item
Now go ahead and assign each Outpost item to their respective structures through the 'set variable' command
Create a new trigger called 'Cap - AddPlayer' and lay it out like so....
You need a 'unit enters' event for each and every location on your map that is capturable. Set the distance to how close a unit has to be to the building
Under conditions you want to specify units that are NOT allowed to be added to capture, or stop a capture. If your map is like mine you have some minerals and a structure that are capturable, but of course you don't want minerals to be able to capture the structure, nor do you want the structure to be able to capture itself. So you'd add structure and resource as 'excluded'. It would also be a very good idea to ensure you don't have 'dead' units being added, exclude those as well
The IF THEN statement is not usually necessary, however I have on very rare occasion ran into a bug where a unit was added when it shouldn't have been, you can most likely omit it but i've left it in just in case
Create another trigger called Cap - RemovePlayer
As before you need a 'unit enters' event for every region you have, but change 'enters' to 'leaves'. Also include the 'unit dies' event. This one is pretty self explanatory so I won't go into much detail, but it's worth noting that it is also checking if there are any enemies of the current owner of the outpost structure within range. If not then it resets the countdown period for that tower
Create an action definition called Create Progress Bar
All this is doing is making a dialog item, and giving it a default progress bar, you may change this to suit the style you'd prefer
The 2nd and 3rd lines from the bottom simply change the border colour of the progress bar for each player. The way I have it set is all players on Team1 have a dark green border to indicate they are capturing it for team1. And team2 has a violet border indicating their team's color. If your map is all vs all then it's probably better to either omit these lines and use the default colouring. Or change it to a 'pick each player in all players' and assign it to their own colour
Create another action definition called Display Countdown
This one isn't entirely necessary and could simply be included amongst the next trigger, however I will be expanding on this later within my own map. And since all i'm doing is copying this from my map, you're going to have to live with it so there :P
The only thing to take note of here is the value 25, which equates to 5 seconds. Change this if you want it to modify the capture time. You'll see why 25 = 5 seconds in the next trigger.
Ok create the final trigger called Capture Countdown
We'll start with the initial setup. The conditions are simply stating that this trigger will only run if there are any units present on any of the capturable regions. These conditions are not necessary however it does save a teeny-tiny bit of cpu power by not running the trigger when it's not needed
And finally we have the meat of the whole operation. This may look a little daunting but it's actually quite simple
The first IF THEN statement is checking if there any units present that have 'capturing' priveledges. Now in my map there are creeps controlled by the AI and players only use a single hero. I want creeps to be able to block captures, but not actually capture the region themselves. So way back up in the first trigger i'm ALLOWING creeps to be added to the 'UnitsInCapRegion' unit group. But here in this trigger only 'heroic' units are allowed to perform captures. Directly underneath that condition is another. this checks to see if there are no units allied to the current owner within range. If you changed it to say < [The above condition] instead of = 0 then it would allow capturing if the attacker has more units present than the current owner/defender
I won't explain it all too much, but moving down to where it says if CapTimer[i] >= 26 means if you have been capturing it for 5 seconds. The reason it's 26 is because 0.2s is how quickly this trigger executes. Thats 5 times per second, multiplied by 5 seconds, plus an additional 1. The reason it must be +1 is because this is executed AFTER it increases the timer, in other words it's always 1 step ahead, so make it run one more time to ensure it's 5.0s and not 4.8s. I could have changed the order around but I got lazy :(
The only other things to change in this trigger is 'SlotNumberAI#' refers to my teams computer controller. If you have a team based map, change this value to any player on Team1/Team2/Team3/Team4 etc. if you have a FFA map change the line
(Number of Living units in (Units in UnitsInCapRadius[i] having alliance Ally with SlotNumberAI1, with at most Any Amount)) > 0
to
(Number of Living units in (Units in UnitsInCapRadius[i] owned by player 1, with at most Any Amount)) > 0
and the 'change ownership' command to player 1 as well. Then duplicate the IF THEN statement and change to player 2, 3, 4, 5 etc
Finally omit the line 'Run - Update Leaderboard', if you don't use a trigger for updating a leaderboard in your map
Once you're up and running it should look a little something like....
If anyone's having any difficulty, I apologise for the copy/paste approach
So i've uploaded an example map :D
Here http://www.2shared.com/file/BUBxIXvy/CaptureOutpostExample.html
or here Link Removed: http://www.mediafire.com/?o34rzee3lwlxedq
omg thank you so much millenium i have all ways wanted a tut on how to capture points and shit like dat cheers
You're very welcome. I assume you got it working for your map no problems?
I've had some people ask me for assistance getting this to work within their own map because of varying needs. If anybody else is having trouble you can just send me a PM or post here. I might also rewrite this into a proper step-by-step tutorial that covers multiple variants and situations if needed
I was wondering if anyone would be able to help me get this trigger working? The two links provided are now inactive and Millenium7 also seems to be inactive. In my debugging window the only thing that gets an error is the conditions in the Capturecountdown second part. i'm trying to get this to work with two teams of four players. I have made each out post have an integre like this
Variable - Set Outpost[1] = FlagPost [209.00, 131.00] Variable - Set Outpost[2] = FlagPost [123.00, 181.00] Variable - Set Outpost[3] = FlagPost [70.00, 140.00] Variable - Set Outpost[4] = FlagPost [131.00, 71.00] Variable - Set Outpost[5] = FlagPost [133.00, 128.00]
Then i have added each player to teams this way.
Player Group - Add player 1 to Team1 Player Group - Add player 2 to Team1 Player Group - Add player 3 to Team1 Player Group - Add player 4 to Team1 Player Group - Add player 5 to Team2 Player Group - Add player 6 to Team2 Player Group - Add player 7 to Team2 Player Group - Add player 8 to Team2
Team1 and Team2 are Global Variables of the player Group variety. The problem I take it I am having is the lines that include SlotnumberA/1 are his own globals. So as a noob to this learning the editor I thought simplay changing it too.
(Number of Living units in (Units in UnitsInCapRadius[i] having alliance Ally with (Player 1 from (Allies of player 1)), with at most Any Amount)) > 0 Unit - Change ownership of i2 to player 1 and Change Color
Still getting debug errors in capture countdown.
So any help will be appreciated and I am one of those ppl who have to keep going until the problem is solved :D