This content may be freely modified and/or maintained by anyone.
Status
Not open for further replies.

LJ Sonik

Developer
Sonic Team Junior
srb20026.jpg srb20027.jpg srb20029.jpg

This is a 24 hours-based timing system with progressive night and day.
It also provides random weather changes, which include rain, snow and storms. Warning, dedicated servers are NOT supported!

You have a digital clock in the bottom-right corner of the screen that can be shown/hidden by turning the clock variable on/off.

If you can't play because of the darkness, you can skip the night by using the sleep command in the console, so the time will pass faster until you use the wakeup command. You have to set allowsleep on to sleep in a netgame.
You can neither move or see while sleeping, so make sure ennemies won't reach you. The clock is still visible, so you can know when this is morning.
Note that you can also sleep during daytime, and that in netgames the time will only speed up if every player (aside from spectators or dead players) is sleeping.

Console commands:

  • "sleep": Start sleeping. In netgame it needs allowsleep on.
  • "wakeup": Stop sleeping. In netgame it needs allowsleep on.
  • "time <hours> [minutes] [seconds]" (server/admin only): Setup the time. If minutes or seconds aren't specified, they default to 0. In addition, you can just type "day", "night", "morning" or "evening" in place of hours, minutes and seconds.
  • "displaytime": Displays the current time in the console.
  • "weather <weather> [duration]": Sets the weather, regardless of the randomweather variable. weather must be one of the followings: "sun", "sunny", "rain", "snow", "storm", "thunder" or "storm no strikes". duration is optional and is the number of hours (in-game time) before the weather changes automatically. If duration is set to "infinite", the weather will never change until the map is changed or you use the command again.
  • "timehelp": Lists all commands and variables available in this script.

Console variables:

  • "lightchange" (server/admin only): Actives or desactives the brightness changing. "Auto" will active or desactive it depending on the level.
  • "clock": Shows/hides the clock HUD.
  • "timefactor" (server/admin only): How many times faster is the time compared to reality? (default is 60, which means 1 second = 1 minute IRL).
  • "nighttimefactor" (server/admin only): How many times faster the time passes while sleeping. (default is 16)
  • "allowsleep" (server/admin only): Allows players to sleep in a netgame.

  • "daylight" (server/admin only): The brightness level during the day. 255 means it'll keep the same lightning as day, 0 means it'll be fully dark. (default is 255)
  • "nightlight" (server/admin only): The brightness level during the night. 255 means it'll keep the same lightning as day, 0 means it'll be fully dark. (default is 128)
  • "daysky" (server/admin only): The sky number used during the day. 0 will keep the normal sky of the level. (default is 0)
  • "nightsky" (server/admin only): The sky number used during the night. (default is 8)
  • "morningsky" (server/admin only): The sky number used during the morning.
  • "eveningsky" (server/admin only): The sky number used during the evening.

  • "randomweather" (server/admin only): Actives or desactives the weather changing. You can also specify one of the following values to disable some types of weather:
-"Rain" will only enable rain and storms.
-"Snow" will only enable snow.
-"Thunder" will only enable thunders with no rain.
-"NoThunder" will disable thunders.
-"NoRain" will disable rain.
-"RainNoThunder" will only enable rain with no thunders.

  • "randomweatherfactor" (server/admin only): The frequency of weather changes, in percents. Lowering it will make the weather more stable, raising it will make the weather changing more often. 100% is the default frequency.

  • "energy" (server/admin only): active or desactive the energy system.
  • "maxenergy" (server/admin only): Maximum amount of energy, in minutes.
Credits:
Thanks to speed2411 for the morning and evening skies!
 

Attachments

  • Time.rar
    9.7 KB · Views: 1,652
Last edited:
This is really neat! It'd be nice to see more skies used for a smoother transition (there are a few evening skies available, and there might be a morning sky somewhere in the game) but otherwise it's a really cool visual thing.
 
But for certain levels (especially ERZ and ERCZ), there is no need for the time command, so can you please fix alot of stuff for this LUA. This LUA is pretty nice though.
 
You're right about the sky change, I wanted to do it first, but I couldn't find a correct transition sky, unless I use the one with mountain. I thought that would looks odd to see mountains appearing at twilight, then I released a first version without it.

About disabling the lightning effects, you'll have to handle that manually because the script can't detect if the level is artificially lighted. I might eventually add some commands to disable this system and make a reject table indicating the non-affected maps.
 
This is a really cool script! While playing around with it, I thought of another option that could be toggled on and off: Some kind of "tiredness" or "stamina" bar, which would decrease the longer you stayed awake, and increase while asleep. The lower the bar got, the lower your stats would be. Perhaps a boost to stats when near the top of the bar, as well? Anyhow, when the bar would deplete, you would be forced into sleep mode right on the spot. It would give more reason to sleep other than: "Oh its kinda dark", at least. Anyhow, that's just my suggestion, feel free to debunk it if you want.
 
I thought about that while making the script, but I think it would be a better choice to release a such thing as a separate script (or wad), because it would have an impact on the gameplay, while the original script is meant just to change the apparence of a regular game.

Wait a bit please, I am editing the script according to your comments.
 
Last edited:
I thought about that while making the script, but I think it would be a better choice to release a such thing as a separate script (or wad), because it would have an impact on the gameplay, while the original script is meant just to change the apparence of a regular game.

It would probably be best to include it as an optional thing, with it defaulting to off. So people who don't want to bother with it can keep it off, while people who like the idea can have it on. But hey, if you want to keep the script from modifying gameplay too much, then that's fine.
 
In fact I am going to make several modified versions of this script, all based on the current features but adding something. I started a little modification of it, where monsters are spawning during the night. It works but is still a beta for now.

---------- Post added 06-25-2014 at 12:55 AM ---------- Previous post was 06-24-2014 at 11:28 PM ----------

I modified the script a bit. Changes:
- I added a daylight variable.
- I added an exception list at the second line of the script. Every map number here won't be affected by the script unless you set enablelightchange on.
- I fixed the clock that was getting mad with ridiculously big time factor.
 
I know you wanted night to be dark, but this is getting annoying. You can't see anything 5 foot in front of you in zones like AGZ!
e515b23a08.png

Not even talking of ATZ.
52efd9f1ba.png
 
Yeah, but what if I wanted to play AGZ at nighttime, only wanting to play like a Starlight Palace? But... Nope, it's really darker. No reason to make THAT darker. I'd even showed the lua at the IRC and the guys were thinking the same. And, RVZ looks really weird when at night.
Anyway, I like the lua, but just make the nighttime a little more... visible to play, and this will be perfect.
 
nighttime.png


What Roly Poly Putt did was multiply all colors by 0.37, 0.37, 0.5 (r, g, b). Maybe rather than altering sector lights, you should create a bunch of colormaps of varying darkness and cycle through them.

I'd say just change PLAYPAL, but then that's going to alter the HUD, too.
 
Yeah, but what if I wanted to play AGZ at nighttime, only wanting to play like a Starlight Palace? But... Nope, it's really darker. No reason to make THAT darker. I'd even showed the lua at the IRC and the guys were thinking the same. And, RVZ looks really weird when at night.
Anyway, I like the lua, but just make the nighttime a little more... visible to play, and this will be perfect.

You seemed to miss the first part of my reply. You can change the night time light levels with the console command "NIGHTLIGHT". You should have no problem with the darkness at night because there is a command made SPECIFICALLY to modify that.
 
I updated the script, now it includes morning and evening skies, although I couldn't find really adapted skies...

What Roly Poly Putt did was multiply all colors by 0.37, 0.37, 0.5 (r, g, b). Maybe rather than altering sector lights, you should create a bunch of colormaps of varying darkness and cycle through them.
I'd say just change PLAYPAL, but then that's going to alter the HUD, too.
You're true, I didn't even thought of this way. Even though that will affect the HUD, I'll still try making a custom version of it using various colormaps.
Just to say it, if you are saying that because you think it can make the game laggy, keep in mind that the script won't update the sectors light levels at each tic, but only when the light level multiplier is changed. I could eventually update the brightness only for changes higher than 8, since the software mode doesn't count lower changes.

Wow man. This is really cool. Could I use this for one of my mods?
You can even modify it to adapt it to your needs without asking permission, just report that in your credits. Same for everyone else.

And, RVZ looks really weird when at night.

That's the reason why I added this level to the non-affected levels list.
 
Last edited:
Something nice I did.

Lj Sonik. Considering you don't have a 'proper' morning and afternoon sky, I took the liberty in editing your lua script with a custom texture. Tell me what you think.
 
I think "thank you !".
I won't release it as the main version for the whole reason that I want this to be a simple Lua script, but I'll propose it as an "advanced" version of it.

---------- Post added at 01:15 AM ---------- Previous post was at 12:47 AM ----------

Done ! If you need me to modify some parts of the script to fit it with your mod, feel free to ask me !
 
I think "thank you !".
I won't release it as the main version for the whole reason that I want this to be a simple Lua script, but I'll propose it as an "advanced" version of it.


Done ! If you need me to modify some parts of the script to fit it with your mod, feel free to ask me !

No problem man. That's what I'm here for. Also thanks. :P
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top