Jump to content
Sign in to follow this  

Recommended Posts

Several times now ive been playing and the weather has advanced to rain or storm etc...

People have connected and reported perfectly fine normal sunny weather.

How do I update the weather for people connecting?

Note: Please delete the post in the addons section, was an errror.

Share this post


Link to post
Share on other sites

commands that change weather (setOvercast, setRain) works only local

so you need somehow public weather change, for example this way:

init.sqf

globalWeather = [1.0, 0.0];
"globalWeather" addPublicVariableEventHandler 
{  
60 setOvercast (globalWeather select 0); 
60 setRain (globalWeather select 1);
};

some weather changing script (on server):

_changingFrequency = 10; // in minutes
while {true} do
{
 sleep (60*_changingFrequency);
 globalWeather = [random 1.0, random 1.0];
 publicVariable "globalWeather";
};

Share this post


Link to post
Share on other sites
commands that change weather (setOvercast, setRain) works only local

so you need somehow public weather change, for example this way:

init.sqf

globalWeather = [1.0, 0.0];
"globalWeather" addPublicVariableEventHandler 
{  
60 setOvercast (globalWeather select 0); 
60 setRain (globalWeather select 1);
};

some weather changing script (on server):

_changingFrequency = 10; // in minutes
while {true} do
{
 sleep (60*_changingFrequency);
 globalWeather = [random 1.0, random 1.0];
 publicVariable "globalWeather";
};

So the one you put into init is the start of the weather?

The other one not sure where I put it but that is what the weather will change to?

Btw is time of day local only?

Share this post


Link to post
Share on other sites

second script you can call for example from init.sqf:

globalWeather = [1.0, 0.0];
"globalWeather" addPublicVariableEventHandler 
{  
60 setOvercast (globalWeather select 0); 
60 setRain (globalWeather select 1);
};

if (isServer) then 
{
 execVM "changing_weather.sqf"
};

changing_weather.sqf:

_changingFrequency = 10; // in minutes
while {true} do
{
 sleep (60*_changingFrequency);
 globalWeather = [random 1.0, random 1.0];
 publicVariable "globalWeather";
 60 setOvercast (globalWeather select 0); 
 60 setRain (globalWeather select 1);
};

day time is local if you use skipTime command. If you don't use it then everything should be synchronized, even if JIP!

Share this post


Link to post
Share on other sites

Thanks for that info.

If i were to just place:

0 setOvercast 5;

Into the init.sqf would that set everyone to the same overcast level on connect?

Share this post


Link to post
Share on other sites
Thanks for that info.

If i were to just place:

0 setOvercast 5;

Into the init.sqf would that set everyone to the same overcast level on connect?

If you do that everyone will have the same weather at mission start but if the weather changes and new people conect the new clients (JIP) will not receive the updated weather..

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
Sign in to follow this  

×