ID:139170
 
ok this is what i have for a rest verb.


mob
verb
Rest()
usr.health=usr.maxhealth
usr.Energy=usr.maxEnergy



well is it a better rest verb becuz i dont like how it works i just instantly makes the health and energy no delay or nothing.
Well, in order to tell the computer to do something, you need to give it specifics.
The computer knows knowledge that it's given, and cannot take knowledge from your head without your input/output.


So, when you instantaneously make the mob's health equal to the mob's maximum health, there will be no delay because you're not telling DM to delay the events.

You'll want to look up sleep() and/or spawn() for delay, as well as taking a gander at while(), and for() for looping.
Protip: Computers is not smart, you make it smart.

So, that means you have to think more logical, more from the ground.

A few things i can add to your thinking:
1: How do i want the mob to rest?
2: Do i want the health/Energy to slowly increase?
or: Do i want it to have a speciffic time to rest, and get max health when the timer is done?

I can code something easy for you:


client   //This basicly means that the logedin players will get the verb, not Everything else. Makes it more efficient
verb
Rest()
//Making a few vars
START //This manages a goto command
var/h = usr.maxhealth / 10 //This is how much i want the health to increase
var/e = usr.maxenergy / 10 //same thing, only energy

if(health>= maxhealth || energy >= maxenergy) //There is ways to do this, and there is good ways to do this
usr.health = usr.maxhealth
usr.energy = usr.maxenergy
return
sleep(10)//Delays the recovering

usr.health += h //Increases the health by 1/10 of the maximum
usr.energy += e //same

goto START //Creates a infinite loop

/*This resting, as you may see, adds more value to each
speciffic stat variables, and ends when the value is same
as/greater then the maxhealth/maxenergy*/
In response to Tafe
Don't use goto. Loop using while()
In response to MDC
Example?
mob
verb
Rest()
var/healthregen = 3 // amount to regen health by
var/energyregen = 25 // amount to regen energy by
while(1) // This is an infinite loop. Its saying while 1 is true: do the stuff below; its always true because why wouldnt it be? so yeah its infinite until we tell it to stop.
if(usr.health < usr.maxhealth) // if his health is less than his max health
if(usr.health + healthregen >= usr.maxhealth) // if his health + the health regen goes over his max health
usr.health = maxhealth // set them equal to eachother so he doesn't go over
else // if his health + health regen ISN'T over his max health
usr.health += healthregen // health + health regen
if(usr.energy < usr.maxenergy) // all the same stuff for energy
if(usr.energy + energyregen >= usr.maxenergy)
usr.energy = maxenergy
else
usr.energy += energyregen
if(usr.energy >= maxenergy && usr.health >= usr.maxhealth) // if his energy is greater or equal to his max energy and if his health is greater than or equal to his max health
usr << "You're fully rested" // tell him he's fully rested
return // stop the verb, which includes the infinite loop
sleep(30) // How "while()" works is it does all the stuff below it once, then checks if "while()" is still true then does it again. This is the delay we put at the end before it goes back to the top. 10 = 1 second.
In response to Tafe
while(1)
//do stuff
//when you're done doing stuff use break


or

var/x = 10
while(x > 1)
world<<x--