Digidoyo has the right idea [snapback]363379[/snapback]:
Count off the gas into minerals and another counter simultaneously. Then count back the other counter into gas to restore the original amount.
PCFredZ's suggestion of using a binary counter is good.
The tricky bit is to make sure you can keep track of whether your gas is supposed to be going up or down, and not having the countdown timer reset before the cycle is finished. Digidoyo gets around this using two switches - the problem I see with this is that since switches are global (they are the same to all players), having multiple players may confuse the system. It may be better to use a death counter to keep track of the triggers instead.
Here's essentially the basic method again, but hopefully in a clearer way.
(Every trigger is preserved; all player fields are "current player".)
- conditions: Countdown timer is 0, deathcount1 is 0[sup]1[/sup]
actions: Set deathcount1 to 1, wait 0[sup]2[/sup], set countdown timer to {time}[sup]3[/sup]
- [sup]4[/sup] conditions: Gas accumulated at least 1, deathcount1 is 1
actions: Subtract 1 gas, add 1 mineral, add 1 for deathcount2
- conditions: Gas accumulated at most 0, deathcount1 is 1
actions: Set deathcount1 to 2
- [sup]4[/sup] conditions: Deathcount2 is at least 1, deathcount1 is 2
actions: Subtract 1 for deathcount2, add 1 gas
- conditions: Deathcount2 is at most 0, deathcount1 is 2
actions: Set deathcount1 to 0
Notes:
1: Deathcount1 has the same role as Digidoyo's switches; it keeps track of which stage the triggers are at.
2: This "wait 0" is to make sure that all the players have a chance to set deathcount1 to 1 (and so start this set of triggers) before the countdown timer is reset. Personally, however, I think this is a pretty messy way to do this - can anyone suggest a better way?
3: This system resets the countdown timer right at the beginning, so that the time between income-earning is constant (the triggers giving income work whilst the countdown timer is beginning to count down). The problem is that for large incomes and short countdown times, the trigger set might not finish in time for the next income round. The alternative is to wait until everyone has finished calculating their income and resetting their gas before resetting the countdown timer, but then you have to work out how to work out when everyone has finished calculating their income. You might try using a trigger which checks for everyone's deathcount1 to be 2 and deathcount1 to be 0, but then the trigger would fail without all players being present.
4: Steps 2 and 4 are the ones where you would insert a 'binary counter' system if you wish.
[right][snapback]364129[/snapback][/right]
I've tried the other triggers but those didn't work.. and I'm sort of lost with this one... Can you explain a bit simpler?