ID:175928
 
I have no problem with overlays, meaning i know how to use them and all but how would i get a hand icon that i made to appear 1 space above the players head... and stay there and people can walk under it. oh yeah while im at it i have a glass wall. I was wondering how you could make it where you walk under it.
Cloudiroth wrote:
I have no problem with overlays, meaning i know how to use them and all but how would i get a hand icon that i made to appear 1 space above the players head... and stay there and people can walk under it. oh yeah while im at it i have a glass wall. I was wondering how you could make it where you walk under it.

Check out the 'layer' var, that is listed in the reference.

~>Volte
For the first question, you need to know two properties: pixel offsets, and layer...

Pixel offsets are variables that are used to change the location where a graphic is displayed by the number of pixels you set them to... pixel_x shifts the picture left or right, and pixel_y shifts it up and down...

Setting an object's pixel_y to 32 will make that object's icon display one full tile above its actual location... (-32 will be one tile below, and so on... and you can use any values... the higher the magnitude of the number, the farther from the object the picture will be displayed... 64 is two tiles above, -48 is one and a half tiles below, etc)

So that will allow your hand icon to be placed above the player's head...

Now, for people to be able to walk under it, you have to use the layer variable... Set the object's layer variable to something higher than the mob's layer (they each have a number, but I just prefer to use
layer = MOB_LAYER + 1
to put something above the mobs... and even decimals may be used to have even finer control over the layering)

Now, it's time to put it all together... In order to define these variables for your overlay, the overlay needs to be defined as an object (I just use objects, but I suppose you could define your own datum or whatever else) and then added to the mob as an overlay...

obj
hand_overlay
icon = 'handicon.dmi'
pixel_y = 32
layer = MOB_LAYER + 1

Then, to add it to the mob as an overlay:
mob.overlays += new /obj/hand_overlay

// "mob" can be changed to whatever variable you're using to refer to the player... "src" if it's in a mob proc, or M if you're using a mob/M type of thing, etc... and this line can be placed in whatever proc or verb you're using to add the hand icon...
In response to SuperSaiyanGokuX
Thanks.
In response to Cloudiroth
No problem...

But I forgot to answer your glass wall question...

Actually, to do that, all you have to do is alter the turf's layer variable to something higher than the mob's layer, just like with the hand overlay... Then, when the mob walks into that turf, the icon for the turf will be displayed over the mob, like you're walking under it...
In response to SuperSaiyanGokuX
You may also need to override some movement procs so that they can't walk through the glass wall... this depends on how you've got your walls set up on your map.

I believe there's a snippet somewhere on the forums that does this... let me dig it up for you...

EDIT: Found it. The actual snippet is in [link]; Lummox made some useful suggestions for improvement of it in [link].