I'm trying to make a verb so the player can rest and recover health and so far this is what I have:
mob
verb
Rest()
if(usr.Rest==0)
usr. << "You begin to rest."
usr.Rest=1
usr.movable = 0
if(usr.HP == usr.MaxHP)
usr. << "You have full health"
usr.Rest=0
usr.movable = 1
return
if(usr.HP < usr.MaxHP)
usr.HP += rand(10,20)
sleep(30)
return
if(usr.Rest==1)
usr. << "You stop resting."
usr.Rest=0
usr.movable = 1
return
It seems fine but I want to know how to make it loop.
ID:164319
![]() Jun 26 2007, 4:09 pm
|
|
Popisfizzy wrote:
usr is safe in verbs. I used to think so too. I put usr in my communication verbs, then I made a story system for my NPCs to react to players using the existing communication verbs so that NPC and player communication would be consistent. The NPCs started forcing the player who interacted with them to say the NPC's lines. ;p Player Joe buys some stuff from a shopkeeper NPC. Joe: Thank you, please come again. My rule of thumb now is: if you don't have to use usr, don't. |
verb
Rest()
if(usr.Rest==0)
usr. << "You begin to rest."
usr.Rest=1
usr.movable = 0
while(usr.HP < usr.maxHP)
usr.HP += rand(10,20)
sleep(30)
if(usr.HP > usr.maxHP)
usr.HP=usr.maxHP
usr << "You stop resting."
usr.Rest=0
usr.movable = 1
return