this is the code i have.
mob/var/walk = 2
mob/Move()
if(usr.walk)
..()
usr.walk = 0
sleep(2)
usr.walk = 2
else return
But the sleep messes with my random combat.What can i do to fix this problem.
ID:261380
Feb 11 2002, 11:50 am
|
|
Feb 11 2002, 11:58 am
|
|
I'm not sure exactly how it messes with your combat code but you might want to try doing it with spawn() instead of sleep(). That will let Move() finish right away, then change walk = 2. Sleep freezes the proc then continues.
|
In response to English
|
|
Ill give it a shot and thanks :)
|
In response to English
|
|
I can get in battles now but im still moving way to fast this is what the code is now.
mob/var/walk = 2 mob/Move() if(usr.walk) ..() usr.walk = 2 spawn(2) usr.walk = 2 else return |
In response to Open Server
|
|
Why are you setting walk = 2 three times? You were closer the first time. You want to check if the mob is already moving. Then you set your walk flag so that Move() will not do anything while the flag is set. After an amount of time you determine with the spawn proc, you set the flag so that Move() will work again.
If you want to slow it down, increase the value you spawn for. Also, I suggest setting the walk flag to block before ..() is called. Something like: mob/var/walk = TRUE mob/Move() if(usr.walk) usr.walk = FALSE ..() spawn(2)//Might want to use a bigger value usr.walk = TRUE return TRUE return FALSE |
In response to ACWraith
|
|
Worked great :D
|