Jump to content
Sign in to follow this  
bigshot

SetDate--> Time not working at mission start

Recommended Posts

I'm working on a mission that has a parameter to set the time of day at mission start.

Im using this in my init.sqf to set the time of day for clients (im using this on non-dedicated self hosted server):

if (isServer) then { setDate [2035, 7, 6, (paramsArray select 3), 1]; };

Now, the trouble is...the time gets synced fine for anyone who joins after mission start (JIP), but the players who join with the host at mission start get the wrong time. I'm a bit confused how to get both types of players synced with the correct time.

Share this post


Link to post
Share on other sites

Im not sure what to do...it is being executed on all clients but only AFTER the mission has started....so the time works fine for JIP'ers...but how do i get the time correct for players who join with me AT mission start?

I was originally using skiptime...but that only works for players who join AT mission start and not after. So i switched to setdate and now things are the opposite, heh.

Share this post


Link to post
Share on other sites
I'm working on a mission that has a parameter to set the time of day at mission start.

Im using this in my init.sqf to set the time of day for clients (im using this on non-dedicated self hosted server):

if (isServer) then { setDate [2035, 7, 6, (paramsArray select 3), 1]; };

Now, the trouble is...the time gets synced fine for anyone who joins after mission start (JIP), but the players who join with the host at mission start get the wrong time. I'm a bit confused how to get both types of players synced with the correct time.

Change if (isServer) to (time > 10) so it will only run on people there at mission start

Share this post


Link to post
Share on other sites
Change if (isServer) to (time > 10) so it will only run on people there at mission start

didnt work...that made the mission start with the editor saved time.

Share this post


Link to post
Share on other sites

Changing the time can be done before the mission start (during the briefing). All clients (JIP or at start) run the init.sqf. So as the mission starts, you want all machines (including the server) to execute the setDate command. Interestingly, because JIP players already sync time, this would set the time incorrectly for them. You want time < 10, not time > 10. In the init:

if (time < 10) then {
   setDate [2035, 7, 6, (paramsArray select 3), 1];
};

Share this post


Link to post
Share on other sites
Changing the time can be done before the mission start (during the briefing). All clients (JIP or at start) run the init.sqf. So as the mission starts, you want all machines (including the server) to execute the setDate command. Interestingly, because JIP players already sync time, this would set the time incorrectly for them. You want time < 10, not time > 10. In the init:

if (time < 10) then {
   setDate [2035, 7, 6, (paramsArray select 3), 1];
};

Whoops yeah got my > and < mixed up

Share this post


Link to post
Share on other sites

thanks guys...ill give it a go.

**EDIT: no joy guys...same result...works for host just fine...and works for client ONLY during a JIP...but client joining AT mission start is getting the editor saved time...so the code is only running for the client when he joins AFTER the mission has started.

My init file is failry large...could it be i need to place it in a better position? farther up or down?

***EDIT - yup that was my issue...code was fine...my placement was stupid.

Thank you VERY much for the help tonight...can't tell you how much I appreciate it!

Edited by BigShot

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  

×