Jump to content

Joelma's Time Control


Donnovan

Recommended Posts

Also, i did a update that remove this part of the code:

if (!isDedicated) then {
    [] spawn {
        for "_x" from 1 to 10 do {
            "infiSTAR_SetDate" addPublicVariableEventHandler {};
            "PVDZE_plr_SetDate" addPublicVariableEventHandler {};
            cad_pvar_send_owner = player;
            publicVariableServer "cad_pvar_send_owner";
            sleep 0.5;
        };
    };

};

Just need some time to put it here. It also fix sync check to maximum precision, avoiding unnecessary ajusts in player time (what gives a small freeze).

Does this allow the date to be set to a static one? If so how can I implement it?

Link to comment
Share on other sites

For whatever reason it's not working for me. I tried setting as static date with this disabled and it works fine, the sun rises in a normal arc across the sky. With this mod enabled it is like living in alaska, the sun never fully rises just moves in an arc across the eastern sky, it's like it's perpetually dawn and very annoying. Could I just remove this part of the code and have it revert to my static date?

	"cad_pvar_server_date" addPublicVariableEventHandler {(_this select 1) call donn_setdate;};
	donn_setdate = {
		private ["_dateSer","_dateCli","_date_diff"];
		donn_speed = _this select 1;
		0 setOvercast 0;
		_dateSer = dateToNumber (_this select 0);
		_dateCli = dateToNumber date;
		_date_diff = (_dateSer-_dateCli)*12*31*24;
		if (abs _date_diff > 5/60) then {setDate (_this select 0);};
	};
};

Link to comment
Share on other sites

The times aren't the problem, it's the position on the sun, which does change based on your server date. I'm playing on Taviana and with it hard coded to Sep 21 in my hive.ini, it's a long sunlit day with a normal arc through the sky, until I enable this mod and it moves 35 degrees to the east and never fully rises

Link to comment
Share on other sites

That may be a Taviana issue. When I opened Taviana in the editor when I was considering running that map the sun was low in the sky. It made editing the map a little difficult. When editing other maps the sun is higher. I would be interested to see if this is a problem across all maps because I noticed that changing dates didn't seem to affect the sun when I thought it should. .

Link to comment
Share on other sites

Okay I installed this using the first post and that only. I added the lines to SERVER_FUNCTIONS.SQF and added the time_control.sqf etc to my init.sqf where its called in the mission file. I am having an issue where time is sped up but it is skipping back. I took a video with fraps and added it to my drop box to show what it is doing. Hopefully you don't have to download the file... it lets me load it in the browser. https://www.dropbox.com/s/ftuyy9ga47pux2n/a2.avi?dl=0

Link to comment
Share on other sites

  • 3 weeks later...

BetterDeadThanZed,

Have you tried the version that allow dynamic wheather?

 

I finally got around to trying your version. I'm on my test server right now waiting for the weather to change. You mentioned updating something but never posted anymore. How long should I have to wait for some weather to appear? 

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

 

would I be able to achieve the same thing this thread ask for using this script? 

I want only 3 hours night and the rest of Real Life day time to be 21 hours day. Thanks -Aurora

 

 

That's not how this script works. This script allows you to have a full 24 hour cycle in one server restart period. If you want 3 hours of night, then maybe the 6 hour restart configuration might work but I can't say for sure. With it configured for 4 hours, I get a little over 1 hour of night with 3 hours of day every 4 hours.

Link to comment
Share on other sites

		//========================TIME FUNCTION============================
		if (_dayTime >= 8 && _dayTime <= 16) then {donn_speed =  4.000;};
		if (_dayTime >  4 && _dayTime <   8) then {donn_speed =  6.666;};
		if (_dayTime > 16 && _dayTime <  20) then {donn_speed =  6.666;};
		if (_dayTime <= 4 || _dayTime >= 20) then {donn_speed = 10.000;};
		//================================================================= 

This can be archieved changing this. But i can't understand if its 3 hours from 24 hours or from 4 hours.

 

Will try to help better at night.

Link to comment
Share on other sites

I know its possible to achieve one restart always starting as night and the next day, but im not sure how to achieve this... Chilz (server admin) had this in his server, but has gotten back to me so im not sure how to implement this... if there are any variables you know of that i can mess with it would be much appreciated thanks!!! -Aurora

Link to comment
Share on other sites

deltagi,

 

When i did this on my server, it was the case to have two HiveExt.ini, one for day (HiveExt_day.ini) and one for night (HiveExt_night.ini). And use one or another based on system time.

 

Take a look at this .bat bellow, it look at system time and alternate between day and night restarts. Restarts of 0h, 8h and 16h will be night, the others will be day:

set hour=%time:~0,2%
if "%hour%" == " 0" goto do_night
if "%hour%" == " 1" goto do_night
if "%hour%" == " 2" goto do_night
if "%hour%" == " 3" goto do_night

if "%hour%" == " 8" goto do_night
if "%hour%" == " 9" goto do_night
if "%hour%" == "10" goto do_night
if "%hour%" == "11" goto do_night

if "%hour%" == "16" goto do_night
if "%hour%" == "17" goto do_night
if "%hour%" == "18" goto do_night
if "%hour%" == "19" goto do_night

del "C:\Arma2server\instance_11_Chernarus\HiveExt.ini"
copy "C:\arma2server\instance_11_Chernarus\HiveExt_day.ini" "C:\arma2server\instance_11_Chernarus\HiveExt.ini"

goto day_night_ok

:do_night

del "C:\arma2server\instance_11_Chernarus\HiveExt.ini"
copy "C:\arma2server\instance_11_Chernarus\HiveExt_night.ini" "C:\arma2server\instance_11_Chernarus\HiveExt.ini"

:day_night_ok

timeout 2
start "arma2" /high "C:\arma2server\arma2oaserver.exe" -port=2302 -noPause -nosound "-config=instance_11_Chernarus\config.cfg" "-cfg=instance_11_Chernarus\basic.cfg" "-profiles=instance_11_Chernarus" -name=instance_11_Chernarus "-mod=@DayZ_Epoch;@DayZ_Epoch_Server;"

To know system time, the .bat uses the command time, and this command can have different format on different systens, so some tweak may be necessary.

Link to comment
Share on other sites

  • 2 weeks later...

I've been using this successfully on my Epoch servers but I just tried adding it to a vanilla Dayz server and I get this in the error log and there's no accelerated time:

20:44:42 Error in expression <ialSend = false;
donn_server_timeSync = server_timeSync;
server_timeSync = {if (>
20:44:42   Error position: <server_timeSync;
server_timeSync = {if (>
20:44:42   Error Undefined variable in expression: server_timesync
20:44:42 File z\addons\dayz_server\init\server_functions.sqf, line 217

Line 217 is this:

donn_server_timeSync = server_timeSync;
Link to comment
Share on other sites

After looking some more, I see that Dayz 1.8.5 is missing this code from the server_functions.sqf file, which is present in the one for Epoch 1.0.5.1:

server_timeSync = {
//Send request
private ["_hour","_minute","_date","_key","_result","_outcome"];
    _key = "CHILD:307:";
_result = _key call server_hiveReadWrite;
_outcome = _result select 0;
if(_outcome == "PASS") then {
_date = _result select 1; 
 
if(dayz_fullMoonNights) then {
_hour = _date select 3;
_minute = _date select 4;
//Force full moon nights
_date = [2013,8,3,_hour,_minute];
};
 
setDate _date;
PVDZE_plr_SetDate = _date;
publicVariable "PVDZE_plr_SetDate";
diag_log ("TIME SYNC: Local Time set to " + str(_date)); 
};
};

Does anyone know where I could add this in the server_functions.sqf for Dayz 1.8.5? This is the server_functions.sqf from Dayz 1.8.5: http://pastebin.com/YabLC9v7

Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...