Single Light System, regions

Posted By: jumpman

Single Light System, regions - 09/14/17 18:05

Hello friends!

In a shader, I have 1 light source, its position and intensity is based on the entity's vecskill. Its fine and swell, I can move it around wherever I want, each entity gets their own personal light.

So looking ahead, in my game which is primarily going to be outdoors, I wanted to see if I could setup a system where this personal light would switch between the sun position, and between another position designated by the level. So for example, if an entity walks into a room with a fireplace, I want the shader's personal light to go to the fireplace position. If the entity steps out, the personal light should switch to the sun.

My first thought is to try using regions! I can make a region inside a cabin, and if the entity is within that region, its personal light will switch to the fireplace. If the entity is not in a region, he will switch his personal light position to the sun. The problem here is that, regions dont have any other attributes other than a name! They dont have any skills I can set in WED, therefore I cant manually type in a light vector.

I would like to stay away from using distance based calculations, because it would then require a trace. If the player is outside the cabin, but closer to the fireplace, his personal shader light will go the fireplace. If thats the case, I would need a trace to fix this.

Is there a way to give each region an individual vector?
Posted By: Superku

Re: Single Light System, regions - 09/14/17 18:19

You could just put an entity in the region, give it the same name and use region_find + ent_for_name to read its skills.

EDIT: @below: You are welcome! wink
Posted By: jumpman

Re: Single Light System, regions - 09/15/17 00:11

Hi Superku, ive tried your system....and it works!! THANK YOU! You are a clever dude!
© 2024 lite-C Forums