ID:179471
 
How do you implement that neat little 'line of sight' code where beyond your character's vision, it goes black? I don't actually plan on using it in my project, but I do plan on being able to cast 'darkness' and such, centered around the caster. I assume I would use overlays for the darkness, but how do I get them to follow someone? I don't know how to make something follow someone simply because they are moving (a cloud of black, in this case)

Thanks for all the great help!

-- John
This is done by simple luminosity. Just set the luminosity on areas to 0.
Felegar wrote:
How do you implement that neat little 'line of sight' code where beyond your character's vision, it goes black? I don't actually plan on using it in my project, but I do plan on being able to cast 'darkness' and such, centered around the caster. I assume I would use overlays for the darkness, but how do I get them to follow someone? I don't know how to make something follow someone simply because they are moving (a cloud of black, in this case)

To make things follow someone, you'll need to keep track of what's following them and move all those objects during the Move() proc. If a player successfully moves, the objects following should move with them.
mob
Move()
.=..()
if(.)
for(var/obj/O in following)
... // do something to move the objs

Lummox JR
Thanks for the answers, but they aren't really getting me to step #1 yet, so let me ask it this way:

How would be a good way to create a temporary cloud of darkness (let's make it one bigger than the size of his vision to keep things simple) which would be centered on him and also move with him? This cloud of darkness would be something everyone would see, of course.

-- John
In response to Felegar
My current projects use opaque objs set to a layer above all normal map items. Check out the smoke deployment in Tanks for a demonstration. Look up opacity and layer in the reference for more info. To make them follow the mob they are cast on, look to Lummox JR's post earlier in this thread.
In response to Felegar
I would suggest, for starters, something that is completely random and ucky... colored all different, moveing differently. See what you can do by messing with rgbs and random numbers. Then, just make them follow the caster.
to get that cloud of blackness you are talking about do this.

usr.opacity = 1 
/*this will set it so there is only 1 space visible on each side of the mob*/
/*The number opacits is defined will set how many tiles are visible beyond the character, on each side*/

//to set the opacity back to normal do this//

usr.opacity = 0

Ken
In response to SonVegitto
SonVegitto wrote:
to get that cloud of blackness you are talking about do this.

> usr.opacity = 1 
> /*this will set it so there is only 1 space visible on each side of the mob*/
> /*The number opacits is defined will set how many tiles are visible beyond the character, on each side*/
>
> //to set the opacity back to normal do this//
>
> usr.opacity = 0
>
>

Ken

You are confusing opacity with luminosity. Opacity determines if you can see through an object. Luminosity determines the range of light emmited by an object.