Jump to content
Sign in to follow this  
garbol87

What am I doing wrong? (Day/Night options)

Recommended Posts

So I want to set the option in the MP coop mission so that the players will be able to set time of day.

Description.EXT

titleParam1 = "DAYTIME";

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

defValueParam1 = 1;

textsParam1[] = {"Dawn", "Midday", "Dusk", "Night"};

Init.sqs

?(param1==1):skiptime 6.2

?(param1==2):skiptime 12

?(param1==3):skiptime 18.4

?(param1==4):skiptime 0

When I choose an option it always crashes the whole game :/

here is the message:

"Preprocessor failed on file mpmissions\_cur_mp.Chernarus\init.sqf - error 7."

please help :(

Share this post


Link to post
Share on other sites

Hm, I don't know what's wrong, but I would try to put the skiptime commands in a trigger. Maybe it works.

Share this post


Link to post
Share on other sites
So I want to set the option in the MP coop mission so that the players will be able to set time of day.

Description.EXT

titleParam1 = "DAYTIME";

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

defValueParam1 = 1;

textsParam1[] = {"Dawn", "Midday", "Dusk", "Night"};

Init.sqs

?(param1==1):skiptime 6.2

?(param1==2):skiptime 12

?(param1==3):skiptime 18.4

?(param1==4):skiptime 0

When I choose an option it always crashes the whole game :/

here is the message:

"Preprocessor failed on file mpmissions\_cur_mp.Chernarus\init.sqf - error 7."

please help :(

to use the variable skiptime you do the following

skiptime param1;

Share this post


Link to post
Share on other sites

Where do I put it? In description.ext or init.sqf?

Share this post


Link to post
Share on other sites

think of the description.ext as settings. Do not launch scripts from it. init.sqf is initialized at mission start. you could put it in the init.sqf, units initline a trigger onactivation really anywhere. Note if players JIP the init is accessed each time and may change the time. I personally because of laziness put it in a trigger set to once condition true with 1 for min, mid, max and on activation skiptime (param1);

Share this post


Link to post
Share on other sites
to use the variable skiptime you do the following

skiptime param1;

Why? Param1 is given the value as defined in valuesParam1. SkipTime param1 would be skipTime 1, which would only skip by an hour. There's nothing obviously wrong that I can see with his init.sqs, but it is easier just to do this:

Description.EXT

titleParam1 = "DAYTIME";
valuesParam1[] = {6.2,12,18.4,0};
defValueParam1 = 6.2;
textsParam1[] = {"Dawn", "Midday", "Dusk", "Night"};

Init.sqf

skipTime param1;

As for the crash, it would seem that your init.sqs is actually an init.sqf, and that you are using sqs snytax in an sqf file. I've corrected it above.

Edited by Big Dawg KS

Share this post


Link to post
Share on other sites
Why? Param1 is given the value as defined in valuesParam1. SkipTime param1 would be skipTime 1, which would only skip by an hour. There's nothing obviously wrong that I can see with his init.sqs, but it is easier just to do this:

Description.EXT

titleParam1 = "DAYTIME";
valuesParam1[] = {6.2,12,18.4,0};
defValueParam1 = 6.2;
textsParam1[] = {"Dawn", "Midday", "Dusk", "Night"};

Init.sqf

skipTime param1;

As for the crash, it would seem that your init.sqs is actualyl an init.sqf, and that you are using sqs snytax in an sqf file. I've corrected it above.

You misunderstood, Garbol had

?(param1==1):skiptime 6.2
?(param1==2):skiptime 12
?(param1==3):skiptime 18.4
?(param1==4):skiptime 0

which is not what he needed, he defined param1 fine but to execute skiptime all he needed was

skiptime param1;

Share this post


Link to post
Share on other sites

I'm not sure you understand how mission parameters work. He had

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

Which means param1 would be equal to one of these values depending on what was selected. So if he selected "Dusk", param1 would be equal to 3. If he then did skipTime 3, it would only skip 3 hours instead of the 18.4 he wants.

Your example would be fine IF Garbol87 had this:

valuesParam1[] = {6.2,12,18.4,0};

OR, what he had to begin with was perfectly correct. His error appears to be because he used sqs syntax in an sqf file. If he just changes init.sqf to init.sqs it should work perfectly.

Share this post


Link to post
Share on other sites
I'm not sure you understand how mission parameters work. He had

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

Which means param1 would be equal to one of these values depending on what was selected. So if he selected "Dusk", param1 would be equal to 3. If he then did skipTime 3, it would only skip 3 hours instead of the 18.4 he wants.

Your example would be fine IF Garbol87 had this:

valuesParam1[] = {6.2,12,18.4,0};

OR, what he had to begin with was perfectly correct. His error appears to be because he used sqs syntax in an sqf file. If he just changes init.sqf to init.sqs it should work perfectly.

I do know how they work, I just am not good at explaining myself sometimes. Defining what param1 is over again is not needed. As you said he just needs to put the hour in. What I do is make the mission at 1200ish to make it easy and for testing i can see without nvgs. Then I would do as follows

titleParam1 = "Time of Day:"; 
valuesParam1[] = {-6,0,7,12};
defValueParam1 = 0; 
textsParam1[] = {"Morning","Midday","Evening","Night"};

in a trigger i have

skiptime param1;

that will then set my time from 1200 to either 0600,1200,1900,2400

Share this post


Link to post
Share on other sites

Ok thanks guys that works greate :D

I used your method Ghost644 thanks a lot :)

Share this post


Link to post
Share on other sites
I do know how they work, I just am not good at explaining myself sometimes. Defining what param1 is over again is not needed. As you said he just needs to put the hour in. What I do is make the mission at 1200ish to make it easy and for testing i can see without nvgs. Then I would do as follows

titleParam1 = "Time of Day:"; 
valuesParam1[] = {-6,0,7,12};
defValueParam1 = 0; 
textsParam1[] = {"Morning","Midday","Evening","Night"};

in a trigger i have

skiptime param1;

that will then set my time from 1200 to either 0600,1200,1900,2400

Now you're just saying the same thing I was... :j:

Share this post


Link to post
Share on other sites

Hey how can I change this script up a little bit to make it random upon mission start? Thanks in advance

Share this post


Link to post
Share on other sites

Set your mission to begin at 0:00. And then write in your init.sqf or trigger:

skipTime (random 24);

Share this post


Link to post
Share on other sites

That will make every player have different time. :)

Share this post


Link to post
Share on other sites

every player have a different time huh? hmmm. Is that frowned upon in online coop games? Is there a way to randomize it on the server or host side for everyone? Either way thanks for the reply guys!

Share this post


Link to post
Share on other sites

Just random on server only, pass that number to all clients with publicvariable and skiptime that amount.

Share this post


Link to post
Share on other sites

ok ill try and do some research on publicvariable for myself but I may be back lol, codes are a bitch

Share this post


Link to post
Share on other sites
That will make every player have different time. :)
Ah, yes. Totally forgot about that. ;)

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  

×