Jump to content
Sign in to follow this  
Ludovico Technique

Quick question regarding time/weather

Recommended Posts

Sorry to ask this as I'm sure it's come up before, but searching the forum just seems to yield too huge a pile of results to find exactly what I need since I don't know the exact specific terms I need.

Anyway, since problem, I want to crack open the Warface missions and add the ability to select the mission start time and weather to the mission set up screen.

What I need to know is:

How do I do this? I have at best a monkey brain. Monkey see, monkey do is about as far as I get sadly so I need the thickie version of how to do it if at all possible.

Is this possibly going to cause issues with existing parts of the mission files or can I just bolt any required code into existing files? There are already a lot of files in the unpacked mission y'see.

Can I change the date and thus the phase of the moon, or is the level of light at night best changed by simply making the sky more overcast?

Many thanks in advance for any help. If this works then there shall be cookies. :D

Share this post


Link to post
Share on other sites

You can do this.

But you need a script (a few lines written into a file like init.sqf).

You can't just use the 3 scripting commands setRain, setFog and setOvercast (see http://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA for a list of all scripting commands) to set the time at start like this :

init.sqf file

WEATHER_CONDITIONS = [[1, 1, 1], [0, 0, 0]];
WEATHER_CONDITION = WEATHER_CONDITIONS select PARAM1;
// Param1 being the value selected in the set up list of the game
// Each text description you see in the game set up list corresponds to a value, the values association is done in a file you have to name description.ext
/*
-----------
Weather :
-----------
|Bad Weather
|Nice Weather
|------------


description.ext file :

titleParam1 = "Weather :";
valuesParam1[] = {0, 1};
defValueParam1 = 0;
textsParam1[] = {"Bad Weather", "Nice Weather"};


*/
0 setOvercast (WEATHER_CONDITION select 0);
0 setFog (WEATHER_CONDITION select 1);
0 setRain (WEATHER_CONDITION select 2);

If you do this the weather will be different on each computer because the setRain/Overcast/Fog commands will make the weather local to each computer and not the same as on the server.

The other problem is that the 2 game parameters lists in the set up screen are already filled with other values. So you could change that but you could break the game if the PARAM1 variable is used directly in the rest of the files.

If you content yourself with random weather then this becomes much more simple :

Just add these lines in the init.sqf file :

if (isServer) then
{
   RAIN = random 1;
   publicVariable "RAIN";
   OVERCAST = random 1;
   publicVariable "OVERCAST";
   FOG = random 1;
   publicVariable "FOG";
};

[] spawn
{
   waitUntil {! isNil "RAIN"};
   waitUntil {! isNil "OVERCAST"};
   waitUntil {! isNil "FOG"};
   while {true} do
   {
       sleep 0.5;

       0 setOvercast RAIN;
       0 setFog OVERCAST;
       0 setRain FOG;
   };
};

This script will maintain the same random weather that is chosen by the server when game starts.

Btw setOvercast sets a cloudy sky with thunderbolts (1) or a clear sky (0).

If you want to rain you need to use setRain with a value above 0 and setOvercast with a value above 0.6.

Edited by d3nn16

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  

×