I'm currently working on a game where you gain zerglings in order to purchase units (which are beside choice beacons). The problem is I can't figure out how to get a trigger to activate only when the proper number (or more) of zerglings are on the beacon, and have it either remove just the cost, or kill just the cost. Anyone know how to do this?
You could activate the trigger when a unit enters the area. Inside the trigger, you could count the number of zerglings owned by player / etc. The count could be assigned to a variable and placed in a trigger condition. Try counting the number of units in a unit group, and create the unit group based on methods like 'Units in Region...". "Units in Region..." are functions, so you'll need something with a Unit group assignment for these methods to show up.
1) As you reward "money" (your zerglings) to the player, you should, during each of the zerglings' creation, add them to a unit group
2) By storing them in a unit group, you can have constant assess them, so you can check their number, where they are, ect ect.
3) When they enter the region, you don't have to count them and make them into unit groups again, just make a condition making sure it is the zergling (unit type) that is triggering the trigger, then do w/e you want with it.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm currently working on a game where you gain zerglings in order to purchase units (which are beside choice beacons). The problem is I can't figure out how to get a trigger to activate only when the proper number (or more) of zerglings are on the beacon, and have it either remove just the cost, or kill just the cost. Anyone know how to do this?
@DanteAS: Go
You could activate the trigger when a unit enters the area. Inside the trigger, you could count the number of zerglings owned by player / etc. The count could be assigned to a variable and placed in a trigger condition. Try counting the number of units in a unit group, and create the unit group based on methods like 'Units in Region...". "Units in Region..." are functions, so you'll need something with a Unit group assignment for these methods to show up.
@DanteAS: Go
I think the more efficient way to do this is:
1) As you reward "money" (your zerglings) to the player, you should, during each of the zerglings' creation, add them to a unit group 2) By storing them in a unit group, you can have constant assess them, so you can check their number, where they are, ect ect. 3) When they enter the region, you don't have to count them and make them into unit groups again, just make a condition making sure it is the zergling (unit type) that is triggering the trigger, then do w/e you want with it.