ID:140675
 
Code:
//Timer - Please note that this is supposed to occur every 3 minutes. i changed the time for debugging means
proc
Timer()
Hour = rand(0,23)
while(GameStarted)
sleep(18)
Hour++
UnScramble()
if(prob(20))
OxygenLeak = TRUE
spawn()var/Ship/P = new
world << "There is an Oxygen Leak"
if(prob(10))
spawn()var/Ship/P = new
if(Hour == 24)
Hour = 0

//Ship Datums.
Ship
var
FuelLevels = 100
OxygenLevels = 100
New()
..()
if(OxygenLeak)
OxygenLow()
proc
OxygenLow()
world << "It gets to here"
while(OxygenLeak)
src.OxygenLevels--
sleep(3)
if(src.OxygenLevels == 0)
for(var/client/M)
M.mob.InSpace = 1
if(src.OxygenLevels == 20)
world << "Oxygen levels has reached 20%. The leak need to fixed immediately."
if(src.OxygenLevels == 50)
world << "Oxygen levels has reached 50%. The leak need to be fixed soon."
if(src.OxygenLevels == 75)
world << "Oxygen levels are dropping. 75% Oxygen remains."
return ..()

var
OxygenLeak = FALSE


Problem description:
I get a few problems with this code.
1. It stops the timer
2. It keeps showing up Oxygen levels are dropping. 75% Oxygen remain and it doesn't decrease the oxygen levels.

Please note i've just started doing a simpler game than an action game to help me learn.
[EDIT]
Oops forgot to say what the code supposed to do.
The timer proc changes the hour every 3 minutes (i know its 1.8 second its for debugging) and there's supposed to be a 20% of an Oxygen leak happening. If that happens then it decreases the ship oxygen every 30 seconds and shows the percentage at the right percentage.
Nothing there is going to cause the Hour variable from counting up, except UnScramble(). Additionally, nothing there will prevent the OxygenLevels variable from falling below 75.

You may be confused by the fact that you are creating a new Ship object every time it decides there should be a leak.
In response to Garthor (#1)
Garthor i was on chatters when i posted this. Keeth told me what was the problem and didn't help me much but i figured most of it out myself. Thanks anyway Garthor.