Jump to content
 EO

Weather Forecast and Time of Changes slider.

Recommended Posts

My question is regarding the Weather Forecast setting and more specifically the Time of Changes slider....

When maxed out it reaches 8 hours, can this value be increased, or is it limited to 8 hours?

My goal is to have the fog forecast (as shown in the picture below) "locked" for the duration of an open world mission that could potentially last many hours before all objectives are complete. 

Spoiler

6NsUYZT.png

 

Share this post


Link to post
Share on other sites
14 minutes ago, EO said:

My goal is to have the fog forecast (as shown in the picture below) "locked" for the duration

 

Can't you use setFog

Share this post


Link to post
Share on other sites

Maybe I should have provided more context...

I'm already using the setFog command in specified areas of the map activated by triggers, so ideally I want the overriding fog forecast to stay the same both before and after the player leaves these triggered zones, hence my original question.  

Share this post


Link to post
Share on other sites

I think managing fog in a script is the way to go considering you want to have both a long term fog forecast and an option to dynamically override it.

A minimal example (server-side):

initialFogIntensity = 0.1;
finalFogIntensity = 0.7;
finalFogTime = 24 * 3600;  // 24 hours
overrideFogIntensity = nil;  // you can set this in trigger to temporarily overwrite fog intensity, set to nil to use the long-term forecast again

0 setFog initialFogIntensity;

[] spawn {
	while {true} do {
		private _fogIntensity = linearConversion [0, finalFogTime, time, initialFogIntensity, finalFogIntensity, true];

		if (!isNil "overrideFogIntensity") then {
			_fogIntensity = overrideFogIntensity;
		};

		60 setFog _fogIntensity;

		sleep 60;
	};
};

This example assumes you don't change time multiplier or skipTime. If that's the case, you can use a combination of dateToNumber and missionStart instead of plain time to calculate _fogIntensity.

It also assumes you only need to change fog intensity. If you want to control [fogValue, fogDecay, fogBase], then you can use linearConversion three times (once for each value in the array).

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
10 hours ago, EO said:

Maybe I should have provided more context...

I'm already using the setFog command in specified areas of the map activated by triggers, so ideally I want the overriding fog forecast to stay the same both before and after the player leaves these triggered zones, hence my original question.  

 

I can't remember why exactly, but setFog would tend to cause transition issues in my scenarios; I've been using a small script to constantly adjust fog from its current value to avoid that.

Here's a modified version that should work as an example :

//fog.sqf
mystforecast = 0.1;
handle_forecast = 0 spawn {
	while {true} do {
		default_forecast = (rain*0.75) max (overcast*0.175);
		mystforecast = call {
			if (isNil "override_forecast") then {
				default_forecast
			}else{
				missionNamespace getVariable "override_forecast"
			}
		};
		sleep 5;
	};
};
handle_fog = 0 spawn {
	while {true} do {
		_slp = 0.05 + random 0.1;
		_fog = fog + (0.001 * ([-1, 1] select (fog <= mystforecast)));
		0 setfog [_fog max 0 min 1, 0.0075, (getPosASL cameraOn)#2];
		sleep _slp;
	};
};

//override from trigger
override_forecast = 1;

//cancel override
override_forecast = nil;

Not actually tested, but if you replace your setFog commands in your triggers by the last bits above, it should do the trick. Note that fog is dynamic with this example, and depends on rain and overcast; you can just change the 'default_forecast' variable with a fixed or random value. 😉 

Same for the '_slp' variable in 'handle_fog' if you want faster or slower transitions.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

@_foley @haleks

Thanks guys, both those examples look super helpful, I'll endeavour to try them out and report back. :rthumb:

  • Like 1

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

×