ID:148905
 
What im trying to do is set a hunger level. I want it set up so that the hunger level slowly is reduced. say like it drops 1 every 10 secs. i had it going like...

mob
proc/hunger
var/mob/M
for(M in world)
M.hunger--
sleep(100)
M.hunger--

and so on but i want to know how that can be called without me having to do taht a thousand times.
mob
proc
hunger()
while(src.hunger)
sleep(10)
src.hunger--
src << "You died from hunger"
die()//you make this one

var
hunger = 100
In response to Nadrew
Hey nadrew can you re check waht i originally wrote because i edited what i originally posted and im wondering how to call the hunger proc oveer and over without having to rewrite that again and again
In response to Erdrickthegreat2
Use the proc I gave you and you only have to call it once, and it will decrease the hunger proc every second until it reaches 0.
In response to Nadrew
Nadrew, how should i call the proc? at login?

mob
Login()
usr.hunger()

???
In response to Erdrickthegreat2
If you want, just don't forget to reset the var and recall the proc when they die.
In response to Nadrew
help me out on this one of them goes down and the other doesnt ... why?


mob
Login()
thirst(src)
hunger(src)
proc
hunger()
while(src.hunger)
sleep(100)
src.hunger--
if(src.hunger == 20)
src << "You had better eat soon your getting hungery!"
if(src.hunger == 10)
src << "You had better eat your starving"
if(src.hunger <= 0)
src << "You have died from starvation!"
src.hunger = src.fhunger
src.loc = locate(1,1,1)
hunger(src)
thirst()
while(src.thirst)
sleep(100)
src.thirst--
if(src.thirst == 20)
src << "You had better drink soon you are getting thirsty!"
if(src.thirst == 10)
src << "You had better drink your dehydrating"
if(src.thirst <= 0)
src << "You have died from dehydration!"
src.thirst = src.fthirst
src.loc = locate(1,1,1)
thirst(src)
var
hunger = 100
fhunger = 100
thirst = 100
fthirst = 100
In response to Erdrickthegreat2
Because you're really only calling one of the procs, you need to add ..() somewhere in your Login() proc to make it return the parent of the proc, or you can make them into one proc.
In response to Nadrew
Thanx nadrew for your help. i was hoping that maybe you could help me on my door code in code problems, like maybe you could help me out, but thats totally up to you, thanx for the help on these procs anyway!

-=ErdricktheGreat=-