Jump to content
Logitrust

Class Params for MP. (class TimeOfDay) etc...

Recommended Posts

Hi guys! Now i have been searching this and other simular forums for the 3 last days, and have ended up with no positiv progress. My problem is(i hope) simple to solve :rolleyes:

Status:

Copy from my Description.ext:

class Params {

class TimeOfDay {

title = "Time of day:";

values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};

default = 12;

texts[] = {"00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"};

};

}

All seems fine when hosting in Multiplayer setup. Can allsow se the Time of day in paramters. But the time would not change when game is done loading.

:confused:

thanks for replies in advance folks!

Alex

Share this post


Link to post
Share on other sites

description.ext

class Params
{
 class TimeOfDay {
   title = "Time of Day";
   values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
   texts[] = {"0000","0100","0200","0300","0400","0500","0600","0700","0800","0900","1000","1100","1200","1300","1400","1500","1600","1700","1800","1900","2000","2100","2200","2300"};
   default = 16;
 };
};

init.sqf

skiptime (((paramsarray select 0) - daytime + 24) % 24);

Share this post


Link to post
Share on other sites

I thought the skiptime in init.sqf was to the old valuesParam system. Works fine now! Tnx shk.

Share this post


Link to post
Share on other sites

Ah, nice! I have sat down at the exact same problem for many hours now as well.

But how about weather parametres? Anyone who knows this? Ive got this from domination;

description.ext:

class Weather {

title = "Weather";

values[] = {1,2,3,4};

default = 2;

texts[] = {"Clear", "Stormy", "Cloudy", "Foggy"};

};

init.sqf:

Weather = (paramsarray select 2);

if ( Weather == 1) then {

0 setFog 0;

0 setOvercast 0;

0 setRain 0;

};

if ( Weather == 2) then {

0 setFog 0.2;

0 setOvercast 1.0;

0 setRain 1;

};

if ( Weather == 3) then {

0 setFog 0;

0 setOvercast 0.7;

0 setRain 0;

};

if ( Weather == 4) then {

0 setFog 0.7;

0 setOvercast 0.7;

0 setRain 0;

} else {

0 setFog 0.2;

0 setOvercast 1.0;

0 setRain 1;

};

};

But ive come no further. Anyone who knows this?

Share this post


Link to post
Share on other sites

switch (paramsarray select 0) do {
 case 1: { 0 setOvercast 0; 0 setRain 0; 0 setFog 0 };
 case 2: { 0 setOvercast 1; 0 setRain 1; 0 setFog 0.2 };
 case 3: { 0 setOvercast 0.7; 0 setRain 0; 0 setFog 0 };
 case 4: { 0 setOvercast 0.7; 0 setRain 1; 0 setFog 0.7 };
};

Obviously, you need to select the correct value from the paramsarray. I just used the first value (0) in this example.

Share this post


Link to post
Share on other sites

Can you explain a little bit more about selecting the correct value? I tried to past the code into the init.sqf file together with the classparam in the description file, but it didnt work. The time parameter works, but not the weather.

Share this post


Link to post
Share on other sites

You need to change the number of the selected parameter.

Example:

class Params
{
 class TimeOfDay {
   title = "Time of Day";
   values[] = {0,1};
   texts[] = {"0000","0100"};
   default = 1;
 };
 class Weather {
   title = "Weather";
   values[] = {1,2,3,4};
   texts[] = {"Clear", "Stormy", "Cloudy", "Foggy"};
   default = 2;
 };
};

First parameter (time of day) is first (position 0) in the paramsarray array. Weather will be in the second position (1).

So..

timeofday = paramsarray select 0;

weather = paramsarray select 1;

And so on...

---------- Post added at 02:15 PM ---------- Previous post was at 02:10 PM ----------

If you have a lot of parameters, it might be useful to use this.

Place it at the top of init.sqf (well, anywhere where it's above/before you use any parameter values):

for [{_i = 0},{_i < count(paramsArray)},{_i = _i + 1}] do {
 call compile format ["PARAMS_%1 = %2",(configName ((missionConfigFile >> "Params") select _i)),(paramsArray select _i)];
};

This will make it easier to remember and use your parameters in scripts. For example, the selected parameter values from time and weather in the example above would be in these variables:

PARAMS_TimeOfDay

PARAMS_Weather

Share this post


Link to post
Share on other sites

Ahh okay, now I get it (the first part.) The second automated code I will try out too.

Share this post


Link to post
Share on other sites

I want to build a MP mission where you can set within the lobby among other options

* day

* month

* hour

So that you can adjust the weather and time options very detailed (to be able to have clear nights with a bright moon that require no nvgoggles and so on).

How can you achieve to make a client that joins in progress to have the current time of the server (not the time the server started with)?

I have set the editor time to 1200.

The description.ext includes

class Params
{
 class TimeOfDay {
   title = "Time of Day";
   values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
   texts[] = {"0000","0100","0200","0300","0400","0500","0600","0700","0800","0900","1000","1100","1200","1300","1400","1500","1600","1700","1800","1900","2000","2100","2200","2300"};
   default = 16;
 };
};

The init.sqf includes

_hour = paramsArray select 0 
_month = and so on
setDate [date select 0, _month, _day, _hour, date select 4];

I suppose this will make a client joining in progress set his own daytime to the value selected in the MP lobby, regardless how much time is spent since the server started ?

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

×