local max_oxygen = 100 --maximum amount of oxygen player can store local current_oxygen = 100 --starting amount of oxygen player has in store local delay = 0.8 --amount of time between oxygen updates local damage = 10 --amount of damage to apply when oxygen runs out (will apply some when below 10% to start the heartbeat as a warning) local damge_delay = 0.5 --how fast damage is applied after oxygen runs out local healing = 1 --set to 0 if player doesnt automatically restore health from being inside local health_restore = 1 --how quickly health replenishes once back inside outside = 1 --set to 1 if player starts outside local max_health = nil delay = delay * 1000 damge_delay = damge_delay * 1000 function oxygen_level_init(e) Hide(e) CollisionOff(e) end function oxygen_level_main(e) Hide(e) CollisionOff(e) if max_health == nil then max_health = g_PlayerHealth else Panel(88,81,98,87) TextCenterOnX(93,84,3,"O2 : "..current_oxygen.." / "..max_oxygen) if g_PlayerHealth < 1 then current_oxygen = max_oxygen end if outside == 1 then if current_oxygen > 0 then if GetTimer(e) > delay then StartTimer(e) if current_oxygen < max_oxygen / 10 then HurtPlayer(e,damage/10) end current_oxygen = current_oxygen - 1 end else if GetTimer(e) > damge_delay then StartTimer(e) HurtPlayer(e,damage) end end else if GetTimer(e) > delay then StartTimer(e) if current_oxygen < max_oxygen then current_oxygen = current_oxygen + 1 end if healing == 1 and g_PlayerHealth > 0 then if g_PlayerHealth < max_health then if g_PlayerHealth + health_restore <= max_health then SetPlayerHealth(g_PlayerHealth+health_restore) else SetPlayerHealth(max_health) end end end end end end end function oxygen_level_exit(e) end