ID:141691
 
Code:
proc/CoolDown()
while(1)
for(var/mob/user in world)
switch(user.characterrace)
if("Full-Saiyan" || "Icerian")
while(user.rage.value > 1)
user.rage.value--
user << "You calm down."
sleep(200)
break
if("Half-Saiyan")
if(user.characterroot == "Saiyan")
while(user.rage.value > 1)
user.rage.value--
user << "You calm down."
sleep(200)
break
if("Human" || "Namekian")
while(user.focus.value > 1)
user.focus.value--
user << "You lose focus."
sleep(200)
break
if("Half-Saiyan")
if(user.characterroot == "Human")
while(user.focus.value > 1)
user.rage.value--
user << "You lose focus."
sleep(200)
break


Problem description:
This is my CoolDown Proc that lowers the user's rage or focus, if it is still 1. But after it becomes 1, it still loops. Alittle help..
That while(1) loop is unecessary in that code. Delete it an push everything else back a tab.
Lundex wrote:
Code:
proc/CoolDown()
> while(1)
> for(var/mob/user in world)
> switch(user.characterrace)
> if("Full-Saiyan" || "Icerian")
> while(user.rage.value > 1)
> user.rage.value--
> user << "You calm down."
> sleep(200)
> break
> if("Half-Saiyan")
> if(user.characterroot == "Saiyan")
> while(user.rage.value > 1)
> user.rage.value--
> user << "You calm down."
> sleep(200)
> break
> if("Human" || "Namekian")
> while(user.focus.value > 1)
> user.focus.value--
> user << "You lose focus."
> sleep(200)
> break
> if("Half-Saiyan")
> if(user.characterroot == "Human")
> while(user.focus.value > 1)
> user.rage.value--
> user << "You lose focus."
> sleep(200)
> break
>

Problem description:
This is my CoolDown Proc that lowers the user's rage or focus, if it is still 1. But after it becomes 1, it still loops. Alittle help..

This code suffers two very large problems:

1.) Neither both stats of any one person nor the stats of more than one person will ever be affected. The way you've constructed this loop, it takes twenty seconds for any stat to decrease one point, and once it finishes decreasing the stat to zero for any one player, you break the for loop above and the proc does the above again. In the case of subsequent iterations, the loop would likely do nothing several times over.

b.) Even if the first point is repaired, each player after the first has to wait at least twenty seconds before their stats are reset. It's highly unlikely in many situations that every player logged in will have their rage and focus reset to zero.

This would be loads better as a mob proc that runs individually on each player.
In response to Mobius Evalon
So how would I make it so anytime the user's rage or focus is pass 1, the proc runs?