ID:139167   May 26 2011, 9:52 am Code: ```mob var hunger=100 statreduce=0 proc hungerdecrease() var/mob/players/M if(usr.statreduce==1) if(usr.hunger==0) healtdecrease() else if(usr.hunger>=51) M.tempevade+=10 M.Fireres+=10 M.Iceres+=10 M.Litres+=10 M.Darkres+=10 M.Poisres+=10 M.Earthres+=10 usr.statreduce=0 usr<<"Your Evasion and Fire/Ice/Lightning/Dark/Poison/Earth resistence increased!" hungerdecrease() else sleep(250*adventurelevel) usr.hunger-=1 hungerdecrease() else if(usr.hunger>=51) sleep(250*adventurelevel) usr.hunger-=1 hungerdecrease() else M.tempevade-=10 M.Fireres-=10 M.Iceres-=10 M.Litres-=10 M.Darkres-=10 M.Poisres-=10 M.Earthres-=10 usr.statreduce=1 usr<<"Your too hungry! Evasion and Fire/Ice/Lightning/Dark/Poison/Earth resistence decreased!" usr<<"Eat some fish to calm your hunger." hungerdecrease() healtdecrease() var/mob/players/M M.HP-=10 sleep(10) hungerdecrease() ``` Problem description:The idea is every once in a while your hunger goes down its in percentage, the problem is whn it reaches 50 it stops the stats dont decrease and the hunger bar just stops at 50 even if you eat wich makes it go up again it never goes down again. So my question am i missing something in the code? this is the whole code btw.
 <-> May 26 2011, 11:15 am Try this: ```mob var hunger=100 statreduce=0 proc hungerdecrease() var/mob/players/M if(usr.statreduce==1) if(usr.hunger==0) healtdecrease() else if(usr.hunger>=51) M.tempevade+=10 M.Fireres+=10 M.Iceres+=10 M.Litres+=10 M.Darkres+=10 M.Poisres+=10 M.Earthres+=10 usr.statreduce=0 usr<<"Your Evasion and Fire/Ice/Lightning/Dark/Poison/Earth resistence increased!" hungerdecrease() if(usr.hunger<=50) sleep(250*adventurelevel) usr.hunger-=1 hungerdecrease() else if(usr.hunger>=51) sleep(250*adventurelevel) usr.hunger-=1 hungerdecrease() if(usr.hunger<=50) M.tempevade-=10 M.Fireres-=10 M.Iceres-=10 M.Litres-=10 M.Darkres-=10 M.Poisres-=10 M.Earthres-=10 usr.statreduce=1 usr<<"Your too hungry! Evasion and Fire/Ice/Lightning/Dark/Poison/Earth resistence decreased!" usr<<"Eat some fish to calm your hunger." hungerdecrease() healtdecrease() var/mob/players/M M.HP-=10 sleep(10) hungerdecrease() ```
 <-> May 26 2011, 11:27 am In response to Prf X Thank you for your fast response unfortunatly it didnt work, putted it in tested it but still it stops at 50% no stats decreasing at all. i hope someone might know the solution to this please.
 <-> May 26 2011, 1:13 pm In response to Chaokai I'd have to see your entire code to know whats going on, and i dont recommend posting that here for all to see, add me on pager?
 <-> May 26 2011, 4:28 pm The problem is it has no idea what M is. All you did was create the variable M, you didn't set it equal to anything. It has no idea whose variable it should change when you do M.Fireres+=10. So since M = nothing, in-game you get a runtime error because its trying to access the Fireres variable of nothing. Oh and anytime you have a selfmade proc, you definitely want to be using src instead of usr. Good luck, fix the M stuff and it should work.
 <-> May 26 2011, 8:03 pm In response to Turles Turles wrote: The problem is it has no idea what M is. All you did was create the variable M, you didn't set it equal to anything. It has no idea whose variable it should change when you do M.Fireres+=10. So since M = nothing, in-game you get a runtime error because its trying to access the Fireres variable of nothing. Oh and anytime you have a selfmade proc, you definitely want to be using src instead of usr. Good luck, fix the M stuff and it should work. Good point, I miss M=null also if M = src M is not need
 <-> May 26 2011, 10:44 pm In response to Prf X Thank you guys for your help the only thing i missed was M=src now it works fine. Thank you alot.