I have a really, really simple top-down view strategy game under work, and I have run into a need for calculating the amount of minions a player has, in order to make the enemy "a.i." launch proper actions. However, since I don't have a math degree and I don't want to mess too much with advanced objects to keep the game under control = within my limited coding skills, I need help.

At the moment, my game has a really basic system found from this forum to calculate the amount of workers, soldiers and so on by:
(I change the names to be more generic for clarity)

- "unit01" value X = "worker"
- "unit01" value "team01" = fixed("controlobject01")
-- set "controlobject" value "countworker01" to 0
-- start loop for every "unit01", loop name "worker01"

- for each "unit01", loop "worker01"
-- add 1 to "controlobject" value "countworker01"

I have tested it with counter and it does count the amount right for each team, but I was hoping to use the calculations of workers, soldiers and such also to create the base building process. I want the game team to realize, when it has 100 or more workers, save up money for some soldiers, than reach around 10 soldiers, shift back to workers until there are at least 200, then soldiers and so on... But my questions are:
-Since this method of calculation will need the counter to always hit 0 in order to begin a new counting loop, is this method impossible for setting up limits for an action x or y based on how many minions there are at the moment?
-Will the constant resetting of the count cause the player to presume constantly, that it has 0 workers and will try to endlessly reach the 100 workers limit?
-Could there be a way for the counting process to send the player some value of the current amount of workers like every one second to let it know some quota has been reached/lost in order to act?
-Is there a better method to count workers or other unit types for every team I should consider?

Any help is useful. I haven't sent any examples for this forum before, so if you ask for an example file, please be patient. I do have a ver.01 of the games stored, that have one base winning the other by outproducing and attacking the other, so this matter isn't a brick wall, but I don't want to do more work on the game and then realize, that this counting method won't work down the line.

(If this post is too similar to an already submitted post forgive me.)