ID:178474
 
I would like to set up a walk timer, where the character takes a step, waits a predetermined amount of time, subtracts ONCE from the attack timer, then walks again. Can someone please direct me to a post that talks about this. Thank you.
In response to Garthor
Regardless of if I move or not, the counter is reduced. Also, when I enter battle and am by a dense object, like mountains or water, if I am pressing the direction towards the dense object, I end up going on the object. I know that has to do with making the mob undense, but I have to, since I am making the game so that the character isn't moved to a different location, but instead is in the same location, unseen by the other characters. Any suggestions on how to get either of these problems fixed??? Thank you very much.

-----------
obj
hud
battlescreen
layer = MOB_LAYER + 1
icon = 'turfs.dmi'
icon_state = "battleback"
New(client/C,i as num,j as num)
screen_loc = "[i],[j]"
C.screen += src
mob
var
move_delay = 4 // how many ticks the player must wait between movements
tmp // these vars are not saved
move_time = 0 // the earliest time the mob may move

client
Move()
if(world.time < mob.move_time) // not enough time passed
mob.moved = 0
return
if(mob.density == 0)
return

// set the move_time for move_delay ticks from now
mob.move_time = world.time + mob.move_delay
mob.moved = 1
return ..() // do the default Move() proc and return what it returns


mob/Move()
..()
if(src.moved == 1)
var/turf/b = src.loc
src.steptobattle -= b.battlechance
usr << "[src.steptobattle]"
src.moved = 0
. = ..()

mob/proc
randomencounter2(mob/M as mob)
var
mon
randomnum
if(M.steptobattle <= 0)
for (var/i = 1; i<= 13; i++)
for(var/j = 1;j<=13; j++)
new/obj/hud/battlescreen(src.client,i,j)
M.inbattle = 1
M.density = 0
M.invisibility = 1
layer = MOB_LAYER + 2
M.oldlocation = M.preslocation
if(usr.oldlocation == "ryuzak")
randomnum = rand(0,2)
if (randomnum == 0)
mon = new /mob/monster/slime(src.client)
else if (randomnum ==1 )
mon = new /mob/monster/raven(src.client)
else
mon = new /mob/monster/drakee(src.client)
In response to Rubius
Rubius, if you want your move time set at 4 seconds you will need to have it set at 40 not 4...

40 = 4 seconds
4 = 0.4 seconds

Hope that helps the first problem for ya ^_~

--Lee

[Edit] Do you actually have your mountains and what not defined as dense?
In response to Mellifluous
That isn't the problem. I don't want to wait for seconds, just have a pause between steps. The problem with the counter is if you hold down the directional key, the counter will decrease (look at the first post to understand what I want to do with it) regardless if the character actually moves a square. For example, if I hold down the down arrow, the counter may decrease 3 times before the character actually moves. The simple solution is not to hold down the key, obviously, but I don't expect the characters to do that. As for the density issue, yes they are dense.