Jump to content
Sign in to follow this  
evilnate

Set Time and Weather - SQF Style

Recommended Posts

I'm having a hell of a time trying to get time and weather params working without using sqs. Here's a example of how it works with a A2 coop mission, SQS Style.

Description.ext

onLoadMission="=MY MISHUN";
onLoadIntroTime = true;
onLoadMissionTime = true;


showmap = 1;
showgps = 1;
respawn = 4;
respawndelay = 15;
disabledAI = 1;

titleParam1 = "Time Of Day";
valuesParam1[] = {1,2,3,4};
defValueParam1 = 3;
textsParam1[] = {"Noon", "Dusk", "Night","Dawn"};

titleParam2 = "Weather";
valuesParam2[] = {1,2,3,4};
defValueParam2 = 1;
textsParam2[] = {"Clear", "Stormy", "Cloudy", "Foggy"};

Init.sqs

?(param1 == 1):goto "Midday"
?(param1 == 2):goto "Dusk"
?(param1 == 3):goto "Night"
?(param1 == 4):goto "Dawn"

#MIDDAY
skiptime 12
fire1 inflame false
fire2 inflame false
fire3 inflame false
fire4 inflame false
fire5 inflame false
goto "Param1_END"

#DUSK
skiptime 18
fire1 inflame true
fire2 inflame true
fire3 inflame true
fire4 inflame true
fire5 inflame true
goto "Param1_END"

#NIGHT
skiptime 0
fire1 inflame true
fire2 inflame true
fire3 inflame true
fire4 inflame true
fire5 inflame true
goto "Param1_END"

#DAWN
skiptime 5.5
fire1 inflame false
fire2 inflame false
fire3 inflame false
fire4 inflame false
fire5 inflame false
goto "Param1_END"

#Param1_END


?(param2 == 1):goto "Clear"
?(param2 == 2):goto "Stormy"
?(param2 == 3):goto "Cloudy"
?(param2 == 4):goto "Foggy"


#CLEAR
0 setFog 0
0 setOvercast 0
goto "Param2_END"

#STORMY
0 setFog 0.4
0 setOvercast 1.0
goto "Param2_END"

#CLOUDY
0 setFog 0.0
0 setOvercast 0.7
goto "Param2_END"

#FOGGY
0 setFog 0.70
0 setOvercast 0.7
goto "Param2_END"

#Param2_END

How do I get this to work with init.SQF?

I am slightly retarted when it comes to SQF so please reply as if you are teaching a new born.

Share this post


Link to post
Share on other sites

Until someone who knows what they are talking about replies...

//[b]description.ext

[/b]titleParam2="Time Of Day";
valuesParam2[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
defvalueParam2=0;
textsParam2[]={"0: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"};

//[b]init.sqf[/b]

skiptime param2;

That's all I know... no idea about the weather.

Share this post


Link to post
Share on other sites

Try this:

_fires = [fire1, fire2, fire3, fire4, fire5];
switch (param1) do {
case 1: {
	skiptime 12;
	{_x inflame false} foreach _fires;
};
case 2: {
	skiptime 18;
	{_x inflame true} foreach _fires;
};
case 3: {
	skiptime 0;
	{_x inflame true} foreach _fires;
};
case 4: {
	skiptime 5.5;
	{_x inflame false} foreach _fires;
};
};
switch (param2) do {
case 1: {
	0 setFog 0;
	0 setOvercast 0;
};
case 2: {
	0 setFog 0.4;
	0 setOvercast 1.0;
};
case 3: {
	0 setFog 0.0;
	0 setOvercast 0.7;
};
case 4: {
	0 setFog 0.7;
	0 setOvercast 0.7;
};
};

Share this post


Link to post
Share on other sites

How do you make it Join-in-progress compatible? Everytime I used this time scripts guys joining had pitch black night while others were basking in the sun! Time should be a public variable for godssake?

Share this post


Link to post
Share on other sites

You could use the MP functions ( RE ) and use that to set time. Worked for me.

Share this post


Link to post
Share on other sites

It is also possible to use setDate [2006, 11, 30, 9, 0] takes instead of skipTime :)

Share this post


Link to post
Share on other sites

Yeah as TomDark says you can probably use setDate. So use skipTime on the server to get the desired start time and then:

spawn { while { true } do { ServerDate = date; publicVariable "ServerDate"; sleep 60; } };

The on join:

setDate ServerDate;

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  

×