New Method
Each turn +1 point is added to a militaristic pool for players with militaristic friends or allies. We get a unit whenever our points pass the threshold, and the pool resets to 0. If we have 9 points and our threshold drops to 7, we get a unit on the next turn with 2 points' overflow.
This approach has several advantages. Say we have 9 points stored and the threshold is 10, but we lose our militaristic friends. If we later get militaristic friends again, the pool is saved so we'll get a reward on the next turn. Points never go to waste.
This whole design with a threshold number of turns still seems a bit confusing.
Here is how I would do it:
Suppose we wanted an alliance to give a unit every 15 turns, and a friendship to give a unit every 30 turns.
Then, I would create a pool. It starts at zero. For each ally I have, I get 2 points per turn. For each friendship I have, I get 1 point per turn. On any turn on which the counter is at least 30, I get a new unit and subtract 30 from the counter.
These methods are *almost* equivalent, but I think mine has fewer potential rounding issues and is arguably clearer. It works better to have a threshold as being the actual number of "points", rather than a number of turns.
Then, display to the player their current counter (like the GPP counter), their incremental points per turn, and the number of turns needed at the current rate.
So for example, if I had 1 alliance and 1 friend, and I had 5 points already, then the message would read:
"5/30, +3 per turn, 9 turns until next unit."
In the "new method" above then I would be in an identical situation whether I had 3 points, 4 points or 5 points, because all of these would take 9 turns and then reset the threshold to zero, but in my method, you are better off with 5 points already accrued than you are with 3 points, because with 5 points after 9 turns you'll be on 32 points, which will give you the new unit and then drop you down to 2 points, whereas the "new method" would give you the new unit and drop you down to 0 points.
If 15/30 turns aren't the target, then just change the thresholds and the relative ratios.
For example, if you wanted 12 turns allies and 18 turns friends, you could have allies give 3 points, friends give 2 points, and have 36 as the counter threshold, and subtract 36 when a new unit was formed.
This way, the threshold number of turns is clearly a function of the actual primitives, rather than a variable in its own right.