ID:158805
 
How would i go about this? I want to create a obj and whenever the player moves, the obj will move in the same direction as the player simultaneously.
One (and probably the simplest) way to do this is by overriding client/Move() to move that obj in the same direction the mob was moved (optionally only if the movement was successful) when a player sends a movement command to move his mob, such as by pressing the arrow keys. That proc isn't processed when the mob is moved by an outside/different source, only when a player moves his own mob, so it may or may not be what you want. You could override mob/Move() instead to make it take effect whenever the mob is moved by anything (that calls Move(), anyway), or alternatively turf/Entered(), those are just somewhat less simple.
In response to Kaioken
So what if I create an object in proc such as

mob/proc
starttimer(mob/M)
var/obj/T = new/obj/timer
T.loc = locate(M.x,M.y,M.z)

if i use client/Move(), it wouldn't be able to see the var/T.
In response to Sandlight
Then you make it a mob variable instead.

Also: why the hell do people use locate() for EVERYTHING?

This is dumb:
        T.loc = locate(M.x,M.y,M.z)


This is not-dumb:
T.loc = src.loc
In response to Garthor
isn't those the same thing though, they achieve the same purpose
In response to Sandlight
It is the same but the latter is a lot more efficient, less processing needed (no matter how insignificant it may be)
In response to GhostAnime
mob/var/obj
timer/time
mob/proc
starttimer(mob/M)

M.time = new
M.time.loc = M.loc
client
Move()
if(usr.time in world)
usr.time.loc = usr.loc
return ..()


Well, this is the code I have now, however instead of the timer being in the same place as the player, it is following the player like a dog.
In response to Sandlight
You want the ..() before you move the timer, or else the timer would be moving to the space the player was on before they moved.
In response to Sandlight
Because calling the parent ( ..() ) is what actually does the movement. So you're setting the time's loc BEFORE you move, rather than after.
In response to Garthor
If I do
client
Move()
return ..()
if(usr.time in world)
usr.time.loc = usr.loc
the timer doesn't move at all
In response to Sandlight
Now you're returning the proc before it does anything else. Take the return out.
In response to Kaiochao
Ok, I got it, thank you for all your help guys