1. add global objective variable
2. add a global int count variable
3. make a trigger that creates the objective
4. in the trigger (#3) under the action that created the objective set global variable objective(#1) to last crerated objective. Set global count to specified number (#2)
5. create a new trigger the fires when a unit is made and validate its the correct kind of unit if necessary. decrease global count and set text on global objective to reflect count.
@Terhonator: Go
@SoulTaker916: Go
You can do that but if you want the current number of units you'll have to update the count when a colonist dies as well.
ALSO in your trigger you will need to change the Event: Unit - (Triggering unit) part to "Any Unit"
You could also use this to get the current number of Infested Colonists (But change unit type):
Thanks for replies. I decided to use perioidic event that sets integer to amount of living units so there is no need to check amount on each training and each death. Solved.
Changing "triggering unit" to "any unit" was right solution for counting each trained unit as DeltaV saied.
I'm trying to make mission objective that updates every time when specific unit is trained. This is what I have at the moment:
this trigger will not work.
1. add global objective variable
2. add a global int count variable
3. make a trigger that creates the objective
4. in the trigger (#3) under the action that created the objective set global variable objective(#1) to last crerated objective. Set global count to specified number (#2)
5. create a new trigger the fires when a unit is made and validate its the correct kind of unit if necessary. decrease global count and set text on global objective to reflect count.
@Terhonator: Go @SoulTaker916: Go
You can do that but if you want the current number of units you'll have to update the count when a colonist dies as well.
ALSO in your trigger you will need to change the Event: Unit - (Triggering unit) part to "Any Unit"
You could also use this to get the current number of Infested Colonists (But change unit type):
@DeltaV: Go
You are correct i never took into accounts death, in this case i would use unit groups and count the groups. Nice catch
Thanks for replies. I decided to use perioidic event that sets integer to amount of living units so there is no need to check amount on each training and each death. Solved.
Changing "triggering unit" to "any unit" was right solution for counting each trained unit as DeltaV saied.
as a rule of thumb, don't use periodic unless its absolutely needed, its laggy scripting.