ID:164891
 
I am trying to make an air system...
turf
var
air=100


proc
airit()
for(var/turf/T in range(1,src))
if(T.air<src.air)
var/a=(src.air/10)
T.air+=a
src.air-=a
sleep(5)
Ya, I think you know what that will do. Now, will the turf proc automatically be called? And should I use Entered() for the proc to see if there is enough air for mobs?
You should set the air levels for certain turfs(depending on what your using it for) because having to call Entered() and check every step will cause a lot of delay. Explain a little more on what this is for?
In response to Derekjeterisgod
I want it so if the turfs air level is less than 50 the mob will lose HP.
In response to Revojake
Ok, I got it so if they enter an area without air they lose HP. But how do I make it so for every second they are in they lose more HP?
In response to Revojake
You could make a proc that runs while the air in src.loc is < than the acceptable amount of oxygen or air. Then call it again next time he/she enters another turf without enough air...

Just an idea.

-KirbyAllStar
Try using airflow regions, rather than each individual turn. Then use datums to denote breaches between regions.

That much, you will have to figure out on your own. I spent over a year to figure out this method, as opposed to a turf-by-turf method. As for updating, and dividing regions, I'll say this, it's easier than it seems.
In response to KirbyAllStar
turf
Entered(mob/M)
M.air()

mob
proc
air(turf/T in src.loc)
if(T.air<=50)
src << "You cant breath!"
sleep(2)
src.air()
else
return
That is what I thought you meant. How come this doesn't work? It wont display the message.
In response to Revojake
I would probably work with areas, that way you enter them less often, but thats up to you.
mob/Login()
.......
src.air()
..()

mob
proc
air(turf/T in src.loc)
while(T.air && src)
while(T.air<=50)
src << "You cant breath!"
sleep(5)
T = var/turf/R in src.loc //Not completely sure this line will work, but it should.
sleep(5)

You should call air() after you locate the players mob on a map.

I just woke up but I think that works.

-KirbyAllStar
In response to KirbyAllStar
um i think i got a idea

mob/var/air=100 //100 air

area/no_oxygen
Entered()
air-=5
if(src.air<=50)
src<<"You are running low on air"


i think thats it, dunno
In response to Neo Shinryu
mob/Login()
.......
src.air()
..()

mob/var/air=100

area/no_oxygen
area/yes_oxygen

mob
proc
air(area/A in src.loc)
while(A && src)
if(istype(A,/area/no_oxygen))
src.air-=5
if(src.air <=50)
src << "You are running low on air!"
else if(istype(A,/area/yes_oxygen))
src.air+=5
if(src.air > 50 && src.air < 100)
src << "You are feeling better"
else if(src.air >=100)
src.air=100 //if you have a max air of 100.
src << "You feel refreshed!"
else
src << "You are beginning to feel better."
sleep(5)
A = locate(/area) in src.loc //Sorry my first line similar to this didn't work

That should work...

-KirbyAllStar
In response to KirbyAllStar
I already have mine working, thanks anyway.