ID:261607
 
if(src.x==usr.x+2 && src.y==usr.y+1)
usr.loc=locate(usr.x+1,usr.y+1,usr.z)
for(var/turf/board/black/A in usr.loc)
if(A.oocby=="Black")
for(var/obj/pieces/B in usr.loc)
del(B)

That's my code, but it dosn't seem to want to locate the user to usr.x+1,usr.y+1,usr.z I don't get it. Please help PLEASE!
Can you show the entire proc?
In response to WizDragon
Click()
if(turn==usr.key)
if(usr.selected==1)
if(red==usr.key)
if(usr.king==0)
if(src.occ==0)
if(src.x==usr.x+1 && src.y==usr.y+1)
for(var/turf/board/black/A in usr.loc)
A.occ=0
A.oocby=""
for(var/obj/pieces/red/A in usr.loc)
del(A)
usr.loc=locate(src.x,src.y,src.z)
new/obj/pieces/red(usr.loc)
for(var/turf/board/black/A in usr.loc)
A.occ=1
A.oocby="red"
usr.selected=0
turn=black
if(src.x==usr.x-1 && src.y==usr.y+1)
for(var/turf/board/black/A in usr.loc)
A.occ=0
A.oocby=""
for(var/obj/pieces/red/A in usr.loc)
del(A)
usr.loc=locate(src.x,src.y,src.z)
new/obj/pieces/red(usr.loc)
for(var/turf/board/black/A in usr.loc)
A.occ=1
A.oocby="red"
usr.selected=0
turn=black
if(src.x==usr.x+2 && src.y==usr.y+1)
usr.loc=locate(usr.x+1,usr.y+1,usr.z)
for(var/turf/board/black/A in usr.loc)
if(A.oocby=="Black")
for(var/obj/pieces/B in usr.loc)
del(B)
if(black==usr.key)
if(usr.king==0)
if(src.occ==0)
if(src.x==usr.x+1 && src.y==usr.y-1)
for(var/turf/board/black/A in usr.loc)
A.occ=0
A.oocby=""
for(var/obj/pieces/red/A in usr.loc)
del(A)
usr.loc=locate(src.x,src.y,src.z)
new/obj/pieces/red(usr.loc)
for(var/turf/board/black/A in usr.loc)
A.occ=1
A.oocby="red"
usr.selected=0
turn=black
if(src.x==usr.x-1 && src.y==usr.y-1)
for(var/turf/board/black/A in usr.loc)
A.occ=0
A.oocby=""
for(var/obj/pieces/red/A in usr.loc)
del(A)
usr.loc=locate(src.x,src.y,src.z)
new/obj/pieces/red(usr.loc)
for(var/turf/board/black/A in usr.loc)
A.occ=1
A.oocby="red"
usr.selected=0
turn=black
In response to DBZ Kidd
Are you sure you want to move usr and not src?
In response to WizDragon
Yes, because I don't want to move the black space
In response to DBZ Kidd
And are you sure that usr is the piece you want to move and not just an invisible mob?
In response to WizDragon
usr.loc=locate(usr.x+1,usr.y+1,usr.z)
for(var/turf/board/black/A in usr.loc)
usr<<a.oocby
<br/> This is the problem. It locates the user, but it dosn't display A.oocby, and I'm sure that oocby has some value.
In response to DBZ Kidd
You're trying to search for a turf inside usr.loc. But usr.loc is a turf, and you can't have a turf inside a turf. In other words, you're trying to look for something that's inside of itself. Instead, you may want to try:
usr.loc = locate(insert x/y/z here)
if(istype(usr.loc,/turf/board/black))
usr << usr.loc:oocby

Even better, you can look for turfs in view(0), like so:
usr.loc = locate(x/y/z)
for(var/turf/board/black/A in view(0))
usr << A.oocby