ID:145798
 
Code:
obj
Genjutsu
Bunshin_no_Jutsu
verb
Bunshin_no_Jutsu()
set category = "Genjutsu skills"
if(usr.Chakra >= 5 && usr.rest == 0)
usr.Chakra -= 5
var/obj/clone/C = new
C.icon = usr.icon
C.overlays = usr.overlays
C.loc = locate(usr.x, usr.y+1, usr.z)
C.name = usr.name
spawn()
while(usr && C)
if(get_dist(usr, C) > 2)
walk_to(C, usr)
sleep(20)
spawn(usr.ChakraCon)
del(C)
else
usr<< "You dont have enough chakra to do this or you are resting"
obj
clone
HP = 1
density = 1
clone = 1


Problem description:
clone flip around me at warp speed until they are deleted
                                if(get_dist(usr, C) > 2)
sleep(5) // Should slow them down a tad.
walk_to(C, usr)


Try that.
In response to XzDoG
no what i want them to do is follow at a distance of 2 tiles behind me not slow down movement guess I shoulda said that
In response to CYN
Sorry, You said they "Warped" around you. I figured you wanted them to slow down. My mistake.
Instead of placing the walk_to() in the while loop, you may consider doing something like this: walk(C,usr,2,20). The 2 is the minimum distant between them, and the 20 is the movement delay.
In response to Kija
Use walk_towards instead of walk_to. Also, you don't really need the while loop, since walk_towards and walk_to continue to run automatically. You can also add a lag to either of these procs if you want the clone to move slower (look them up in the reference).

Edit: Oops, responded to the wrong post.