ID:268184
 
Look at this code:

turf/wall
icon = 'wall.dmi'
layer = MOB_LAYER+99

mob/verb/destroy_wall()
var/obj/o = new/turf/wall
usr.overlays += o


The problem is that the wall doesn't appear above me. What's wrong?
Try using MOB_LAYER+1
In response to Rockinawsome
Rockinawsome wrote:
Try using MOB_LAYER+1

Still appears on top of me, not above.

obj/wall
icon = 'regwater.dmi'
layer = MOB_LAYER+1
mob/verb/destroy_wall()
var/obj/o = new/obj/wall
usr.overlays += o


Thanks!

--SSJ4_Gohan_Majin
You never actually stated what you want to do, using that layer will cause the wall to appear on top of your mob if the mob is on the same tile as it. I don't see why you'd ever want to use a turf as an overlay either, it's not practical.
In response to Nadrew
Nadrew wrote:
You never actually stated what you want to do, using that layer will cause the wall to appear on top of your mob if the mob is on the same tile as it. I don't see why you'd ever want to use a turf as an overlay either, it's not practical.

What I want to do, is make the wall appear ABOVE me.
You say "I want it above me, not on top of me". By this do you mean you want it literally higher on the screen? The layer variable does not accomplish that, pixel_y does. Change its pixel_y to 32 if you want an object to appear a tile farther to the north than you are.
In response to Loduwijk
Okay, sorry for my previous post, I merely looked at the code and gave it a responce...well here is what you can do to offset your overlay to the square above the one your mob is in...
obj/wall
icon = 'head.dmi'
layer = MOB_LAYER+1
pixel_y = 32
mob/verb/grow_head()
var/obj/o = new/obj/wall
usr.overlays += o

Merely adjust the number 32 to any number still positive to change how far north the object will appear but placing the pixel_y to 32 will make it so it appears directly in the square above you...I changed your code a bit because I didn't understand what you were trying to accomplish with that code, something to do with a wall and water, I just found it amusing to use the verb "grow head" instead...Sorry...I have an odd since of humor... Anywho here is a quote you get from the help file when you hit F1 on your compiler and look for the pixel_y var:

"This displaces the object's icon on the y-axis by the specified number of pixels, which can range from -32 to +32. (You can get away with larger displacements, but they are not guaranteed to work for objects off the edge of the map.)

Since overlays and images can each have their own additional displacements, this makes it possible to create visual effects that extend beyond the object's own cell in the turf grid, but which automatically move around with the object.

This effect is purely visual and does not influence such things as movement bumping or view() range calculations."


Well hope that helps...if not, explain more about what you're really trying to do and somebody will respond to you if I am to absent minded to do so...