ID:173369
 
Ok the onlything I need help on is placement...When you go into battle if your facing north or south the enemy would be 2 spaces down and Horizantol it would be two spaces across... The only thing I need help is how to set up the part to move them arrcordinly please help (I know my spelling is bad so please no posts on my spelling)
In the time it took you to type that you could have run a spellcheck.
In response to HavenMaster
In all of the posts I've read that you've replied to...I can only say one thing. Havenmaster, you are a godsend :D
Aaiko wrote:
I think what you are wanting it something like this...

M will be the enemy
if(src.dir==NORTH)
M.loc=locate(src.x,src.y+2,src.z)
M.dir=SOUTH
if(src.dir==SOUTH)
M.loc=locate(src.x,src.y-2,src.z)
M.dir=NORTH
if(src.dir==EAST)
M.loc=locate(src.x+2,src.y,src.z)
M.dir=WEST
if(src.dir==WEST)
M.loc=locate(src.x-2,src.y,src.z)
M.dir=EAST

What this does is places the enemy 2 spaces away from the user, facing the user like they are about to battle or something. Your post did not really make since, but maybe this will help.

There's no need to do all of that, just make use of some of the built in procedures.
var/TargetTile=get_step(player,player.dir)
enemy.Move(locate(get_step(TargetTile,player.dir))
enemy.dir=get_dir(enemy,player)


That should work.

~>Volte
In response to Volte
Additionally, in a series of if() statements where only one is supposed to be correct, it's a good idea to make everything after the first if() into an "else if()". This serves two purposes:

First, it saves processing power, because once it finds the right answer, it won't check to see the others.

Second, because when you're dealing with multithreading, with multiple things happening at the "same time" (notice the quotes: it's technically not the same time, but that is irrelevent), in the time it takes this thread of the program to fetch src.x, src.y, and src.z, add or subtract 2, locate a turf, fetch M.loc, assign it, fetch M.dir, and assign THAT, another thread could have changed src.dir, and this thread will enter into another if() block.
In response to Garthor
Also, in this particular case, switch() would work great.