Any Day\Night libraries or Functions out there?

Does anyone know of a Day to night lua function or library? I need this for a gamemode I am creating and do not want to make myself as my lua isn’t that great.
Is it even possible? If anyone can point me in the right direction I would be very glad
Thanks in Advance

This can be done in Lua but it’s quite cheap and doesn’t look very good, the best way to do it is via the map itself, but unless you want to use a custom map that isn’t possible.

If you really want to use Lua for it, I’d suggest searching for weather addons, most of them have a day/night system in them and you can just ignore the weather bit.


It can really depend, but it won’t look as good as it being legit.

Custom maps need ent_sun and dynamic lighting.

It’s not possible using day/night in source without lossing on quality alot, compiling times will go much higher, since the suns lightning needs to be rendered twice (or more, maybe), it also removes light bouncing, which affects visual quality quite alot.
An idea would be to have both a day and a night version of your map, then if you use RP for example, you could have some way to duplicate all stuff, switch map when you want, and place them again.

I didn’t know that :o
Although, I would still prefer having night and day over just pure day.
It gets boring :\

Why not change the skybox for a cheap effect? Not sure, but can’t you create a dynamic light?

Don’t create a dynamic light. Won’t work on Garry’s Mod without having to recompile the source code for the game to allow big projected textures. That’s how sourcemods do it, at least.

You can technically do it, but it lags the shit out of you because of the limitation of the projectedtextures.

At least this is what happened to me.


Day/Night can be roughly done IF the map you are playing on uses a NAMED env_lightenviornment (or whatever that one entity is)

You can fire actions to it to set it’s brightness from literally “a” to “z”, with 24 light levels in between.
I’m pretty sure the Source SDK website can help you out with finding the right keyvalue.