ID:272083
 
I can find nothing to help me on this base... Can somebody please give me a hand?
mob/var
mdelay=1
walking=0

mob/Move()
if(walking)return
walking=1
..()
sleep(mdelay)
walking=0

thats the basic idea of it, you override Move to create a a way to control how often you can step. Setting mdelay to 0 will cause no difference in behavior from regular move, setting it to any number higher than that will cause it to wait that many ticks before letting you walk again.

In response to Masterdan
Okay. I already have a movement proc, so according to this all I do is add onto it sleep(var) after the point where the mob moves and then just modify the var to the movement delay I want the mov to have?
In response to Demon_F0rce
you also have to do a variable set and return like i did to stop it from getting backlogged with movement attempts which would simply cause a lead time and wouldnt give you the desired effect.
In response to Masterdan
Okay, thanks alot!
I'm sure you can find a zillion discussions on this topic if you search for the right words on the forum.

"Move delay" would be a good place to start.
In response to Foomer
Ah... I never learnt to search on the forum for old topics. Thanks for the tip, I'll make sure to check old topics as well as demoes and libraries on this subject.
In response to Masterdan
I find a boolean "walking" variable to always be inferior to a "nextstep" variable:

mob/var
movedelay = 2
tmp/nextstep = 0

//intercept here because it's where voluntary movement comes from
client/Move()
if(world.time <= mob.nextstep)
mob.nextstep = world.time + mob.movedelay
.=..()
else
return 0
In response to Garthor
I've tried implementing this and it led to my mob being unable to move
In response to Demon_F0rce
Whoops, got my if() statement backwards. That should be if(mob.nextstep <= world.time)
In response to Garthor
Okay.

1. Moving now.

2. I see no difference.

3. My runtime messages are appearing in my output.

So, no offence or anything, but I'm going to stick with the method Masterdan gave me.
In response to Demon_F0rce
You will see no difference when you are playing single player. The difference comes once you host a game with over 20+ players(rough estimate it may be less). I will bet you that someday using the sleep() method for movement delay will backfire(i.e. Having sleep()s stack upon each other). But then again, who am I to decide for you?
In response to Demon_F0rce
If you have a system of saving the mob, you can do this to break Masterdan's code:

Set movement delay to 2 seconds (just so it's easier for you).
Move.
Before the 2 seconds are up, log out.
Now, log back in. Whoops! You can't move! Ever!
In response to Garthor
I see. I actually found that...
In response to Garthor
Not to mention he's overriding mob/Move(), meaning external forces can't move the mob either (such as spells, attacks, teleports, whatever). client/Move() is the way to go as it only prevents the player from initiating movement.

-- Data