Jump to content

Simulate day / night cycle with lighting in interior cell


Recommended Posts

Good evening everybody!

 

What would be the "best way" to simulate the day / night cycle in an interior cell?

 

So, in the evening all of the lights get "dimmed" and and in the morning all ot them are back to full brightness.

The times for "turn bright lights on" and "dimm the lights" would be set with global variables, so they could be adjusted if neccessary.

 

I am guessing tow "ligh soures", one dimm and one bright and enable / disable them with a script based on the time of day, nothing too complicated.

 

But how would that scirpt work?

Running all the time in the background checking if the current time equals the "evening time" or the "morning time" to then enable and disable the lights?

That would be not really great in terms of performance ...

 

Is there any other ways one could do this?

 

Maybe something with quest stages?

 

 

 

And no, No, the interior cell does not have any windows.

Link to comment
Share on other sites

Depends on what you do. You could create a custom sky with lighting and set it to the interior cell. (It doesn't need a sky texture, the lighting is important)

And additionally add "enable/disable lights"

Link to comment
Share on other sites

You can set FXLightRegionSunlightWhite as Exterior Light under Emittance in the properties of a light reference, some other objects, other than lights, accept that setting, like for example BldGlassTransExt02OpaqueOnesided (that works better with FXLightRegionSunlightOffAtNightGlass), as well.

There are other exterior lights that do the same thing (regions actually). You can test the result in the CK by enabling Animate Lights and Effects , then move the slider for Time of day.

 

 

Edit: As additional information, you can use Set external emittance in Reference Batch Action (select all lights and press hyphen) to apply the same emittance setting to multiple lights:

 

Edited by DieFeM
Link to comment
Share on other sites

Ok, that "emittance" thing sounds like it would work nicely (that's how the windows work too, right? I didn't know that you could also appl that to "normal lights" too ...)

 

But ....

 

I want to be able to turn the lights on or off depening on other stuff (scripts, quest stages, .....) as well as have them do the "bright during day, darker during lnight" thing (if they are "on").

So depending on a global variable, the lights should work like this:

 

  • GlobalVariable is 0: Lights are off
  • GlobalVariable is 1: Lights are on
  • GlobalVariable is 2: Lights are dong the day/night thing
  • GlobalVariable is 3: Lights are on, but dimmed

 

If I used a "sky" thing for that interior cell, that would affect the entire interior cell, but I want to have multiple "sections" (rooms, ...) of the interior cell that can be controlled individually.

Link to comment
Share on other sites

I guess you would need to use some papyrus and 2 sets of lights. One set of lights dimmed and other set of lights with emittance. Let's say you have 4 lights for emittance and 4 dimmed lights, you need to set one of the dimmed lights as enable parent of the other 3, and the same for the emittance set of lights, so you only need to enable or disable the enable parent reference to change the state of the other lights. Then you can enable or disable the lights depending on your needs through a function. For example:

ObjectReference Property DayNightEnableParent Auto Const
ObjectReference Property DimmedEnableParent Auto Const

Bool LastWasCycle = True

Function SetupLights(Int LightSetting)
	If lightSetting == 0; Lights are off
		DayNightEnableParent.Disable()
		DimmedEnableParent.Disable()
	ElseIf lightSetting == 1; Lights are on
		If LastWasCycle ;check which set of lights was using the last time.
			DayNightEnableParent.Enable()
			DimmedEnableParent.Disable()
		Else
			DimmedEnableParent.Enable()
			DayNightEnableParent.Disable()
		EndIf
	ElseIf lightSetting == 2; Lights are doing day/night cycle
		DayNightEnableParent.Enable()
		DimmedEnableParent.Disable()
		LastWasCycle = True
	ElseIf lightSetting == 3; Lights are on, but dimmed
		DayNightEnableParent.Disable()
		DimmedEnableParent.Enable()
		LastWasCycle = False
	EndIf
EndFunction
Link to comment
Share on other sites

 

I guess you would need to use some papyrus and 2 sets of lights. One set of lights dimmed and other set of lights with emittance. Let's say you have 4 lights for emittance and 4 dimmed lights, you need to set one of the dimmed lights as enable parent of the other 3, and the same for the emittance set of lights, so you only need to enable or disable the enable parent reference to change the state of the other lights. Then you can enable or disable the lights depending on your needs through a function. For example:

ObjectReference Property DayNightEnableParent Auto Const
ObjectReference Property DimmedEnableParent Auto Const

Bool LastWasCycle = True

Function SetupLights(Int LightSetting)
	If lightSetting == 0; Lights are off
		DayNightEnableParent.Disable()
		DimmedEnableParent.Disable()
	ElseIf lightSetting == 1; Lights are on
		If LastWasCycle ;check which set of lights was using the last time.
			DayNightEnableParent.Enable()
			DimmedEnableParent.Disable()
		Else
			DimmedEnableParent.Enable()
			DayNightEnableParent.Disable()
		EndIf
	ElseIf lightSetting == 2; Lights are doing day/night cycle
		DayNightEnableParent.Enable()
		DimmedEnableParent.Disable()
		LastWasCycle = True
	ElseIf lightSetting == 3; Lights are on, but dimmed
		DayNightEnableParent.Disable()
		DimmedEnableParent.Enable()
		LastWasCycle = False
	EndIf
EndFunction

No, I would need 3 lights:

one "full brightness"

one "dimmed"

and one "with emittance"

 

But how would I "check" for the curent value of the GlobalVariable?

That could be changed by lots of things, like a quest, the player pushing a button, ....

 

Is there something like a "onGlobalVariableChange" event, or do I constantly have to have the script running and checking the value of the GloabalVariable?

Link to comment
Share on other sites

No, that would come in handy, tho. But I guess that if you need to change the global from a papyrus script or fragment anyway, why not just call the function instead?

Because I don't know everything that I want to implement into this yet.

So I want to have one script that does nothing but control the lights, one that controls things like locked doors, and so on ...

Keeping it nice and simple / clean.

And because maybe a quest will set the lights to off at some point. And I don't want to have the quest "directly touching" the light stuff, because like I said, other things might change the state of the light as well ....

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...