Jump to content
meatball

randomWeather2 Script - Dynamic Weather For A3

Recommended Posts

Clouds will change dynamically to keep up with changes in overcast.

It's been a while, but I did a lot of testing/experimenting (there's some old threads around somewhere about it), and overcast/clouds actually act strangely. The rate at which overcast will change will vary based on your starting overcast and whether it's going up or down, there is not a linear rate of change across the entire spectrum. So for example, going from 0 to 1 will increase at a much faster rate than going from 0.8 to 1.

I'll be honest though, I haven't monkeyed around much with this script in a while, and I know there's some new weather related functionality built into the game. Reason why I haven't messed with the script lately is that it works :) If it ain't broke, don't fix it.

Share this post


Link to post
Share on other sites

At least until BI break something for you anyway, thats what brought me back to my mission after months of not touching it ;)

Share this post


Link to post
Share on other sites

:(

Only the sky darkens for one and a half hours (and only then the clouds appear) as I tested your script going up 0.1 overcast. So basicallay there is no way to get a cloud appear in less than 90 minutes...

Edited by zapat

Share this post


Link to post
Share on other sites

The script is built to allow you to set the original weather. Try partly/mostly cloudy as starting weather. Starting perfectly clear will take a while for you to start seeing clouds.

Share this post


Link to post
Share on other sites

It doesnT matter I am afraid. It does take at least 90 mins to switch a cloud type/density...

So it is the same to go from 0.6 to 0.7 as well. Clouds don't get denser until 90 mins, only the background colour darkens

Share this post


Link to post
Share on other sites

Pretty sure that's a limitation of the cloud/simul engine they're using.

Share this post


Link to post
Share on other sites
So for example, going from 0 to 1 will increase at a much faster rate than going from 0.8 to 1.

I've also observed this. And I have observed that at first the changes are slow, but at the end of a 20 minutes cycle changes speed up...

Another rather terrible observation: I use presets. Low and high overcast level presets are good. But initial "cloudy" presets (at an overcast level around 0.5) can hardly be done and look awkward. You often get clear sky on top of player with dark clouds at the horizon. Weather still is... an adventure.

Edited by tortuosit

Share this post


Link to post
Share on other sites

I digged deeper into this and here is my finding, if you want to incorporate it:

Cloud changes happen only on hour:30 and hour:00 but they need at least around an hour. (?)

So if you initiate a cloud change (SimulClouds) at 11:59 it will happen at 13:00. If you initiate it at 12:01 it will happen at 13:30.

Darkening (Arma clouds) happens unsynced, until they reach each other at these times, or they are synced with the lagging simulWeatherSync

Share this post


Link to post
Share on other sites

Yes, I have read that a few times. Ingame time? Also, I wish it was possible to start that timer by script (I mean the :30 and :00 is too monolithic). I wish forceWeatherchange would do that.

It's because I am interested in SP scripting only. There it's no problem to do full start at script init time, not when BIS thinks weather should change ;)

Share this post


Link to post
Share on other sites

Does this script still work? For some reason it seems as if it doesn't get called, I can't set my starting weather and I don't see any changes over time. I followed the instructions exactly

Share this post


Link to post
Share on other sites

Still working fine for me. When you say you can't set the starting weather, where are you trying to set it? Did you make the proper entry into the description.ext file?

Share this post


Link to post
Share on other sites

I'm getting some undefined variable errors.

On the server;

2014/08/08, 21:47:34 Error in expression <erUpdateArray = weatherTemplates select rw2_Current_Weather;
_weatherUpdateForec>
2014/08/08, 21:47:34   Error position: <rw2_Current_Weather;
_weatherUpdateForec>
2014/08/08, 21:47:34   Error Undefined variable in expression: rw2_current_weather
2014/08/08, 21:47:34 File mpmissions\__cur_mp.Altis\randomweather2.sqf, line 141

and on the client

Error in expression <rCurrentArray = weatherTemplates select rw2_Current_Weather;
weatherCurrentName >
 Error position: <rw2_Current_Weather;
weatherCurrentName >
 Error Undefined variable in expression: rw2_current_weather
File mpmissions\__CUR_MP.Altis\randomweather2.sqf, line 99

I've done all as per your instructions. The only thing I changed was I changed the randomweather2.sqf filename to all lower case, but that wouldn't cause this error?

Edit: I've partially tracked the problem. It's to do with the way the script gets data from the desc parameters.

Edited by Tankbuster

Share this post


Link to post
Share on other sites

Hi,

Thanks you for your script.

I've a question for MPMission, in mb_fnc_UpdateWeather function, you change values (overcast, rain...) but you don't synchronise these. Why you don't use simulWeatherSync ?

Share this post


Link to post
Share on other sites

Hey guys, haven't really been keeping up with anything new with the script to be honest.

@Tank - My guess is that something is off with the rw2Param variable (on Line 51). The whole paramsArray setup confuses a lot of folks. Basically you need to make sure that the number for that parameter is equal to which parameter you setup in your description.ext file for the weather script. But remember since all these params are stored in an array, the first class/parameter you have in your description.ext is actually '0', the second would be '1', etc. For more details, check out the A3 Mission Params wiki.

@Procles - In my testing I found that simulWeatherSync didn't need to be used during weather updates. All it does is sync the cloud levels to match with the weather (overcast) settings on the local client. While you can immediately adjust the cloud levels at between two values at mission start, once a mission is running the Arma engine takes a _long_ time to adjust cloud levels from one value to another and they will slowly transition from one to another at a set rate based off the overcast levels no matter what you try to do. So there was no benefit of using the simul command for updates after the initial setup.

Remember that there is no true way to 'synchronize' weather exactly across all clients. The way around that is to give all the clients the same starting values and then tell them to and move to another set of values over a set amount of time. Since the individual clients all have the same weather engine running, they will have nearly identical weather, but it will never be exact. You may see rain start a few seconds before another client does, but it'll be close enough that it shouldn't be noticeable.

Hopefully, someday, BI will figure out true weather synch across clients that and all these weather scripts can go away. :)

Edited by Meatball

Share this post


Link to post
Share on other sites

@Tank - My guess is that something is off with the rw2Param variable (on Line 51). The whole paramsArray setup confuses a lot of folks. Basically you need to make sure that the number for that parameter is equal to which parameter you setup in your description.ext file for the weather script. But remember since all these params are stored in an array, the first class/parameter you have in your description.ext is actually '0', the second would be '1', etc. For more details, check out the A3 Mission Params wiki.

Yeah, I've never done the parameter serial number thing, as far as I know it's optional. As my mission has dozens of parameters, I fixed up the script so that the param serial number stuff isn't required. I did this some time ago and should have posted back saying I'm good now. :)

Overall, this works brilliantly. It's another thing that takes Arma up a level. I've been telling my players for months "We're on an island in the Aegean! It's always sunny!" Only for the busted default weather system to slap a pea souper on us. (If you're not a Brit, that will make no sense at all!) So, they like this. Weather, especially the fog, brings a whole new series of tactical decisions, especially for the pilots. I think though, that you may have been a little conservative with the fog. So, with that in mind, I have 2 requests, both fog related.

Can we have a extra fog setting, one where the fog is thick enough to make the fliers just a bit nervous? Not completely ground them, just hamper them a little. Also, the thick fog, and perhaps my extra fog, could you make it so they only appear in the morning? Between 0500 and 0900. Tortousit does that on his and it's funky.

Share this post


Link to post
Share on other sites

Awesome, glad you like it and sorry I didn't get back to you sooner. I'll see about the morning fog deal, but you can easily tweak the fog settings yourself by just changing the numbers for the fog settings. You can either tweak all the 'fog' variables in the weather templates a bit, or just add another one in. To just tweak the current ones, try something like this for your weatherTemplates.

weatherTemplates = [
       ["Clear",[0,1,5],[0.30,0,0,1,1]],
       ["Overcast",[0,1,2],[0.50,0,0,2,2]],
       ["Light Rain",[1,2,3,5],[0.60,0.3,0.05,3,3]],
       ["Medium Rain",[2,3,4],[0.70,0.5,0.05,4,4]],
       ["Rainstorm",[3],[0.80,0.9,0.1,5,5]],
       ["Light Fog",[0,2,5,6],[0.4,0,[0.3,0.01,10],0,0]],
       ["Medium Fog",[5,6,7],[0.4,0,[0.5,0.005,20],0,0]],
       ["Dense Fog",[6],[0.5,0,[0.7,0.0025,30],0,0]]
];

Or you can just add a new fog option by replacing the Dense Fog template with this.

["Dense Fog",[6],[0.5,0,[0.4,0.0025,30],0,0]],
["British Fog",[6],[0.6,0,[0.8,0.0012,40],0,0]]

If you do that, you'll also need to tweak the 'Case 3' line in the if(isServer) block from:

case 3: {rw2_Current_Weather = 5 + (floor (random 3));};  				 	// Fog

to:

case 3: {rw2_Current_Weather = 5 + (floor (random 4));};  				 	// Fog

Let me know how it works. And if you like the weather, I think they work really well in my Mission pack (Shameless Self Promotion :))

Share this post


Link to post
Share on other sites

Cool... the morning fog idea is a great one as being a med island you would expect a little around dawn and then as the sun gets higher it would burn it off.... +1 on that idea :)

Share this post


Link to post
Share on other sites

["British Fog",[6],[0.6,0,[0.8,0.0012,40],0,0]]

LOL!!

Share this post


Link to post
Share on other sites

Is it possible to have snow and fog during the complete mission? From the start until the end.

While building the mission (starting/editing) i sometimes get snow and rain at the same time...is that normal?

Edited by Syncie

Share this post


Link to post
Share on other sites

Not sure where you're getting snow from, as it's not in the game yet that I know of. Unless you're using the old script I wrote, which I wouldn't, the snow particle effect can cause crashes.

With this script, there's not really a way to keep the weather the same from start to finish, as it's built to dynamically change every so often. If you want static weather, I'd just get rid of the script altogether and use the basic weather controls in the mission builder UI. You can set start/end weather, just make it the same.

Share this post


Link to post
Share on other sites

Can the parameters be accessed while in game?

class Params
{
       // paramsArray[0]
      class initialWeatherParam {
         title = "Starting Weather";
         values[] = {0,1,2,3,4};
         texts[] = {"Clear","Overcast","Rain","Fog","Random"};
         default = 4;
      };
};

If not, do you know of a way to change weather conditions while in game for a dedicated server?

Share this post


Link to post
Share on other sites
If not, do you know of a way to change weather conditions while in game for a dedicated server?

You need to set / execute all of the weather commands on the clients aswell since any commands related to weather are local.

Edited by Iceman77

Share this post


Link to post
Share on other sites

I'll admit it's been a long time since I've messed with any weather scripting, but there's no way to control the script while in game other than setting the original values before mission start with the parameters. You could leave the Debug Console available in the mission for admins and then manually run weather related script commands, but to my knowledge, on a Dedicated server many of the commands will only change the weather on the server and not make changes to connected clients. Until BI comes up with true Weather synch between server/clients I don't think there's any way around that.

Share this post


Link to post
Share on other sites

@csk222 - I realize you're having trouble in your other thread syncing the weather on dedicated. As you can see he stores / sets the weather in a function and calls the function for both server and clients.

// Setup Initial Weather Function
mb_fnc_InitialWeather = {
// . . . //

	skipTime -24;
       86400 setOvercast _weatherInitialOvercast;
       0 setRain _weatherInitialRainSnow;
       86400 setFog _weatherInitialFog;
       setWind [_weatherInitialWindEW,_weatherInitialWindNS,true];
	skipTime 24;
	sleep 1;
    simulWeatherSync;

// . . . //
};

ie;

// Run Initial Weather Function for all.
[] spawn mb_fnc_InitialWeather;

Edited by Iceman77

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×