Jump to content

Recommended Posts

Day & Weather Script



by Moerderhoschi

Two weeks ago i wrote a script that force the same Daytime and weather at all clients ( also JIP).

Very useful could be this script at snipermissions where at all clients should be the same wind. (strength and direction). few wind gust are still there but in my opinion it's more realistic and the mainwinddirection and strength are permanent the same.

maybe one or the other find this script useful.

Feedback is desirable.

UPDATE VERISION 1.2 - 01.12.2012

  • optimized script
  • added two templates
  • no need anymore to set a specific date.

DOWNLOAD: Day&WeahterScript v1.2

Init.sqf

////////////////////////////
// START DAY&WEATHER SCRIPT
////////////////////////////
execVM "Day&WheaterScript\DW_init.sqf";

DW_init.sqf

/*===============================================================================================
Day&Weather Script - by Moerderhoschi
Armed-Assault.de
Version: 1.2
Date: 30.11.2012
===============================================================================================*/

//////////////////////////////////////////////////
// DEFINE VARIABLES
//////////////////////////////////////////////////
_p1 = 1;
_p2 = 1;

if (isMultiplayer) then
{
_p1 = paramsArray select 0;
_p2 = paramsArray select 1;
};

//////////////////////////////////////////////////
// GLOBAL WIND SETTINGS
//////////////////////////////////////////////////
if (isServer) then
{
if (isNil "MdhDwWx") then
{
	MdhDwWx = (switch (_p2) do
	{
		case 1: {(-10+(random 20))};
		case 2: {((-0.5)+(random 1))};
		case 3: {(-1+(random 2))};
		case 4: {(-2.5+(random 5))};
		case 5: {(-5+(random 10))};
		case 6: {(-10+(random 20))};
	});

	publicvariable "MdhDwWx";
};

if (isNil "MdhDwWy") then
{
	MdhDwWy = (switch (_p2) do
	{
		case 1: {(-10+(random 20))};
		case 2: {((-0.5)+(random 1))};
		case 3: {(-1+(random 2))};
		case 4: {(-2.5+(random 5))};
		case 5: {(-5+(random 10))};
		case 6: {(-10+(random 20))};
	});

	publicvariable "MdhDwWy";
};

//////////////////////////////////////////////////
// SERVER DAYTIME SETTINGS
//////////////////////////////////////////////////
switch (_p1) do
{
	case 1: {skiptime (ceil random 96)};
	case 2: {setDate [2020, 7, 25, 4, 0]};
	case 3: {setDate [2020, 7, 25, 5, 0]};
	case 4: {setDate [2020, 7, 25, 12, 0]};
	case 5: {setDate [2020, 7, 25, 20, 0]};
	case 6: {setDate [2020, 7, 25, 1, 0]};
	case 7: {setDate [2020, 7, 20, 1, 0]};
};

//////////////////////////////////////////////////
// SERVER WEATHER AND RAIN SETTINGS
//////////////////////////////////////////////////
if (isNil "MdhDwAktWeather") then
{
	switch (_p2) do
	{
		case 1:	{MdhDwAktWeather = random 1};
		case 2: {MdhDwAktWeather = 0};
		case 3: {MdhDwAktWeather = 0.25};
		case 4: {MdhDwAktWeather = 0.5};
		case 5: {MdhDwAktWeather = 0.75};
		case 6: {MdhDwAktWeather = 1};	
	};

	0 setOvercast MdhDwAktWeather;
	0 setrain MdhDwAktWeather;
	publicvariable "MdhDwAktWeather";
};
};

//////////////////////////////////////////////////
// WAITUNTIL PLAYER EXISTS
//////////////////////////////////////////////////
if (!isDedicated) then
{
waitUntil {!(isNull player)};
waitUntil {player == player};
waitUntil {!isNil"MdhDwAktWeather"};
};

//////////////////////////////////////////////////
// CLIENT WEATHER SETTINGS
//////////////////////////////////////////////////
sleep 1;
0 setOvercast MdhDwAktWeather;
sleep 1;

//////////////////////////////////////////////////
// CLIENT WETAHER SETTINGS FOR LONG TIME
//////////////////////////////////////////////////
36000 setOvercast MdhDwAktWeather;

//////////////////////////////////////////////////
// PERMANENT FORCED CLIENT WIND AND RAIN SETTINGS
//////////////////////////////////////////////////
while {!isNil"MdhDwAktWeather"} do
{	
setwind [MdhDwWx,MdhDwWy,true];
3 setrain MdhDwAktWeather;
sleep 1;
};

Description.ext

//////////////////////////////////////////////////
// DAY&WEATHER SCRIPT PARAMETERS
//////////////////////////////////////////////////
class Params
{
   class DayTime
   {
	//paramsArray[0]
	title = "Time Of Day";
       values[] = {1, 2, 3, 4, 5, 6, 7};
       texts[] = {"Random", "Early Morning", "Morning", "Noon", "Sundown", "Night with Full Moon", "Dark Night"};
       default = 1;
};

class Weather
   {
	// paramsArray[1]
       title = "Weather:";
       values[] = {1, 2, 3, 4, 5, 6};
       texts[] = {"Random", "Clear", "Partly Cloudy", "Cloudy", "Overcast", "Storm"};
       default = 1;
};
};

Edited by Moerderhoschi
update v1.2

Share this post


Link to post
Share on other sites

Day & Weather Script



by Moerderhoschi

Two weeks ago i wrote a script that force the same Daytime and weather at all clients ( also JIP).

Very useful could be this script at snipermissions where at all clients should be the same wind. (strength and direction). few wind gust are still there but in my opinion it's more realistic and the mainwinddirection and strength are permanent the same.

maybe one or the other find this script useful.

Feedback is desirable.

Init.sqf

execVM "DW_init.sqf";

DW_init.sqf

/*
===============================================================================================
Day&Weather Script - by Moerderhoschi
Version: 1.1
Date: 12.02.2011

===============================================================================================
*/

//VariableToForcePermanentWeather
if (IsServer and IsNil "DW_ForceWeather") then {DW_ForceWeather=true;publicvariable "DW_ForceWeather"};

//GlobalWindSettings
if (IsServer and IsNil "DW_wx") then {DW_wx = (switch (paramsArray select 1) do {
case 2: {(-10+(random 20))};
case 0: {((-0.5)+(random 1))};
case 3: {(-1+(random 2))};
case 0.5: {(-2.5+(random 5))};
case 0.75: {(-5+(random 10))};
case 1: {(-10+(random 20))};
});publicvariable "DW_wx";};

if (IsServer and IsNil "DW_wy") then {DW_wy = (switch (paramsArray select 1) do {
case 2: {(-10+(random 20))};
case 0: {((-0.5)+(random 1))};
case 3: {(-1+(random 2))};
case 0.5: {(-2.5+(random 5))};
case 0.75: {(-5+(random 10))};
case 1: {(-10+(random 20))};
});publicvariable "DW_wy";};

//ServerDaytimeSettings
if (IsServer and paramsArray select 0 == 1) then {skiptime (random -96)};
if (IsServer and paramsArray select 0 == 2) then {setDate [2020, 7, 20, 1, 0]};
if (IsServer and (paramsArray select 0 != 1) and (paramsArray select 0 != 2)) then {skiptime (paramsArray select 0)};

//ServerWeatherSettings
if (IsServer and paramsArray select 1 == 2) then {if (IsNil "DW_aktweather") then {DW_aktweather = (random 1);publicvariable "DW_aktweather"};0 setOvercast DW_aktweather};
if (IsServer and paramsArray select 1 == 3) then {0 setOvercast (0.25)};
if (IsServer and (paramsArray select 1 != 2) and (paramsArray select 1 != 3)) then {0 setOvercast (paramsArray select 1)};

//ServerRainSettings
if (IsServer and paramsArray select 1 == 2) then {0 setrain DW_aktweather};
if (IsServer and paramsArray select 1 == 3) then {0 setrain (0.25)};
if (IsServer and (paramsArray select 1 != 2) and (paramsArray select 1 != 3)) then {0 setrain (paramsArray select 1)};

//WaitUntil Player exists
waitUntil {!(isNull player)};

//ClientWeatherSettings
if (paramsarray select 1 == 2) then {0 setOvercast DW_aktweather};
if (paramsarray select 1 == 3) then {0 setOvercast (0.25)};
if ((paramsarray select 1 != 2) and (paramsarray select 1 != 3)) then {0 setOvercast (paramsarray select 1)};

sleep 0.5;

//ClientWetaherSettingsForLongTime
if (paramsarray select 1 == 2) then {36000 setOvercast DW_aktweather};
if (paramsarray select 1 == 3) then {36000 setOvercast (0.25)};
if ((paramsarray select 1 != 2) and (paramsarray select 1 != 3)) then {36000 setOvercast (paramsarray select 1)};

//PermanentForcedClientWindAndRainSettings
while {DW_ForceWeather} do {

sleep 1;

setwind [DW_wx,DW_wy,true];

3 setrain (switch (paramsArray select 1) do {
case 2: {DW_aktweather};
case 0: {(paramsArray select 1)};
case 3: {(0.25)};
case 0.5: {(paramsArray select 1)};
case 0.75: {(paramsArray select 1)};
case 1: {(paramsArray select 1)};
});

};

Description.ext

class Params
{
       class DayTime
       {
	//paramsArray[0]
               title = "Time Of Day";
               values[] = {1, -8, -6, 0, 8, 13, 2};
               texts[] = {"Random", "Early Morning", "Morning", "Noon", "Sundown", "Night with Full Moon", "Dark Night"};
               default = 1;
	};
	class Weather
       {
	// paramsArray[1]
               title = "Weather:";
               values[] = {2, 0, 3, 0.5, 0.75, 1};
               texts[] = {"Random", "Clear", "Partly Cloudy", "Cloudy", "Overcast", "Storm"};
               default = 2;
       };
};

Tested on dedicated and it seems as tho Day/night is not working in OA

It does the same weather each time but if I change settings it doesnt do what I say, it does however syn with JIP

REDIT

Tested on another mission and it seems to be woking, must be conflictin with my other mission scripts

Edited by Daimyo21

Share this post


Link to post
Share on other sites

I have discovered that for the times to be accurate the mission time in the editor must be set to 12:00 (Noon). What is the date that we need to start in order to have the Night with full moon? I see the date is set for the Dark night setting in the script but not for the Full moon, so I assume the full moon date must be set in the editor like the 12:00 noon starting time. I guess I could test a few dates till I found a full moon date? Thanks for the JIP compatible time and weather. Much appreciated....DOA

Share this post


Link to post
Share on other sites

Hey guys, thanks for your feedback and pardon that i didnt answer until now. I had forgot to tell that i always set the date in the editor to 12:00 - 25 July.

Set the date and it should work correct.

regards

Moerderhoschi

Edited by Moerderhoschi

Share this post


Link to post
Share on other sites

did I miss something? does arma have a bug which gives different players different daytimes and weather??

Edited by Bulldog Six

Share this post


Link to post
Share on other sites

Hi Moerderhoschi

I saw your script in W0lle's Motorcade mission and really liked it. I would like to add it to a mission that I'm now working on but I have a question. I need only random weather because it's a stealth mission taking place at night. In this case I will have to modify the description.ext only. Is that right? I just simply modify the values and texts in paramsArray[0]? Thank you for the great scrip.

Share this post


Link to post
Share on other sites

It's a bit more complicated actually, I made myself a 'weather only' copy of that script:

/*
===============================================================================================
Day&Weather Script - by Moerderhoschi
Version: 1.1
Date: 12.02.2011

===============================================================================================
*/
//VariableToForcePermanentWeather
if (isServer and isNil "DW_ForceWeather") then {DW_ForceWeather=true; publicVariable "DW_ForceWeather"};

//GlobalWindSettings
if (isServer and isNil "DW_wx") then {DW_wx = (switch (paramsArray select 0) do
{
 case 2: {(-10+(random 20))};
 case 0: {((-0.5)+(random 1))};
 case 3: {(-1+(random 2))};
 case 0.5: {(-2.5+(random 5))};
 case 0.75: {(-5+(random 10))};
 case 1: {(-10+(random 20))};
});publicVariable "DW_wx";};

if (isServer and isNil "DW_wy") then {DW_wy = (switch (paramsArray select 0) do
{
 case 2: {(-10+(random 20))};
 case 0: {((-0.5)+(random 1))};
 case 3: {(-1+(random 2))};
 case 0.5: {(-2.5+(random 5))};
 case 0.75: {(-5+(random 10))};
 case 1: {(-10+(random 20))};
});publicVariable "DW_wy";};

//ServerWeatherSettings
if (isServer and paramsArray select 0 == 2) then {if (isNil "DW_aktweather") then {DW_aktweather = (random 1); publicVariable "DW_aktweather"}; 0 setOvercast DW_aktweather};
if (isServer and paramsArray select 0 == 3) then {0 setOvercast (0.25)};
if (isServer and (paramsArray select 0 != 2) and (paramsArray select 0 != 3)) then {0 setOvercast (paramsArray select 0)};

//ServerRainSettings
if (isServer and paramsArray select 0 == 2) then {0 setRain DW_aktweather};
if (isServer and paramsArray select 0 == 3) then {0 setRain (0.25)};
if (isServer and (paramsArray select 0 != 2) and (paramsArray select 0 != 3)) then {0 setRain (paramsArray select 0)};

//WaitUntil Player exists
waitUntil {!(isNull player)};

//ClientWeatherSettings
if (paramsarray select 0 == 2) then {0 setOvercast DW_aktweather};
if (paramsarray select 0 == 3) then {0 setOvercast (0.25)};
if ((paramsarray select 0 != 2) and (paramsarray select 0 != 3)) then {0 setOvercast (paramsarray select 0)};

sleep 0.5;

//ClientWetaherSettingsForLongTime
if (paramsarray select 0 == 2) then {36000 setOvercast DW_aktweather};
if (paramsarray select 0 == 3) then {36000 setOvercast (0.25)};
if ((paramsarray select 0 != 2) and (paramsarray select 0 != 3)) then {36000 setOvercast (paramsarray select 0)};

//PermanentForcedClientWindAndRainSettings
while {DW_ForceWeather} do
{
 sleep 1;
 setwind [DW_wx,DW_wy,true];
 3 setRain (switch (paramsArray select 0) do
 {
   case 2: {DW_aktweather};
   case 0: {(paramsArray select 0)};
   case 3: {(0.25)};
   case 0.5: {(paramsArray select 0)};
   case 0.75: {(paramsArray select 0)};
   case 1: {(paramsArray select 0)};
 });
};

And the description.ext snippet for it:

// Day and Weather script by Moerderhoschi
class Params
{
 class Weather
 {
   title = "Weather:";
   values[] = {2, 0, 3, 0.5, 0.75, 1};
   texts[] = {"Random", "Clear", "Partly Cloudy", "Cloudy", "Overcast", "Storm"};
   default = 2;
 };
};

And btw, good job on that script Moerderhoschi. In MP Missions I only use that one now. :)

Share this post


Link to post
Share on other sites

Thank you guys for your feedback on my script.

@b1944

Take the light version who W0lle has made, its exactly that what you want.

@W0lle

Nice to hear that my script is useful for you and thanks for posting your light version of it for b1944 :)

regards

moerderhoschi

Share this post


Link to post
Share on other sites

Thank you both, it is good to know that there are people who are willing to help and help quickly. :)

Share this post


Link to post
Share on other sites
Hey guys, thanks for your feedback and pardon that i didnt answer until now. I had forgot to tell that i always set the date in the editor to 12:00 - 25 July.

Set the date and it should work correct.

regards

Moerderhoschi

I have put W0lle's "light" version into my mission and it seems to work. However I'm a bit unsure about this 12:00 July 25 time and date. Is it necessary to make the script work?

In my case it's a night mission so 12:00 is not the best choice. :D

Share this post


Link to post
Share on other sites

Does anyone know how to get this script working with domination? I think the script conflicts with the weather/time system already in the game. Does anyone know how to fix this?

Thanks!

Share this post


Link to post
Share on other sites

Very useful could be this script at snipermissions where at all clients should be the same wind. (strength and direction).

Cool script, thanks for sharing!

I see that the wind gets synced each second and wonder if/how it may affect perfomance/lag for people with less bandwidth, anyone having any experience with this script in smaller scale MP missions?

/KC

Share this post


Link to post
Share on other sites

Now if only Q1184's old ArmA addon was updated for A2:OA sniping would be even more fun ;)

http://forums.bistudio.com/showthread.php?t=64489

PS: I know the mighty ACE addon adds wind to the equation but I'm currently not using it.

/KC

Edited by KeyCat

Share this post


Link to post
Share on other sites

Day & Weather Script



by Moerderhoschi

Two weeks ago i wrote a script that force the same Daytime and weather at all clients ( also JIP).

Very useful could be this script at snipermissions where at all clients should be the same wind. (strength and direction). few wind gust are still there but in my opinion it's more realistic and the mainwinddirection and strength are permanent the same.

maybe one or the other find this script useful.

Feedback is desirable.

addendum:

You have to set the date in the editor to 12:00 - 25 July !

Init.sqf

execVM "DW_init.sqf";

DW_init.sqf

/*
===============================================================================================
Day&Weather Script - by Moerderhoschi
Version: 1.1
Date: 12.02.2011

===============================================================================================
*/

//VariableToForcePermanentWeather
if (IsServer and IsNil "DW_ForceWeather") then {DW_ForceWeather=true;publicvariable "DW_ForceWeather"};

//GlobalWindSettings
if (IsServer and IsNil "DW_wx") then {DW_wx = (switch (paramsArray select 1) do {
case 2: {(-10+(random 20))};
case 0: {((-0.5)+(random 1))};
case 3: {(-1+(random 2))};
case 0.5: {(-2.5+(random 5))};
case 0.75: {(-5+(random 10))};
case 1: {(-10+(random 20))};
});publicvariable "DW_wx";};

if (IsServer and IsNil "DW_wy") then {DW_wy = (switch (paramsArray select 1) do {
case 2: {(-10+(random 20))};
case 0: {((-0.5)+(random 1))};
case 3: {(-1+(random 2))};
case 0.5: {(-2.5+(random 5))};
case 0.75: {(-5+(random 10))};
case 1: {(-10+(random 20))};
});publicvariable "DW_wy";};

//ServerDaytimeSettings
if (IsServer and paramsArray select 0 == 1) then {skiptime (random -96)};
if (IsServer and paramsArray select 0 == 2) then {setDate [2020, 7, 20, 1, 0]};
if (IsServer and (paramsArray select 0 != 1) and (paramsArray select 0 != 2)) then {skiptime (paramsArray select 0)};

//ServerWeatherSettings
if (IsServer and paramsArray select 1 == 2) then {if (IsNil "DW_aktweather") then {DW_aktweather = (random 1);publicvariable "DW_aktweather"};0 setOvercast DW_aktweather};
if (IsServer and paramsArray select 1 == 3) then {0 setOvercast (0.25)};
if (IsServer and (paramsArray select 1 != 2) and (paramsArray select 1 != 3)) then {0 setOvercast (paramsArray select 1)};

//ServerRainSettings
if (IsServer and paramsArray select 1 == 2) then {0 setrain DW_aktweather};
if (IsServer and paramsArray select 1 == 3) then {0 setrain (0.25)};
if (IsServer and (paramsArray select 1 != 2) and (paramsArray select 1 != 3)) then {0 setrain (paramsArray select 1)};

//WaitUntil Player exists
waitUntil {!(isNull player)};

//ClientWeatherSettings
if (paramsarray select 1 == 2) then {0 setOvercast DW_aktweather};
if (paramsarray select 1 == 3) then {0 setOvercast (0.25)};
if ((paramsarray select 1 != 2) and (paramsarray select 1 != 3)) then {0 setOvercast (paramsarray select 1)};

sleep 0.5;

//ClientWetaherSettingsForLongTime
if (paramsarray select 1 == 2) then {36000 setOvercast DW_aktweather};
if (paramsarray select 1 == 3) then {36000 setOvercast (0.25)};
if ((paramsarray select 1 != 2) and (paramsarray select 1 != 3)) then {36000 setOvercast (paramsarray select 1)};

//PermanentForcedClientWindAndRainSettings
while {DW_ForceWeather} do {

sleep 1;

setwind [DW_wx,DW_wy,true];

3 setrain (switch (paramsArray select 1) do {
case 2: {DW_aktweather};
case 0: {(paramsArray select 1)};
case 3: {(0.25)};
case 0.5: {(paramsArray select 1)};
case 0.75: {(paramsArray select 1)};
case 1: {(paramsArray select 1)};
});

};

Description.ext

class Params
{
       class DayTime
       {
	//paramsArray[0]
               title = "Time Of Day";
               values[] = {1, -8, -6, 0, 8, 13, 2};
               texts[] = {"Random", "Early Morning", "Morning", "Noon", "Sundown", "Night with Full Moon", "Dark Night"};
               default = 1;
	};
	class Weather
       {
	// paramsArray[1]
               title = "Weather:";
               values[] = {2, 0, 3, 0.5, 0.75, 1};
               texts[] = {"Random", "Clear", "Partly Cloudy", "Cloudy", "Overcast", "Storm"};
               default = 2;
       };
};

I have tried this on my mission when i test the mission it says DW_init.sqf script not found.. can someone help me with this... thanks

---------- Post added at 20:30 ---------- Previous post was at 19:51 ----------

i got it to work but im getting a weird error any ideas how to fix it

http://img16.imageshack.us/img16/6500/image2wba.jpg (506 kB)

Share this post


Link to post
Share on other sites

hey hellstorm77

i have released a update to version 1.2 with two templates today. This should show how it works.

The other problem in your screenshot is ACE releated. Nothing to do with the script.

To get the update take a look at the Startpost.

regards

moerderhoschi

Share this post


Link to post
Share on other sites
hey hellstorm77

i have released a update to version 1.2 with two templates today. This should show how it works.

The other problem in your screenshot is ACE releated. Nothing to do with the script.

To get the update take a look at the Startpost.

regards

moerderhoschi

I think your right it was ACE releated. I got around using this script in my misson it works like a dream. Good work

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

×