ID:180716
 
mob/var/last_move = -100
mob/var/move_delay = 3

mob/Move()
if(world.time < src.last_move + src.move_delay)
return
else
src.last_move = world.time
return ..() //do what mob/Move() normally does

ok here the problem I have saving and whenever someone logout and logs back in and loads there character they can't move at all! some one told me it may be a temporary variable.....How can i fix this problem?it could be Deadrons saving code but I don't think it is because I never have seen anyone have troble with his code...I could be wrong.
On 3/9/01 9:44 pm Darkness wrote:
mob/var/last_move = -100
mob/var/move_delay = 3

mob/Move()
if(world.time < src.last_move + src.move_delay)
return
else
src.last_move = world.time
return ..() //do what mob/Move() normally does

ok here the problem I have saving and whenever someone logout and logs back in and loads there character they can't move at all! some one told me it may be a temporary variable.....How can i fix this problem?it could be Deadrons saving code but I don't think it is because I never have seen anyone have troble with his code...I could be wrong.


Other people have had problems with my code here and there, but this isn't one of them thankfully.

If you don't specify a variable as tmp, then it gets stored in the savefile when you save the mob. In this case, you are storing the last_move time. But that won't always make sense, because the time you are using is how long your game has been running. Since your game will start up and shut down many times, the next time the person logs in, the time you have saved in the savefile may keep them from moving.

Try declaring it like this:

mob/var/tmp/last_move = -100