Author Topic: (UPDATING) Day/night + weather simulation.  (Read 39292 times)

This mod is designed to provide an automatic weather randomizer and day/night lighting mod. It only let's you enable it on the slate map currently, as that's the only one it's guaranteed to work on. The mod comes with a list of values that may be changed, but is already set up with an ideal set of values that look like this:

That's the afghan build, on slate, over the course of one clear day.
The length that each hour is in game may also be changed however it is by defualt set up that one minute irl is one hour in game, and thus, one day is 24 minutes irl.
I also said this randomizes weather, and it does.
Each day has a 50% chance of being overcast, as opposed to clear.
Each overcast day has a 50% chance of having precipitation. (it can not rain or snow on a clear day)
Each precipitating day may either by rain or snow, 50-50 chance either way.
There are three levels of density, "slightly", "moderate" and "heavily" each with a 33% chance.
This means that any one day has, for example, a 4.125% chance of raining heavily.

Also, a super admin, once the server is loaded and is running the slate map, must type "/startcycle" to get the lighting/weather going.
And anyone can type "/wh" to get stats on the time of day and weather in a nice, color coded, layout.
This mod has been tested extensively in my server, and if there are any suggestions for additions or complaints about bugs, don't hesitate to post them here.
I would recommend you use a build that covers the ground, as the ground turns the same color as the lighting by default, but if you're running any kind of rp, or a (t)dm then you'll be fine.

Download v1
(original)
http://www.gamefront.com/files/20066252/Server_Weather.zip
Download v1.5
---/daycheck command for admins to advance server time by one hour instantly.
---750ms added delay between swapping skys to reduce possibility of crashes
---extra line added to the /wh message, saying how many days have passed since the server has been running
---heavy precipitation toned down a bit for less lag/clutter
---onNewDay input event added
---other stuff maybe
http://www.gamefront.com/files/20068632/Server_Weather.zip
Download v1.75
---onNewDay changed name to onMidnight
---onSixAM, onNoon, onSixPM event inputs added
http://www.gamefront.com/files/20071710/Server_Weather.zip
Download v2
---Can now be run on all map types, but be warned that the terrain of a terrained map won't change with the lighting much.
---/stopcycle command added.
---Day, season, year, calander system added.
---Other things.
http://www.mediafire.com/?l8n8xeu6jrzf133

Quick modding guide gogogo...

Okay, so in the server.cs (only script file) there will be these lines by default:
Code: [Select]
setlighting(0,0,0,0,0,0,0,0,0,0,0,0,0);
setlighting(1,0.01,0.01,0.01,0.01,0.01,0.01,0,0,0,0,0,0);
setlighting(2,0.025,0.025,0.025,0.025,0.025,0.025,0,0,0,0,0,0);
setlighting(3,0.04,0.04,0.05,0.04,0.04,0.05,0,0,0,0,0,0);
setlighting(4,0.05,0.05,0.07,0.05,0.05,0.07,0.25,0.1,0,0.25,0.1,0);
setlighting(5,0.09,0.07,0.05,0.09,0.07,0.05,0.4,0.4,0.4,0.4,0.4,0.4);
setlighting(6,0.12,0.10,0.06,0.12,0.10,0.06,0.6,0.6,0.6,0.4,0.5,1);
setlighting(7,0.2,0.15,0.1,0.2,0.15,0.1,0.6,0.6,0.6,0.4,0.5,1);
setlighting(8,0.3,0.3,0.2,0.3,0.3,0.2,0.6,0.6,0.6,0.4,0.5,1);
setlighting(9,0.35,0.35,0.3,0.35,0.35,0.3,0.6,0.6,0.6,0.4,0.5,1);
setlighting(10,0.4,0.4,0.4,0.4,0.4,0.4,0.6,0.6,0.6,0.4,0.5,1);
setlighting(11,0.45,0.45,0.5,0.45,0.45,0.5,0.6,0.6,0.6,0.4,0.5,1);
setlighting(12,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.4,0.5,1);
setlighting(13,0.7,0.7,0.7,0.7,0.7,0.7,0.6,0.6,0.6,0.4,0.5,1);
setlighting(14,0.63,0.63,0.68,0.63,0.63,0.68,0.6,0.6,0.6,0.4,0.5,1);
setlighting(15,0.6,0.6,0.65,0.6,0.6,0.65,0.6,0.6,0.6,0.4,0.5,1);
setlighting(16,0.55,0.55,0.6,0.55,0.55,0.6,0.6,0.6,0.6,0.4,0.5,1);
setlighting(17,0.55,0.55,0.5,0.55,0.55,0.5,0.4,0.4,0.4,0.4,0.4,0.4);
setlighting(18,0.5,0.5,0.4,0.5,0.5,0.4,0.4,0.4,0.4,0.4,0.4,0.4);
setlighting(19,0.25,0.25,0.3,0.25,0.25,0.3,0.2,0.2,0.4,0.2,0.2,0.4);
setlighting(20,0.2,0.2,0.3,0.2,0.2,0.3,0.1,0.1,0.1,0.1,0.1,0.1);
setlighting(21,0.1,0.1,0.2,0.1,0.1,0.2,0,0,0,0,0,0);
setlighting(22,0.05,0.05,0.05,0.05,0.05,0.05,0,0,0,0,0,0);
setlighting(23,0.01,0.01,0.01,0.01,0.01,0.01,0,0,0,0,0,0);
These set the default lighting values for each hour.
The function may be called at any time and contains 13 values.
The first is the hour, as you may see, the default has the functions lined up with the first value going from 0 to 23, as they should be.
The next three colors are the ambient/diffuse lighting.
The next three are the fog colors, this changes the color of the ground, and by default, is the same as the lighting.
The next three are the sky on an overcast day.
The next three are the sky on a clear day.

The amount of time between ingame hours, the amount of precipitation for "slight", "moderate", and "heavy" can be changed, and the chances of everything can also be changed fairly easily.

Updates that will be added by tomorrow!
>Compatibility with most maps, not just slate.
>A calendar system, simple month/year structure, with the time of year added in the /wh command.
>onMidnight onNoon onSnow and onRain event triggers.
>New day command for super admins.
>daycheck() function made into a command
« Last Edit: March 23, 2011, 04:01:20 PM by DrenDran »

Awesome. I always wanted to make this someday, was always too lazy and/or just didn't know how to :P

Yes!
RP's are now more authentic!

Awesome. I always wanted to make this someday, was always too lazy and/or just didn't know how to :P
Too bad this only works on slate atm, means you can't use in your server most of the time.
But I'll change the mod to work with other popular maps soon.
Yes!
RP's are now more authentic!

:D

(i should also add i now dislike the camera angle in the example picture, it shows too much ground and not enough sky)

Wasn't this from the City RP Mod?

Wasn't this from the City RP Mod?
Nope, made a better version from scratch.


Badspot

  • Administrator
Didn't you loving email me saying that this causes random crashes and now you're releasing it anyway?

Didn't you loving email me saying that this causes random crashes and now you're releasing it anyway?
I've never emailed you before.

Didn't you loving email me saying that this causes random crashes and now you're releasing it anyway?
I've never emailed you before.
Wow. I don't understand now.

Wow. I don't understand now.
In fact, why would I email badspot if my own mod was causing me to crash.
If it was, I'd just fix it.

So what Badspot is saying doesn't really make too much sense.

The sky is too bright in the morning and it should have a lighter blue. Around 10 am it still seems to be quite dark.

The sky is too bright in the morning and it should have a lighter blue. Around 10 am it still seems to be quite dark.

Is this from you trying it ingame?
Either way:
The mod comes with a list of values that may be changed

Is this from you trying it ingame?
Either way:
Yes, and I know. Well, I guess I'll just change the colors for me then...

Yes, and I know. Well, I guess I'll just change the colors for me then...

I have to admit the way to change the values in the script isn't exactly self explanatory.
I'll add a little guide to the OP now.