Please or Register to create posts and topics.

Problems creating switchable light

Apologies if this is a very basic issue, but I'm new to mapping and haven't found a solution to this anywhere:

I've been trying to set up a trigger so that the lights turn on in a room when the player enters, but I'm having a lot of trouble with it. I have a single basic light in there at the moment and it works fine, but with the trigger in place it only lights up a few random surfaces, with most still appearing dark.

When I compile I get a lot of "Too many light styles on a face" messages which I assume are the source of the issue. As such I tried both deleting all names for the other static lights in the map and giving them all the same name after reading the following on Valve's developer site:

Quote:
WARNING: Too many light styles on a face (XXX,XXX,XXX)
At the coordinates specified there is a surface lit by too many "effect" lights. This includes lights that have a name (which compiles both on and off status so you could switch them) or a light using effects like flickering. Remove some of them, disable flickering effects or make sure they don't have a name.
Note: A surface may only be lit by up to 4 lights with different targetnames. This means a face can be lit by unlimited different light styles as long as they share up to 4 names.

However, neither of these attempts fixed the issue at all. Even giving up and resetting everything to how it was originally didn't help - I had to actually delete the light and create a new one.

The room does contain a fizzler grid, laser grid, lightbridge and two cube dropper instances which I just noticed have lights attached - do all of these count amongst those 4 allowable sources?

If not, is it possible I'm doing something else wrong? I wasn't entirely sure about how to set the light to be off to begin with - my solution was to use a logic_auto to turn it off on map spawn but I wonder if there's a neater way to do it....

---------------------------
My maps: Double Bill / Jam / Oval Window / Gymnasium / Gymnasium Part 2 / Minimalism (collection) / Resolution
All feedback welcome!
---------------------------
El Farmerino wrote:
Apologies if this is a very basic issue, but I'm new to mapping and haven't found a solution to this anywhere:

I've been trying to set up a trigger so that the lights turn on in a room when the player enters, but I'm having a lot of trouble with it. I have a single basic light in there at the moment and it works fine, but with the trigger in place it only lights up a few random surfaces, with most still appearing dark.

What is important to know about the source engine is that lighting is calculated while the map renders. If there is no lighting on a surface when the map compiles it will be black. So if you really want to turn on/off lights when you enter the room give all the lights a name say room one lights: room_1_light and use a logic_auto with onmapspawn room_1_light disable. This way the lights are turned off as soon as the map starts.

El Farmerino wrote:
When I compile I get a lot of "Too many light styles on a face" messages which I assume are the source of the issue. As such I tried both deleting all names for the other static lights in the map and giving them all the same name after reading the following on Valve's developer site:

Quote:
WARNING: Too many light styles on a face (XXX,XXX,XXX)
At the coordinates specified there is a surface lit by too many "effect" lights. This includes lights that have a name (which compiles both on and off status so you could switch them) or a light using effects like flickering. Remove some of them, disable flickering effects or make sure they don't have a name.
Note: A surface may only be lit by up to 4 lights with different targetnames. This means a face can be lit by unlimited different light styles as long as they share up to 4 names.

However, neither of these attempts fixed the issue at all. Even giving up and resetting everything to how it was originally didn't help - I had to actually delete the light and create a new one.

This is an error in yellow, yellow errors can often be ignored =D

El Farmerino wrote:
The room does contain a fizzler grid, laser grid, lightbridge and two cube dropper instances which I just noticed have lights attached - do all of these count amongst those 4 allowable sources?

Short answer: no.

El Farmerino wrote:
If not, is it possible I'm doing something else wrong? I wasn't entirely sure about how to set the light to be off to begin with - my solution was to use a logic_auto to turn it off on map spawn but I wonder if there's a neater way to do it....

The most neat way to do it is not switching lights. It doesn't really make a difference for performance or anything so I would only use lights with names if I want to create some sort of effect (like starting up a room).

I hope that was somewhat helpful :)

Actually, only two lights per affected surface are allowed. I think.

Released Maps
[spoiler]WOM Test 1
Laser Cube Quest
Mho' Power - Community Spotlight!
Four Corners[/spoiler]

indeed. And ipfreaky, cube droppers DO count toward your light allowances, as they have a named light in them. Any instance with a named light in it counts toward your allowance. I know, ive had this error in maps with no named lights apart from those in instances.

Image
I think in terms of boolean variables. Generally, it makes things easier.
Spam Nugget wrote:
indeed. And ipfreaky, cube droppers DO count toward your light allowances, as they have a named light in them. Any instance with a named light in it counts toward your allowance. I know, ive had this error in maps with no named lights apart from those in instances.

Woops, my fault. For some reason I'm still using some kind of prefab for my cube droppers, and they don't have a light in them :notwant:

Ah, okay, that's definitely it then. I'll just leave it as a basic light for now; in any case I was trying to get it working more as a learning exercise than as something that's really necessary for the map. Many thanks for the advice everyone.

Presumably it would be possible to edit the dropper instances and un-name/rename/delete the lights therein if I so wished, or would that cause problems with their functionality? Regardless I haven't even finished the puzzles in the second chamber yet, so I'll just leave the aesthetics until I'm done with that.....

---------------------------
My maps: Double Bill / Jam / Oval Window / Gymnasium / Gymnasium Part 2 / Minimalism (collection) / Resolution
All feedback welcome!
---------------------------

Feel free to get rid of the light in the instance, its not even noticeable when it switches except in dark rooms. Or, you can do what I generally do and ignore the warning completely.

Image
I think in terms of boolean variables. Generally, it makes things easier.

@OP:

For a future project I'm planning to make a room where the lights turn on as the player enters, exactly as you describe, but I don't want to use real switching lights because of the limitations described in this post, and also because they look less good than static lighting.

What I'm probably going to do is to make two versions of the room, one with the lights on, and one with the lights off. The light room is connected to the rest of the map, whereas the dark room is separate, and connected by a pair of linked_portal_door entities, placed so that from the entrance, the dark room appears in the exact same spot as the light one.

When the player approaches the entrance, (but before they cross the portal plane), the link turns off, replacing the dark room with the light one. Since both rooms are otherwise the same, this creates the illusion of one single room where the lights turn on.

I haven't made this yet, but I thought I'd throw this idea out there in the hope that you find it useful.

Sendificate series: Sendificate | A Beam Too Far | Airtime | 302
Other Portal 2 maps: Medusa Glare
Portal 1 maps: Try Anything Twice | Manic Mechanic