i'm trying to implement some sort of zone control trigger set.
here's my pseudo-code atm:
1) a unit enters a region x
2) set timer
3) set last_entered_player[x] to Triggering Player
4) when timer expires, if there are units owned by player last_entered_player[x] in region create a unit in region x
so far so good.
what i'm having trouble, though, is checking if a unit controlled by any other player is in the zone.
anybody have any insight on how to accomplish this?
or maybe a whole different approach that avoids the issue?
Could a custom condition work? I'm trying to learn to use them, so here's something I made in case it might help.
Number of Units in Region with alliance to player "player".
Options: Condition
Return Type: Integer
Parameters
Region = (Entire map) <Region>
Player = 0 <Integer>
Grammar Text: Number of Units in Region with alliance to player "player".(Region, Player)
Hint Text: (None)
Custom Script Code
Local Variables
totalfound = 0 <Integer>
Actions
Unit Group - Pick each unit in (Units in Region having alliance Enemy with player Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Actions
Variable - Modify totalfound: + 1
General - Return totalfound
I attached a map with the trigger in it in case you decide it's what you want. Basically just use this condition to check how many enemy units are in the region you specify with the type of alliance you specify. I haven't tested it but it didn't come up with any errors when I saved, so there's that.
Edit: I guess I didn't allow you to specify alliance type, but if you need that I can easily change it.
I don't know exactly how your Zone Control feature is intended to work, but you should look at the Xel'Naga watchtower's Interact ability. It can be used to share control of a unit with the owners of nearby units, or it can be set so that it will only share control if there is only one eligible player. In short, if you wanted to detect whether a player was uncontested in an area, this would be an easy way to do it. If you want a more complicated system though, you're probably going to have to use triggers.
hi,
i'm trying to implement some sort of zone control trigger set. here's my pseudo-code atm:
1) a unit enters a region x 2) set timer 3) set last_entered_player[x] to Triggering Player 4) when timer expires, if there are units owned by player last_entered_player[x] in region create a unit in region x
so far so good. what i'm having trouble, though, is checking if a unit controlled by any other player is in the zone. anybody have any insight on how to accomplish this? or maybe a whole different approach that avoids the issue?
thanks!
@krapspark: Go
Could a custom condition work? I'm trying to learn to use them, so here's something I made in case it might help.
I attached a map with the trigger in it in case you decide it's what you want. Basically just use this condition to check how many enemy units are in the region you specify with the type of alliance you specify. I haven't tested it but it didn't come up with any errors when I saved, so there's that.
Edit: I guess I didn't allow you to specify alliance type, but if you need that I can easily change it.
@goofoffjw: Go
interesting i didn't know sc2 editor had such a feature. will try it when i get home. thanks!
I don't know exactly how your Zone Control feature is intended to work, but you should look at the Xel'Naga watchtower's Interact ability. It can be used to share control of a unit with the owners of nearby units, or it can be set so that it will only share control if there is only one eligible player. In short, if you wanted to detect whether a player was uncontested in an area, this would be an easy way to do it. If you want a more complicated system though, you're probably going to have to use triggers.
@Myndful: Go
sweet. that's a really great idea. i'll look into that.
thanks!