ID:852126
 
(See the best response by Super Saiyan X.)
Code:
mob
enemy
rat
Move()
..()
var/g = get_dist(loc,locate(initial(x), initial(y), z))
if (g > 3)
src.Move(locate(initial(x), initial(y), z))


Problem description:

i would like the mob to be reset to its initial position after the mob walks 3 tiles from its initial position. with this code, no errors and nothing happens
atom.x, atom.y, and atom.z are initially 0.
if they are initially 0 then why does nothing happen. anyways how do i get this code to work?
Best response
initial() returns a variable to it's COMPILE-TIME assignment.
the loc, x, y, z, variables, this is 0. So, every time you do initial(x) it's really returning 0, or null.

What you probably should do instead is create another variable to store the the mob's initial location/s, and then do get_dist(loc, initial_location) or something, you know.
ok. i understand now. thank you :)