Hey, I am working on a feature to capture areas that can be taken control back and forth based on the amount of units currently at the location. Taking control of an area is not instant, but rather dependent on how many units are in the area to speed up the process. My reason for this thread is I have not entirely come up with a good logical way of doing this. I am not necessarily requesting actual code, but rather any ideas of how I might approach this. For example, I have considered a structure that loses and gains health based on the units trying to defend/capture it. When the life reaches zero, it would become neutral until it has gained full health again to which the greater side would gain control. This is just an example, if anyone has any ideas please reply. I will appreciate it greatly!
For triggers just use a periodic with a for loop for all your zones or a periodic for each zone.
Each zone will have it's own variable for it's capture amount or whatever, or you could use a unit of some kind to represent the region and modify it's health. Up to you.
Count how many units are in the area then use a fraction or multiple or whatever to scale for the rate and then add as a factor of the unit count to your variable with each tick of the periodic. You can also check in the periodic if the variable reaches the desired value or the unit has full health or whatever and then run your capture trigger using an if statment.
If you want contested points you could use a quadrant system. You have an x and y and say you have 4 players, then you would represent them with the four quadrants. Player of quadruant 1 adds a value of -1,+1, player of quadrant 2 adds a value of +1,+1 etc. Then you check which quadrant and reset the value when its determined who owns it.
Hey, I am working on a feature to capture areas that can be taken control back and forth based on the amount of units currently at the location. Taking control of an area is not instant, but rather dependent on how many units are in the area to speed up the process. My reason for this thread is I have not entirely come up with a good logical way of doing this. I am not necessarily requesting actual code, but rather any ideas of how I might approach this. For example, I have considered a structure that loses and gains health based on the units trying to defend/capture it. When the life reaches zero, it would become neutral until it has gained full health again to which the greater side would gain control. This is just an example, if anyone has any ideas please reply. I will appreciate it greatly!
Thanks
For triggers just use a periodic with a for loop for all your zones or a periodic for each zone.
Each zone will have it's own variable for it's capture amount or whatever, or you could use a unit of some kind to represent the region and modify it's health. Up to you.
Count how many units are in the area then use a fraction or multiple or whatever to scale for the rate and then add as a factor of the unit count to your variable with each tick of the periodic. You can also check in the periodic if the variable reaches the desired value or the unit has full health or whatever and then run your capture trigger using an if statment.
If you want contested points you could use a quadrant system. You have an x and y and say you have 4 players, then you would represent them with the four quadrants. Player of quadruant 1 adds a value of -1,+1, player of quadrant 2 adds a value of +1,+1 etc. Then you check which quadrant and reset the value when its determined who owns it.