Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
DarkShroom

how to set a light color/intensity by script

Question

can you set a light color by script (a dynamic light Thing:Light) like you can set sector color and light level?

thanks

Share this post


Link to post

14 answers to this question

Recommended Posts

  • 4

I've always just set up multiple lights with all the colors I needed, and then used Thing_Activate and Thing_Deactivate to turn on just the colors I wanted. 

Share this post


Link to post
  • 1

Oh, you are using dynamic lights! I misunderstood, and thought you were using a thing to set the sector's color.

 

I just thought of an idea. You could have multiple light things, one for each color you want, and use Thing_Activate and Thing_Deactivate to choose which one is active.

Share this post


Link to post
  • 0

If you want to change the color of a sector with a script, you can use Sector_SetColor, but as it says on that page:

Quote

If your map is in the UDMF format, and you don't intend to modify sector colors later on, you can apply colors without the use of this special under the sector's custom tab. The color must be provided in hex, i.e. RRGGBB.

Additionally, desaturation can be applied in UDMF as well. The values for desaturation are in fixed point, meaning 0 is normal, and 1 is fully desaturated.

 

 

Share this post


Link to post
  • 0

i am able to do that already

what i was doing was i have marked the outside sectors with a tag and can change the outside light and fog settings with a script, i want to change the lights in the scene that are near the windows to the same colour as the the outside color

i wanted to store the various light levels in script and use tags as this allows me to change everything at once

i can't find a command that would set the RGB of the light thing

actually even if there was a shotcut to select all things of a certain tag this would be half way there, i'd not be able to change the values in game but this may not be so important


anyway i wanted to do it this way as it saves time as i tested out the different colours and change my mind about the background etc

Share this post


Link to post
  • 0
10 minutes ago, DarkShroom said:

actually even if there was a shotcut to select all things of a certain tag this would be half way there,

 

F3 is your friend.  You can search for all kind of specifics using it. 

Share this post


Link to post
  • 0
1 minute ago, Bauul said:

 

F3 is your friend.  You can search for all kind of specifics using it. 


okay for my immediate workflow that is epic, that's the sort of thing i need, much thanks (now i can continue with the tag strategy)

can i leave the question still open though if there is a way, as it's be pretty neat in my script to mess with the lights and sector levels simultaneously for a scripting thunder effect for example

I thought i had a lead with the "sector light" based on a zdoom forum thread, however it just seems to copy the sector intensity not the colour

Share this post


Link to post
  • 0

My suggestion is to not use a thing to set the color, but set the initial color directly on the sector itself, and then use Sector_SetColor to change it in your script.

 

You can set Lightning mode in MAPINFO, and then use Light_ForceLightning to change it, as desired, or just use Light_ForceLightning without setting it in MAPINFO.

Share this post


Link to post
  • 0

yes but it is the light itself, it's colour i want to change (and maybe the intensity to)

it is near the windows so it looks like light is leaking in the room, it is supposed to be the same colour as outside set by script

i can change the sector colours already, it was whether i can set the colour of a light itself by script.... so say i go okay let's use green, the outside will be changed to green in sector light but also the light leaking in the window goes green

at least anyway with f3 i can select all the lights in the map quickly and change the colour, just not dynamicly
 

Share this post


Link to post
  • 0

Yes you can't change dynamic light color by ACS, which is a shame. But as Empyre and Bauul said, using two lights with tags and colors you can pick and choose with Thing_Activate/Deactivate.

Share this post


Link to post
  • 0
19 minutes ago, Nevander said:

Yes you can't change dynamic light color by ACS, which is a shame. But as Empyre and Bauul said, using two lights with tags and colors you can pick and choose with Thing_Activate/Deactivate.

Oh, I didn't notice that Bauul had already had the same idea I had.

Share this post


Link to post
  • 0

ah sorry i missed that answer before a reply (activate/deactivate)

it wouldn't have achieved what i wanted unfortunatly, which was i essentially am setting up like a profile in the gzdoom script where i could decide red fade outside, red light at 128, then light inside at 96 etc so everything got changed at once and i could just make nice architecture and then test it with different light settings

F3 at least means i don't have a knightmare for this, i can at least select all the lights at once so it's the single best result i got from this question... it looks like that feature was essential.... oh god i wish tags could be WORDS!!! (welcome to doom huh)


anyway thanks for all the info so i know where i stand, as just a final thing though i thought this one:
https://zdoom.org/wiki/SetActorProperty
might have some change of doing what i wanted, but the lights not an actor right?

it really does seem weird to not have like a ThingSetProperty and to have enumerators for the properties like the R G B on the lights etc
 

Share this post


Link to post
  • 0
10 minutes ago, DarkShroom said:

it really does seem weird to not have like a ThingSetProperty and to have enumerators for the properties like the R G B on the lights etc

 

Well if you're that passionate about it, why not program it yourself? You seem to know your way around code. GZDoom is a community effort: every single non-vanilla feature you see (which is almost everything in the game by now) was programmed by someone in their spare time. There's likely a good reason adjusting the RGB of dynamic lights isn't currently accessible in ACS, but if you hop on over to the ZDoom forums or even the ZDoom Discord, that'd be a good place to start. 

Share this post


Link to post
  • 0
20 hours ago, Bauul said:

 

Well if you're that passionate about it, why not program it yourself? You seem to know your way around code. GZDoom is a community effort: every single non-vanilla feature you see (which is almost everything in the game by now) was programmed by someone in their spare time. There's likely a good reason adjusting the RGB of dynamic lights isn't currently accessible in ACS, but if you hop on over to the ZDoom forums or even the ZDoom Discord, that'd be a good place to start. 


it's not always that simple, you can't just add a feature and expect it to be added to the main source tree... if i do that i'll essentially be eliminating myself out of the official codebase... i have no idea who runs or controls the project, it can be very complicated getting in the inner circle of an open source product

also i'd also be needing zandorum and gzdoom to support it

getting a feature like this isn't just being able to code, it's convincing the rulers that be of two seperate open source projects that this idea is valid

i was gonna find out why actually anyway... but i suspect that they're more interested in zscript on the zdoom forum... i can't use this as zandorum does not support it... they probably created zscript to get around all these issues (as well as offer standard normal things like arrays you can resize etc)
 

Share this post


Link to post
  • 0
1 hour ago, DarkShroom said:

it's not always that simple, you can't just add a feature and expect it to be added to the main source tree... if i do that i'll essentially be eliminating myself out of the official codebase... i have no idea who runs or controls the project, it can be very complicated getting in the inner circle of an open source product

 

So pop on over to over to the ZDoom forums or Discord and ask what the process is! If you could work out how to implement it without breaking anything else there's no reason why it wouldn't be a candidate for merging into the main branch. 

 

As a starting point, why not check out the GZDoom github and see if you can identify why this isn't a feature in the code?

 

Zandronum is based on (albeit a much older version of) GZDoom so possibly code improvements would be compatible across the two. I'm guessing that you're creating a multiplayer map, which is why you're targeting Zandronum?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×