mob/proc Rest()
if(usr.hp == usr.maxhp)
usr<<"You are fully rested!"
usr.icon='mob.dmi'
usr.icon_state="player"
usr.cant_move=0
usr.resting=0
else
usr.icon='mobstates.dmi'
usr.icon_state="zzz"
usr.cant_move=1
usr.resting=1
sleep(30)
usr.hp+=1
usr.Rest()
Wake_Up()
if(usr.resting==1)
usr.icon='mob.dmi'
usr.icon_state="player"
usr.cant_move=0
usr.resting=0
obj/Rest
icon='hud.dmi'
icon_state="rest_up"
layer=MOB_LAYER + 20
New(client/C)
screen_loc="4,1"
C.screen+=src
Click()
if(usr.resting==0)
usr.Rest()
else
usr.Wake_Up()
MouseDown()
icon_state="rest_down"
MouseUp()
icon_state="rest_up"
Problem description: When the mob is resting (resting=1) and i want him to wake up() (by clicking on obj/Rest) the icon and icon states switch back, but at intervals of 3 seconds (sleep(30)) the mob keeps switching back to icon state "zzz" and wont "wake up" until usr.hp == usr.maxhp. I was wondering if there is a simpler way to make a Rest proc where the mob would rest when need and wont when unneeded. And also, when calling the same proc, if the mob is resting, he will wake up.
Baltraven
The reason it keeps going to "rest" is because your aren't checking if the user is still resting or not in the proc.
P.s use SRC instead of USER in procs.