At the moment I have two variables for each and every status effect, one is the effect, the other is it's duration.
Adding status effects is easy enough. I use a proc which I enter who the status effect effects, the status effect, it's power and duration (I make use of vars[] in this proc in a "M.vars[effect]=effectpower" way, so I don't have to do "if(effect=="whatever") whatever=effectpower" for each status effect, is that the right thing to do?).
That is the quick and easy part.
The problem I am having is with counting down these status effects.
At the moment when someone has a status effect a proc will loop until they have no more status effects, and for each status effect it has a piece of code which looks like...
if(statuseffect)
statuseffectdur--
if(!statuseffectdur) statuseffect=0
For some status effects such as poison though there is a minor differance, usually every 3rd second deal some damage or so on.
Anyway, this is the problem. If I am making use of 50 status effect in the game (I will probably end up using more) I am using 100 variables, and if someone has a status effect it is checking "if(statuseffect)" 50 times, every second. If 10 people have a single status effect this equates to checking 500 times every second, plus counting down a status effect and doing whatever it's effect is (such as dealing damage for poison). I have no idea how this would effect CPU usage in an actual game, but I would imagine that it is not too efficient, and definitely not the most efficient way of doing things.
So, is there any easier more efficient way of doing this without looping through the above code 50 times every second, and if so, how?
As for the frequency of checks, you could find the effect which is going to end first and then use spawn to wait that amount of time before the next check.