rest()
set name="rest"
Enter(0)
//flick() will come here
while(src.HP<src.max_HP)
if(src.HP<=(src.HP-6))
sleep(30) //i try to do a deley of 3 sec between each time
src.HP+=6
else
src.HP=src.max_HP // my HP its /6 always...
//flick() wil come here again
return
</DM
i want the mob will stack when he(or she) rest.
problem: i dont know if its stack on not cuse my delay cod its wrong..the life up instently.
i notice that sleep its not the command for delay the cod, so what is the command to do it?
thx, Orhalimi
ID:160437
Sep 10 2008, 8:10 pm (Edited on Sep 10 2008, 8:15 pm)
|
|
i tryed the follow:
|
Well, your math isn't adding up. (Haha, get it?)
Look at the if() line. If your CURRENT health is less than your CURRENT Health subtracted by 6, then it'll add 6. If not, then it'll make it maximum. An example, if you have 6 apples and you'll add 6 apples only if you have 0 apples. However, you have 6 apples so you won't ever add 6 apples. Get it? I think you meant to put src.max_HP-6 Also, that return will break the while() procedure. Might want to put it indented after the code after the else. |
maybe something like this
rest() I'm not 100% if that would work, but the "goto" option is very handy when it comes to loops ^.^ |
In response to ElderKain
|
|
Don't post replies to code if you program like that.
|
In response to Thief Jack
|
|
thx, its work to me now
mob/verb but, the usr dont stack untile the rest finish. i ant he wont be able to move untile he will get full life... i think its becuse the sleep, meby i need deley command and not sleep? |
In response to Orhalimi
|
|
I think what you want is make it so the person cant move while resting your, also the Enter(src) what is that for. But if you want to be able to stop movement try something like this
mob/verb |
In response to NightJumper88
|
|
Note the Move() override should ultimately be like this instead:
client/Move() //override player-initiated movements only |
In response to ElderKain
|
|
Nononononono.
No loops with goto. Look up while() and for() |
In response to Andre-g1
|
|
Andre-g1 wrote:
Nononononono. well the usage of goto can be used for loops, most people perfer to use while() & for() but goto can be used also, it's just the code gets a bit more cluttered that way. if goto works then it's alright, it's all a matter of opinion. |
In response to ElderKain
|
|
That's like saying, if crossing the road while on green light for the cars works because they stop, then it's alright.
|
You've managed to provide us with no information to aid us in aiding you.