i need it so every 15 minutes, the pets hunnum goes down 1, here is the code:
proc
hunger()
sleep(1200)
if(usr:pet1hunnum==0)
usr:pet1hun = "Ok"
usr:pet1hunnum -= 1
spawn(10) hunger()
if(usr:pet1hunnum==-1)
usr:pet1hun = "Hungry"
usr:pet1hunnum -= 1
spawn(10) hunger()
if(usr:pet1hunnum==-2)
usr:pet1hun = "Starving"
usr:pet1connum -= 1
spawn(10) hunger()
P.S. if u replied last nite, sorry, i had to go
ID:176382
![]() Jan 20 2003, 6:24 am
|
|
mob/pet
var/hunnum = 100 //starting value of hunnum
var/mob/owner
proc/ModifyHunnum(myAmount)
hunnum += myAmount
if(hunnum < 0) hunnum = 0
if(hunnum == 0)
if(owner) owner << \
"[src] is out of hunnum! That can't be good!"
mob/player
var/list/pets = list()
proc/AddPet(mob/pet/P)
//use this to add new pets to the list
if(!(pets.Find(P)))
pets += P
P.owner = src
New()
. = ..() //call the default New() proc first
spawn(1) MaintainPets()
proc/MaintainPets()
while(1) //loop forever!
for(var/pet/P in pets)
P.ModifyHunnum(-1)
sleep(15 * 600) //15 minutes