Solving daylight problems via scripting (and making seasonal adjustments to daylight). This is theoretical, since I'm not at my modding machine and I'm not currently planning on adding this to FM, so yeah, sorry if it doesn't work? For the same reasons, I'm giving the English for the conditions/effects.
Note #1: All Climates use a no-oscillation time/no difference in day/night lighting.
Note #2: You'll need at very least, a player clock, like what exists in Default Notrium or FM. At very least you will need at least hours, in a 24 hour format.
Ingredients: ~4 Token Items. More tokens, the more smoothly you can transition between day and night. ~One script.
Step 1: Daylight Control Script:
Run every 1000ms. Runs by itself. No Conditions. Use Player's: Daylight Master Token. Use Player's: Dusk Token. Use Player's: Twilight Token. Use Player's: Midnight Token.
Daylight Master Token: Note that as these are used by scripts, they need neither Use, nor Quick keys.
Use: If: Player has 0 Dusk Tokens. If: Player's "Hours" bar is > 18. Then: Multiply Light by -0.15 (all colours). NB: You can multiply one of these colours (for example Red for default) to get a sky effect - Red sunset and the like, just make up the difference with future adjustments. I think this is Effect 8. Then: Add 1 Dusk Token to Player Inventory.
Use: If: Player has 1 Dusk Token. If: Player's "Hours" bar is > 8. Then: Multiply Light by 0.15 (all colours). Then: Remove 1 Dusk Token from Player Inventory.
Dusk Token Use: If: Player has 0 Twilight Tokens. If: Player's "Hours" bar is > 20. Then: Multiply Light by -0.2 (all colours - note if you had a particular colour tweaked in the Daylight Master Token, you'll need to make up the difference here). Then: Add 1 Twilight Token to Player Inventory.
Use: If: Player has 1 Twilight Token. If: Player's "Hours" bar is > 5 Then: Multiply Light by 0.2 Then: Remove 1 Twilight Token from Player Inventory.
Twilight Token Use: If: Player has 0 Midnight Tokens. If: Player's "Hours" bar is > 22. Then: Multiply Light by -0.2 (all colours - note if you had a particular colour tweaked in the Daylight Master Token, you'll need to make up the difference here). Then: Add 1 Midnight Token to Player Inventory.
Use: If: Player has 1 Midnight Token. If: Player's "Hours" bar is > 2 Then: Multiply Light by 0.2 Then: Remove 1 Midnight Token from Player Inventory.
This is a barebones system which will: If it's 6 p.m.: It will start to get dark. At 8 p.m.: It will get much darker. At 10 p.m.: It will be the darkest possible. This midnight period is a total of -0.55 light level. You can tweak this as you see fit. At 2 a.m.: It will start to get brighter. At 5 a.m.: It will get even brighter (Dawn). At 8 a.m.: Daytime brightness.
You can also do this in reverse with a Noon token, so you can have increased brightness between 11 a.m. and 1 p.m., just add 0.1 to the light level at this time.
Now, I honestly forget if this is a "set light level to:" or an "add to existing light level", but if it's the former, just set the light levels accordingly.
Advanced Stuff:
You can also use this to calculate seasonal variances by adding conditions to check whether it's, for example, Winter versus Summer. You can use this to create a Photosynthesis-type ability. Four separate conditions - If player has: 0 Dusk, 0 Twilight, 0 Midnight, 1 Noon, Then: Add X Energy/Food. Or to handle creature behaviours - If player has the appropriate tokens, aliens might become more active, or less. Or move slower.
Because this is script-based, you can instantly change day-length for every map by modifying the script that advances time.
To make a more gradual change without extra tokens, you can do it with one more item, a bar, and a script.
First up, rather than use Effect 8 in the Daylight tokens, instead add that many x100 to your:
"Light Change bar." -20-~20
Always keep this at integers. Life gets awkward if you forget this simple rule.
Light Change Script.
Run every Xms. X = however many 20ths there are between each time zone, based on the shortest period and the biggest change.
In the provided case, 2 "hours", so however long ten minutes takes in your system, that's how long between runs (ten, rather than twelve, since you want to make sure it's finished beforehand to avoid conflicts). So if it's 1000ms per minute, then you'll want it to run every 10000ms.
Light Change Item: Use: If: Player's Light Change Bar > 0. Then: Multiply Light Level by 0.01. (You'd need to tweak this slightly to pull off a sunset, but it's doable, you just need another item to handle the smaller dawn/dusk change) Then: Add -1 to Light Change Bar.
Use: If: Player's Light Change Bar < 0. Then: Multiply Light Level by -0.01. Then: Add 1 to Light Change Bar.
This will simply and smoothly adjust your lighting over the course of an hour or so, and back again. Again, the more detail you put in, the more you'll get out.
So yeah, there you have it, a Day>Night system based on actual data rather than a map-based oscillation pattern. Even if you don't use it, I may use it myself for FM.
|