ID:161647
 
I'm not sure where to find a library/demo having to do with inactivity. What I need for it is when the player isnt active their health goes back up.
Considering that client.inactivity applies to any action at all, it's probably not what you want. A more general method with some other variable you set whenever you do anything that should prevent regeneration (like combat) would be a better idea. Here's an example:

mob
var/tmp/regentime = 0
var/regenrate = 10
proc/regen()
//loop forever
while(src)
//wait until we can start regenerating
if(world.time < regentime)
sleep(regentime - world.time)
else
health += regenrate
sleep(10)

New()
..()
spawn() regen()

verb/punch()
usr << "YOU PUNCH"
regentime = world.time + 20
In response to Garthor
Garthor wrote:
Considering that client.inactivity applies to any action at all, it's probably not what you want. A more general method with some other variable you set whenever you do anything that should prevent regeneration (like combat) would be a better idea. Here's an example:

mob
> var/tmp/regentime = 0
> var/regenrate = 10
> proc/regen()
> //loop forever
> while(src)
> //wait until we can start regenerating
> if(world.time < regentime)
> sleep(regentime - world.time)
> else
> health += regenrate
> sleep(10)
>
> New()
> ..()
> spawn() regen()
>
> verb/punch()
> usr << "YOU PUNCH"
> regentime = world.time + 20


So this would make it to where the mob's health would regenerate when he's in standby?Also why is the punch verb needed?
In response to Killacentral
To show you an example of how you set the regentime variable.