ID:1014067
 
(See the best response by AJX.)
Ok, well, lets see... I'm having trouble with a bit of opacity. You see, I want to replicate the same effect that and area has, when luminosity is set to 0, and you can have players see further with the see_in_dark variable, but i want to do it with objects, you see?

Essentially, I want players to be able to spawn a mist, but i want certain players to be capable of seeing though said mist, while others can't. Doing this with an area atom is probably unsafe...

obj/Mist
layer = EFFECT_LAYER
luminosity=0
mouse_opacity = 0
New()
..()
var/I = 5
while(I)
src.icon = 'mist.dmi' - rgb(0,0,0,255-I*51)
if(I<3)
opacity = 1
sleep(5)
I--
src.icon = 'mist.dmi'


Just an example of what i have so far, involving a tile which gradually fades into view, and a certain point, becomes opaque. I want to make it so certain people though, can see further within the mist.
I just realized that I may have put this in the wrong section xD
Someone mind moving it to Developer Help?
Done.
Best response
What you're describing sounds a bit more detailed than what you could accomplish with a simple opaque/non-opaque setup. If that is sufficient, however, there is a library by Shadowdarke that imitates that behavior and allows you to make one-way windows. This same technology could be extrapolated to be toggled upon a skill use, and create the result you describe.

http://www.byond.com/developer/Shadowdarke/OneWayViewDemo

But what it sounds like to me is that you want different people to be able to see through the mist, and at varying lengths and severity. For that level of control, I don't believe the above method would be the best approach to start from.

For doing visual effects you don't want visible to everyone, one of the easiest methods available is the override var for images.
http://www.byond.com/docs/ref/info.html#/atom/var/override

This allows you to lay down a cloud of mist, with its default appearance being the normal opaque mist. Then, if a player wants to see through it, you create and apply an image with its override var set to true. Then anyone who can see through the mist is given vision of the image, which will be the same icon as the original mist, only with an appropriately transparent alpha.


Keep in mind that in any possible situations you want to only generate the image once, then display out the same image to ANYONE who would need to use it. Continuously generating new images for each person who needs it can create a large amount of unnecessary overhead.


Also keep in mind it is possible to have a multi-tiled override image, so you can have an entire AxB cloud of mist disappear at the same time while only using one image, assuming you appropriately handle the multi-tiled appearance, whether it be with one large image, overlays & underlays, or another method.

Personally, I use overlays that have pixel offsets for handling multi-tiled objects. This is an example of one of the images I create, stored in a var on the atom short for transparentImage. (The note in there was because image(src) instead of src.icon was creating a full copy of the image and its overlays, causing unforeseen complications)
            tIBuild()
if(!tI)

tI=image(src.icon, src, "[icon_state]T") //icon_state[T] is a pre-created transparent version of that icon state
/*
//
in the above line I had src instead of src.icon, I wonder if that was including
the overlays and that is what was causing all of my problems. I have been trying
to solve this for like twenty minutes now..

//
*/

tI.pixel_x=0 //the parent of this image had a pixel offset,
tI.pixel_y=0 //so it must be set back
tI.override=1


tI.overlays+= /obj/.../Parts/T2/T
tI.overlays+= /obj/.../Parts/T3/T
tI.overlays+= /obj/.../Parts/T4/T
tI.overlays+= /obj/.../Parts/T5/T
tI.overlays+= /obj/.../Parts/T6/T



/.../Parts
T2/
pixel_x=0
pixel_y=32
layer=MOB_LAYER+2
icon_state="T1,2" //non transparant state
T/icon_state="T1,2T" //transparant state


And an example of how to display images to a person:
/.../proc/AddViewer(mob/M)
if(counterSeen==0) //this means nobody is currently looking through this
if(!tI) tIBuild() //if there isnt a transparancy, create it

counterSeen++
if(M.client) M.client.images+= tI


This will change the appearance of the object to the image, but only for the players who are directly shown the images. (Either by M << image or M.client.images+= image)


If you intend to have multiple different levels of transparency, you would need to have and store a separate image for each possible result.


Edit; In response to this post I was going to release my newer and way less bad way of handling Tree Transparency, but I realized it was dependent on other engine mechanics I had made. So, now I have an entire package of multiple different features, one of which features a demo which allows simple and extremely efficient tree transparency. If you want an example of how to handle different people seeing the same object in different ways, check out the trees portion of the lib here.
http://www.byond.com/developer/AJX/TreeTransparency