ID:145082
 
Code:
client
Northwest()
if(usr.canmove)
if(usr.inturret)
usr.dir="NORTHWEST"
sleep(1)
return
else
usr.canmove=0
..()
sleep(usr.speed)
usr.canmove=1
else
return
Southwest()
if(usr.canmove)
if(usr.inturret)
usr.dir="SOUTHWEST"
sleep(1)
return
else
usr.canmove=0
..()
sleep(usr.speed)
usr.canmove=1
else
return
Northeast()
if(usr.canmove)
if(usr.inturret)
usr.dir="NORTHEAST"
sleep(1)
return
else
usr.canmove=0
..()
sleep(usr.speed)
usr.canmove=1
else
return
Southeast()
if(usr.canmove)
if(usr.inturret)
usr.dir="SOUTHEAST"
sleep(1)
return
else
usr.canmove=0
..()
sleep(usr.speed)
usr.canmove=1
else
return

North()
if(usr.canmove)
if(usr.inturret)
usr.dir="NORTH"
sleep(1)
return
else
usr.canmove=0
..()
sleep(usr.speed)
usr.canmove=1
else
return
South()
if(usr.canmove)
if(usr.inturret)
usr.dir="SOUTH"
sleep(1)
return
else
usr.canmove=0
..()
sleep(usr.speed)
usr.canmove=1
else
return
West()
if(usr.canmove)
if(usr.inturret)
usr.dir="WEST"
sleep(1)
return
else
usr.canmove=0
..()
sleep(usr.speed)
usr.canmove=1
else
return
East()
if(usr.canmove)
if(usr.inturret)
usr.dir="EAST"
sleep(1)
return
else
usr.canmove=0
..()
sleep(usr.speed)
usr.canmove=1
else
return


Problem description:
When I am in the turret (my variable is set to usr.inturret=1), I just stay in that direction. I never am able to move direction... But turrets aren't supposed to literally move, just can change direction, which is what I need.

If somebody could please help me with what I did wrong, or show me in the right direction, it would be greatly appreciated.

Well first, you can simplify your code by overwriting client/Move() instead of the different directions. You also can't set the direction variable to text strings such as "NORTH" or "SOUTHWEST". You can set them to the macros NORTH and SOUTHWEST. Since dir only can be a number, you won't seem to be changing directions.

client
Move(nloc, direc)
// nloc is the new location, and direc is the direction
// the player pressed
if(!mob.canmove) return
if(mob.inturret)
mob.dir = direc // just change direction if they're in a turret
return
canmove = 0
spawn(1) canmove = 1
return ..() // otherwise, do stuff normally


~~> Unknown Person