ID:148613
 
Im trying to get my turf to create one Y location up from my other turf, but my current code doesnt work. Can anyone help me with a quick answer?

var/turf/Overlays/RockOverlay3b/c = new(a.x,a.y-1,a.z-1)

When i run, i get a Bad Loc
Mrhat99au wrote:
Im trying to get my turf to create one Y location up from my other turf, but my current code doesnt work. Can anyone help me with a quick answer?

var/turf/Overlays/RockOverlay3b/c = new(a.x,a.y-1,a.z-1)

Even if you did the locate() right, that's actually 1 tile south, on another z-level. If the location was valid, it still wouldn't be visible to you from where you were.

When i run, i get a Bad Loc

The reason: You're passing x,y,z directly instead of a locate():
var/turf/Overlays/RockOverlay3b/c = new(locate(x,wrongy,wrongz))
Movable atoms don't complain if you give them a number (x) for their loc, but will simply show up in null. Turfs don't have that luxury, so you get the error.

Now, to get a tile one Y location up (by which I assume you mean north), you'd use get_step(a,NORTH). If you actually mean "up" as in another z-level, and z-1 is "up" (that is, higher z levels count downward), then you'd use get_step(a,DOWN) or locate(a.x,a.y,a.z-1). BYOND's built-in, undocumented bit flags for UP and DOWN are named for higher z's being upward and lower ones being downward.

Lummox JR