[Solved] Changing properties of SectorLight thing mid-game?

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

Locked
User avatar
Rex Claussen
Developer
Developer
Posts: 2659
Joined: Tue Jul 11, 2006 18:36
Contact:

[Solved] Changing properties of SectorLight thing mid-game?

Post by Rex Claussen »

Here's what I start with:
  • 1. I have a sector that has a light value of 128, and I have assigned the sector a tag number (in this case it is 198).
    2. Within the sector is a SectorLight thing with the following arguments: 160, 160, 160, 32, 2 (R, G, B, radius, scale). It is placed high enough that the glow sufficiently illuminates the ceiling (which has a texture of ceiling lights)
    3. At this point the lighting looks fine.
Here's what I want to happen:
  • 1. The player triggers a script
    2. The sector with tag number 198 becomes a flickering sector via a line in the script:
    Light_Flicker (198, 160, 112);
    3. The SectorLight thing should now take on the properties of the flickering light sector, and the dynamic light ought to be flickering synchronously with the flickering sector.
Instead what happens is that the sector flickers, but the SectorLight thing retains the original properties.

I have altered the RGB values, and set the scale = 1, but these changes do not affect the outcome. I set the RGB values to 0 respectively, in which case there is no dynamic light at all.

Is the SectorLight thing designed not to alter properties mid-game? Or is there another solution for what I want?
Last edited by Rex Claussen on Sat Apr 18, 2009 3:46, edited 1 time in total.
User avatar
Remmirath
DRD Team Admin (Inactive)
Posts: 528
Joined: Fri Feb 15, 2008 19:43
Location: Somewhere...
Contact:

Re: Changing properties of SectorLight thing mid-game?

Post by Remmirath »

I don't think you can change thing attributes during game. Even if you set up the script correctly, it won't have any effect.
SoulPriestess wrote:Good job, Morpheus! You are teh awesum!
User avatar
Rex Claussen
Developer
Developer
Posts: 2659
Joined: Tue Jul 11, 2006 18:36
Contact:

Re: Changing properties of SectorLight thing mid-game?

Post by Rex Claussen »

Morpheus wrote:I don't think you can change thing attributes during game. Even if you set up the script correctly, it won't have any effect.
Agreed. Except that I'm not really changing the attributes of the thing itself; I'm changing the attributes of the sector from which the thing derives some of its attributes. (But perhaps that is what you meant. In that case I'll have to figure another way around). Thanks.
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: Changing properties of SectorLight thing mid-game?

Post by Enjay »

Having done a bit of searching around, my impression is that the effect that you want should be what the sector light thing does - basically apply a scale factor to whatever the light level is in the sector the thing is in then glow bigger or smaller as a result. If the light level changes, then I think that the intensity of the light object should too.

However, getting it to work in practice seems a lot trickier. The only sector types that I could get to have an obvious effect on the dynamic light were the ones that pulse on and off regularly and I don't think that's an appropriate solution for what you want. This, unfortunately, is a light object that I have never really used and, although the last time I asked about it I did get an answer, it also became clear that Graf hadn't been too sure as to what the original intended function of the thing was either. Given the original unclear nature of the function and the fact that it does seem to be rarely used, perhaps it isn't as functional as it is meant to be?

http://forum.drdteam.org/viewtopic.php?f=22&t=1464
User avatar
Rex Claussen
Developer
Developer
Posts: 2659
Joined: Tue Jul 11, 2006 18:36
Contact:

Re: Changing properties of SectorLight thing mid-game?

Post by Rex Claussen »

Enjay wrote:This, unfortunately, is a light object that I have never really used and, although the last time I asked about it I did get an answer, it also became clear that Graf hadn't been too sure as to what the original intended function of the thing was either. Given the original unclear nature of the function and the fact that it does seem to be rarely used, perhaps it isn't as functional as it is meant to be?

http://forum.drdteam.org/viewtopic.php?f=22&t=1464
I have actually used the object very successfully in situations when the sector lighting attributes remain static. The light object flickers just as intended, and the surrounding areas (even the ones outside the "light" sector) brighten & dim very realistically. The main problem I'm having is when the sector lighting changes in-game from steady to flickering.

I read the thread to which you linked, but it didn't shed any light on the problem I'm having. Note what DaniJ said (and to which timmie agreed): "...individual lights can be configured so that their brightness, scale and color changes depending on the RGB color of the sector they are in." In the example DaniJ gave, the light actor's attributes clearly change with those of the sector in which they are placed. So I wonder why it's not working in my case.

Thanks, anyway.
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: Changing properties of SectorLight thing mid-game?

Post by Enjay »

Rex Claussen wrote:I have actually used the object very successfully in situations when the sector lighting attributes remain static...
Hmmm... then I must be doing something wrong as my results are certainly mixed. Would you mind attaching a small demo at some point so that I can see what you are doing that I'm not?
User avatar
Rex Claussen
Developer
Developer
Posts: 2659
Joined: Tue Jul 11, 2006 18:36
Contact:

Re: Changing properties of SectorLight thing mid-game?

Post by Rex Claussen »

Enjay wrote:Would you mind attaching a small demo at some point so that I can see what you are doing that I'm not?
You got it, brother. (I was on travel, otherwise I would have responded sooner.)

The attached wad has 3 different types of light sectors. The one in the middle is static, the one on the left is blinking at random, and the one on the right is flickering at random.

You need to play with the RGB values, radius, and Z-height of the SectorLight thing to get the results you desire. Setting the scale to any value other than 0 completely screw up the flicker effect. Note that for the blinking & flickering light areas I have adjusted the ceiling height, opened up the walls a bit, and given the ceiling of the surrounding sector a dark-colored flat. These are all designed to accentuate the flickering effect and minimize (what I consider) the undesirable effect of the area remaining slightly lit when the flickering light reaches it's low value (during which time the light value ought technically to be 0). This is only a problem with the flickering light; the blinking light works as intended.

[EDIT: Because the SectorLight in the blinking sector worked so well, I thought I'd try that for my wad. Unfortunately, I couldn't figure out how to get a sector blinking mid-game. The wiki wasn't any help either.]
Attachments
FlickerLight.wad
(3.11 KiB) Downloaded 53 times
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: Changing properties of SectorLight thing mid-game?

Post by Enjay »

Thank you kindly. That is indeed a very nice effect. I think your WAD shows what I was doing wrong too. I had the scale value set far too high.

For your in game change, I assume that the flickering dynamic light would still work with a sector light value changed via a script? I know that we have discussed making a sector flicker using a script before and you decided that you would rather go with a flicker sector special but a loping script would probably still be a solution to this problem and allow other effects at the same time (eg activating a spark object).
User avatar
Rex Claussen
Developer
Developer
Posts: 2659
Joined: Tue Jul 11, 2006 18:36
Contact:

Re: Changing properties of SectorLight thing mid-game? [Solved]

Post by Rex Claussen »

Enjay wrote:For your in game change, I assume that the flickering dynamic light would still work with a sector light value changed via a script? I know that we have discussed making a sector flicker using a script before and you decided that you would rather go with a flicker sector special but a loping script would probably still be a solution to this problem and allow other effects at the same time (eg activating a spark object).
A looping script. Would you give me an example that accommodates a SectorLight thing? As far as I know I can't spawn such a thing, and I know I can't adjust the properties of the thing, so all I have is the ability to change the sector attributes.

The way it's set up now, the sector has a certain fixed light value (e.g. 128) and the SectorLight thing is placed in it to give the area a nice "glow". Say the player shoots the switch or the "light bulb" (or some other trigger is activated, causing a "short circuit"), a script is called up that modifies the light sector as follows:

Light_Flicker (198, 160, 112);

One would think that the SectorLight thing would work just like it does in the example wad I attached. Instead, the light thing seems to have disappeared ..... I think I just figured out the solution to my problem. Let me go check .....

Indeed, I have figured out what I was screwing up. It turns out that I had mistakenly tagged that SectorLight thing with the same tag number I had assigned to other SectorLight things that my script was designed to remove. In the process, when the script was activated the SectorLight thing in the sector that turned into a flickering sector, the thing was removed - thus not having the desired effect. My apologies for the confusion.

One question still remains, however: How can I change a sector from regular light to random blinking via a script or a linedef special?
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: Changing properties of SectorLight thing mid-game? [Solved]

Post by Enjay »

Rex Claussen wrote:Would you give me an example that accommodates a SectorLight thing? As far as I know I can't spawn such a thing, and I know I can't adjust the properties of the thing, so all I have is the ability to change the sector attributes.
Changing sector attributes is all I had in mind. The sector light thing is almost irrelevant. Before the sector starts flickering, it just sits there glowing, applying a scale factor to the constant light level in the sector. Once the sector light level changes, the light object obliges by changing too.

The attached shows the kind of thing that I had in mind and also shows the additional advantages. As the light flickers, I change the ceiling texture to a slightly duller looking version of the graphic and activate a spark.
fl2.zip
Just flick the switch.
(3.99 KiB) Downloaded 70 times
BTW, I don't think it is needed but changing the light objects properties in game may be possible. If you use something like "Thing_SetSpecial" you can change the args of a thing. Not sure if it will work with a dynamic light though. The other option is to have more than one object in the map set up with different arguments and then activate/deactivate them using the script.

As for your outstanding question... I don't know. :?

[edit] And the answer is, you must have done something wrong because it works for me. The attached modified file has, on the left, my scripted effect and, on the right, a much simpler script that merely sets the sector flickering.
fl3.zip
(4.05 KiB) Downloaded 59 times
[/edit]
User avatar
Gez
Developer
Developer
Posts: 1399
Joined: Mon Oct 22, 2007 16:47

Re: [Solved] Changing properties of SectorLight thing mid-game?

Post by Gez »

Too bad Thing_SetSpecial can only change the first three arguments and scale is the fourth...
User avatar
Enjay
Developer
Developer
Posts: 4748
Joined: Tue Aug 30, 2005 23:19
Location: Scotland
Contact:

Re: [Solved] Changing properties of SectorLight thing mid-game?

Post by Enjay »

Ack, I always forget which one is which...

http://zdoom.org/wiki/SetThingSpecial
User avatar
Gez
Developer
Developer
Posts: 1399
Joined: Mon Oct 22, 2007 16:47

Re: [Solved] Changing properties of SectorLight thing mid-game?

Post by Gez »

Thanks, I've updated the wiki.
Locked

Return to “GZDoom”