ID:176382
 
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
You might want to try something like this: you give the mob a list of pets, and loop through it every so often. (Caution: code is untested, but should be pretty close.) Good luck!


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