Jump to content

Recommended Posts

Ok so when i commented the dynamic weather out i got errors in reference to this lin

#include "\z\addons\dayz_code\system\BIS_Effects\init.sqf"

i deleted this line and it works great....so my question is does the server work ok without this line of code....if so what does this code refer to thanks.

Share this post


Link to post
Share on other sites

\z\addons\dayz_code\system\BIS_Effects\init.sqf is for the weather effects on your server like rain, cloudy, storm etc...

You have to comment this out because of the fast time travel. Or you would have very fast clouds in the sky with lags.

There is a slightly modified version where you can use the weather effects but it seems that it's not working correctly

Share this post


Link to post
Share on other sites

Hi,

If you want to try this version, tell me if it works:

VERSION A: You need to have clouds off:

//ON SERVER FILES - REPLACE SERVER_TIMESYNC FUNCTION IN SERVER_FUNCTION.SQF
server_timeSync={
	private["_hour","_minute","_date","_key","_result","_outcome","_date_n","_timeDif","_date_n_fixed"];
        _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;
			_date=[2013,8,3,_hour,_minute];
		};

		//MTDR
		if(isNil"PVDZE_plr_SetDate")then{
			mtdr_dateInitial=_date;
			mtdr_dateInitial_y=mtdr_dateInitial select 0;;
			mtdr_dateInitial_n=dateToNumber mtdr_dateInitial;
		};
		_date_n=dateToNumber _date;
		_timeDif=_date_n-mtdr_dateInitial_n;
		_date_n_fixed=_date_n+_timeDif*5;
		_date=numberToDate[mtdr_dateInitial_y,_date_n_fixed];
		//MTDR
		
		setDate _date;
		PVDZE_plr_SetDate=_date;
		publicVariable"PVDZE_plr_SetDate";
		diag_log("TIME SYNC: Local Time set to "+str _date);
	};
};

//ON MISION FILES - ADD AT THE END OF INIT.SQF
[] spawn {
	_acell=6;
	_uiSleepBase=12;
	_uiSleep=_uiSleepBase;
	_skipTimeBase=((_acell-1)*_uiSleepBase)/3600;
	_skipTime=_skipTimeBase;
	_start=diag_tickTime;
	if(_skipTime>0)then{
		while{true}do{
			uiSleep _uiSleep;
			skipTime _skipTime;
			_time=diag_tickTime-_start;
			_start=_start+_time;
			_uiSleep=_uiSleepBase-(_time-_uiSleepBase);
			if(_uiSleep<0) then {
				_skipTime=_skipTimeBase+(-_uiSleep/3600);
				_uiSleep=0;
			};
		};
	};
};

VERSION B: You can have Clouds on:

//ON SERVER FILES - REPLACE SERVER_TIMESYNC FUNCTION IN SERVER_FUNCTION.SQF
server_timeSync={
	private["_hour","_minute","_date","_key","_result","_outcome","_date_n","_timeDif","_date_n_fixed"];
        _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;
			_date=[2013,8,3,_hour,_minute];
		};

		//MTDR
		if(isNil"PVDZE_plr_SetDate")then{
			mtdr_dateInitial=_date;
			mtdr_dateInitial_y=mtdr_dateInitial select 0;;
			mtdr_dateInitial_n=dateToNumber mtdr_dateInitial;
		};
		_date_n=dateToNumber _date;
		_timeDif=_date_n-mtdr_dateInitial_n;
		_date_n_fixed=_date_n+_timeDif*5;
		_date=numberToDate[mtdr_dateInitial_y,_date_n_fixed];
		//MTDR
		
		setDate _date;
		PVDZE_plr_SetDate=_date;
		publicVariable"PVDZE_plr_SetDate";
		diag_log("TIME SYNC: Local Time set to "+str _date);
	};
};

//ON MISION FILES - ADD AT THE END OF INIT.SQF
[] spawn {
	_acell=6;
	_uiSleepBase=0.01;
	_uiSleep=_uiSleepBase;
	_skipTimeBase=((_acell-1)*_uiSleepBase)/3600;
	_skipTime=_skipTimeBase;
	_start=diag_tickTime;
	if(_skipTime>0)then{
		while{true}do{
			uiSleep _uiSleep;
			skipTime _skipTime;
			_time=diag_tickTime-_start;
			_start=_start+_time;
			_uiSleep=_uiSleepBase-(_time-_uiSleepBase);
			if(_uiSleep<0) then {
				_skipTime=_skipTimeBase+(-_uiSleep/3600);
				_uiSleep=0;
			};
		};
	};
};

 

Edited by Donnovan

Share this post


Link to post
Share on other sites

In Arma 3 Exile mod, I use this code to speed up time, with time moving faster between 1900 and 0500 using this:

if (!isServer) exitWith {};

while {true} do
{
	if (daytime >= 19 || daytime < 5) then   // after 7pm and before 5am time multiplier changes
	{
		setTimeMultiplier 12      // adjust this value for slower or faster night cycle ( 24 hours will take 1 hour )
	}
	else
	{
		setTimeMultiplier 6      // adjust this value for slower or faster day cycle  ( 12 hours will take 1 hour )
	};

	uiSleep 30;
};

Does the if (daytime >= 19 etc..) work in Arma 2? For example, in the timecontrol.sqf, could I do this?

if (daytime >= 19 || daytime < 5) then 
{
donn_multi = 4;
}
else
{
donn_multi = 4/3;
}

Of course I'd probably have to tweak the donn_multi to get the appropriate time acceleration for the night hours.

Share this post


Link to post
Share on other sites

I am looking to have to server restarting when it is around 12:00 am. I have a 3 hour restart but the server cycles 24 hours with 4/3. I am not wanting it to cycle through 24 hours.

What would be the best setting for this?

Share this post


Link to post
Share on other sites

Thanks again donnovan for your hardwork.

Ok so normally i would test a script BEFORE posting a question.  but this script here if i install it i can only test it for the duration of a restart. and ill be honest i dont want to sit there for 4 hours lol.

So if i understand correctly, this line here

donn_multi = 4/3; -> 3 hours day

will give me 3 hours day, and one hour night? correct? (my restarts are 4hrs)

thanks again donnovan

Share this post


Link to post
Share on other sites
5 hours ago, theduke said:

Thanks again donnovan for your hardwork.

Ok so normally i would test a script BEFORE posting a question.  but this script here if i install it i can only test it for the duration of a restart. and ill be honest i dont want to sit there for 4 hours lol.

So if i understand correctly, this line here

donn_multi = 4/3; -> 3 hours day

will give me 3 hours day, and one hour night? correct? (my restarts are 4hrs)

thanks again donnovan

Correct. I have the same setting and have 3 hours daylight and one hour night in every 4 hour restart

 

On 07/02/2016 at 3:38 AM, rpg4e said:

I did. Doesn't work. Followed full instructions and have read whole topic...

You're an idiot. This has been working on my server for months. Instead of flatly saying it doesn't work (which I can assure you, it does) fix your problems with script restrictions and get it working? 

Share this post


Link to post
Share on other sites

My server has static time in hiveExt to be 6am when the server starts.

My restarts are every 4 hours.

I want to have 3 hours of day and 1 hour of night.

I set to 4/3 but all that appears to be happening is that time speeds up and races to get back to 6am within the 4 hour cycle.  So it's sunset (7pm) after 2 hours uptime and by the time it's restart time again, it's almost back to 6am again.   

What could I have done wrong?  Any suggestions to solve this would be much appreciated.

Share this post


Link to post
Share on other sites

 

59 minutes ago, ravenwolf said:

My server has static time in hiveExt to be 6am when the server starts.

My restarts are every 4 hours.

I want to have 3 hours of day and 1 hour of night.

I set to 4/3 but all that appears to be happening is that time speeds up and races to get back to 6am within the 4 hour cycle.  So it's sunset (7pm) after 2 hours uptime and by the time it's restart time again, it's almost back to 6am again.   

What could I have done wrong?  Any suggestions to solve this would be much appreciated.

Errrr ..... what? That gives you ROUGHLY 1 hour of night time? 

Share this post


Link to post
Share on other sites
12 hours ago, ElDubya said:

 

Errrr ..... what? That gives you ROUGHLY 1 hour of night time? 

No, it gives me 2 hours of day and 2 hours of night.  It takes 2 hours to get from 6am to 7pm (sunset).  At which point there are still 2 hours till the next restart.
By the time the server restarts , it's dawn.

I want 6am until 7pm to take 3 hours.  And 7pm until 5am to take 1 hour.

Share this post


Link to post
Share on other sites
On 21/10/2015 at 6:08 PM, Donnovan said:

Hi,

If you want to try this version, tell me if it works:

VERSION A: You need to have clouds off:

//ON SERVER FILES - REPLACE SERVER_TIMESYNC FUNCTION IN SERVER_FUNCTION.SQF
server_timeSync={
	private["_hour","_minute","_date","_key","_result","_outcome","_date_n","_timeDif","_date_n_fixed"];
        _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;
			_date=[2013,8,3,_hour,_minute];
		};

		//MTDR
		if(isNil"PVDZE_plr_SetDate")then{
			mtdr_dateInitial=_date;
			mtdr_dateInitial_y=mtdr_dateInitial select 0;;
			mtdr_dateInitial_n=dateToNumber mtdr_dateInitial;
		};
		_date_n=dateToNumber _date;
		_timeDif=_date_n-mtdr_dateInitial_n;
		_date_n_fixed=_date_n+_timeDif*5;
		_date=numberToDate[mtdr_dateInitial_y,_date_n_fixed];
		//MTDR
		
		setDate _date;
		PVDZE_plr_SetDate=_date;
		publicVariable"PVDZE_plr_SetDate";
		diag_log("TIME SYNC: Local Time set to "+str _date);
	};
};

//ON MISION FILES - ADD AT THE END OF INIT.SQF
[] spawn {
	_acell=6;
	_uiSleepBase=12;
	_uiSleep=_uiSleepBase;
	_skipTimeBase=((_acell-1)*_uiSleepBase)/3600;
	_skipTime=_skipTimeBase;
	_start=diag_tickTime;
	if(_skipTime>0)then{
		while{true}do{
			uiSleep _uiSleep;
			skipTime _skipTime;
			_time=diag_tickTime-_start;
			_start=_start+_time;
			_uiSleep=_uiSleepBase-(_time-_uiSleepBase);
			if(_uiSleep<0) then {
				_skipTime=_skipTimeBase+(-_uiSleep/3600);
				_uiSleep=0;
			};
		};
	};
};

VERSION B: You can have Clouds on:

//ON SERVER FILES - REPLACE SERVER_TIMESYNC FUNCTION IN SERVER_FUNCTION.SQF
server_timeSync={
	private["_hour","_minute","_date","_key","_result","_outcome","_date_n","_timeDif","_date_n_fixed"];
        _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;
			_date=[2013,8,3,_hour,_minute];
		};

		//MTDR
		if(isNil"PVDZE_plr_SetDate")then{
			mtdr_dateInitial=_date;
			mtdr_dateInitial_y=mtdr_dateInitial select 0;;
			mtdr_dateInitial_n=dateToNumber mtdr_dateInitial;
		};
		_date_n=dateToNumber _date;
		_timeDif=_date_n-mtdr_dateInitial_n;
		_date_n_fixed=_date_n+_timeDif*5;
		_date=numberToDate[mtdr_dateInitial_y,_date_n_fixed];
		//MTDR
		
		setDate _date;
		PVDZE_plr_SetDate=_date;
		publicVariable"PVDZE_plr_SetDate";
		diag_log("TIME SYNC: Local Time set to "+str _date);
	};
};

//ON MISION FILES - ADD AT THE END OF INIT.SQF
[] spawn {
	_acell=6;
	_uiSleepBase=0.01;
	_uiSleep=_uiSleepBase;
	_skipTimeBase=((_acell-1)*_uiSleepBase)/3600;
	_skipTime=_skipTimeBase;
	_start=diag_tickTime;
	if(_skipTime>0)then{
		while{true}do{
			uiSleep _uiSleep;
			skipTime _skipTime;
			_time=diag_tickTime-_start;
			_start=_start+_time;
			_uiSleep=_uiSleepBase-(_time-_uiSleepBase);
			if(_uiSleep<0) then {
				_skipTime=_skipTimeBase+(-_uiSleep/3600);
				_uiSleep=0;
			};
		};
	};
};

 

 

 

I am using what you posted here, but it does not change speed depending on time so night time will be the same speed as day, also getting the right speed for 24 hours in 3 hour restart is difficult. 

 

Also my nights aren't full moon even with it set to true?

 

Thanks in advanced

Share this post


Link to post
Share on other sites

Thanks for this great work!

How should i set up this script to have 5 Hours Day and 1 Hour Night? :/ I'm a little bit confused right now ^^

At the moment i have it setup like this: 

Quote

donn_multi = 0.5;

and in day_server functions:

//========================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 = 20.000;};
//=================================================================

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Similar Content

    • By iben
      Hello guys,
      currently I'm working on couple addons for my server and from time to time,
      when coding, some answers to your questions pops up in my head.
      Couple days ago I was asked about server restart time and uptime. Well,
      why not to share it - BUT... nothing bad about current solution you're probably using!
      In fact, the code for this is everywhere - that's right. I did it my way not because
      I couldn't use common code - but just because I'm still learning a lot - and because I needed
      restart time/uptime solution for my files.
      So here is it... if you want to try, test it and let me know. The true is, I haven't time to test
      it properly. So I'm gonna be happy to hear your thoughts...
      ===
      Big thanks always goes to:
      DayZ Epoch developers, collaborators and contributors (thank you guys for your excellent work!) ===
      Changelog:
      [2017-06-04], v1.0 | Initial release ===
      Read "Goodbye". Wish you the best guys!
      ===
      How it looks like:
      // =========================================================================== // FUNCTIONS LIBRARY >> Universal server timer function // =========================================================================== // @Function name: fnc_IBEN_uniSTime // =========================================================================== // @Remarks: // - Can be called 2 ways: // * Restart/Uptime with label // * Restart/Uptime without label // @Parameters: // - Time for restart cycle in seconds | number // - Time mode (values: "restart"/"uptime") | string // - Label (example: "Restart in") | string // @Related files: // - none // @Example: // - For server time we are using global var: SERV_RESTART = 10800; (3h) // - restart time with no label // * [SERV_RESTART,"restart"] call fnc_IBEN_uniSTime; // - restart time with label // * [SERV_RESTART,["restart","Restart in"]] call fnc_IBEN_uniSTime; // - uptime with no label // * [SERV_RESTART,"uptime"] call fnc_IBEN_uniSTime; // - uptime with label // * [SERV_RESTART,["uptime","Time from start"]] call fnc_IBEN_uniSTime; // @Returns: // - time string in format: "h:mm", or "Restart in: h:mm" // =========================================================================== private ["_serverCycle","_timerParams","_timerType","_label","_useLabel","_minArr", "_srvTime","_goTime","_leftTime","_opTime","_hours","_y","_minutes","_key","_sub", "_notLabel","_useLabel"]; _label = ""; // label reset _useLabel = false; _serverCycle = _this select 0; _timerParams = _this select 1; if (typeName _timerParams != "ARRAY") then { _timerType = _timerParams; _useLabel = false; } else { _timerType = _timerParams select 0; _label = _timerParams select 1; _useLabel = true; }; _minArr = [1,2,3,4,5,6,7,8,9,0]; _srvTime = "0h 00min"; // @info: default time _goTime = 0; _goTime = serverTime; _leftTime = (round (_serverCycle - _goTime)); _opTime = [_goTime,_leftTime] select (_timerType == "restart"); if (_leftTime > 0) then { _hours = (floor ((_opTime / 60) / 60)); _minutes = (floor ((_opTime / 60) - (_hours * 60))); _key = _minutes; { _sub = _minArr select _x; if (_sub == _key) exitWith { _minutes = _sub; }; } count _minArr; _minutes = [_minutes,format["0%1",_minutes]] select (_minutes < 10); _notLabel = format ["%1h %2m",_hours,_minutes]; _incLabel = format ["%1: %2h %3m",_label,_hours,_minutes]; _srvTime = [_notLabel,_incLabel] select (_useLabel); } else { _srvTime }; _srvTime // === :: fnc_IBEN_uniSTime END ===
      Check source code (Github)
      ===
      FEATURES:
      Not big deal, just small piece of code as output from my work to make things easier... Function is able to output Restart time or Uptime with single line code (see bellow) and can be easily integrated into your code. If you restart system fails (or you with settings :) and time is over, time stays formatted as: '0h:00min' Usage examples: debug monitor, log time (diag_log) etc. It's a function - you can easily maintain your "time" code... ===
      How to install:
      It's actually very easy: practical example is the best way to explain, what needs to be done. See repo structure and files.
      Source files are available at Github repo. You can download them from here.
      ===
      How to use it:
      = General usage:
      // @Parameters: // - Time for restart cycle in seconds | number // - Time mode (values: "restart"/"uptime") | string // - Label (example: "Restart in") | string // ========================================================== // @Scenario: // - First, we store our server restart time into global variable // so we can easily use it anywhere and change it at once later, // if we want to change time: if (isNil SERV_RESTART) then { SERV_RESTART = 10800; }; // @example 01: Restart time with no label [SERV_RESTART,"restart"] call fnc_IBEN_uniSTime; // @example 02: Restart time with label [SERV_RESTART,["restart","Restart in"]] call fnc_IBEN_uniSTime; // @example 03: Uptime with label [SERV_RESTART,["uptime","Time from start"]] call fnc_IBEN_uniSTime; // @Returns: // - Time string in format: "h:mm", or "Restart in: h:mm" ===
      ...easy enough, isn't it?
      ===
      = Specific usage:
      // === Scenario 01: // It's very easy to add it to your debug monitor code. In fact, we're not gonna to cover // this specific scenario - just look around forum, there are plenty of releases. // But... many time I heard question like: "How can I add restart time/uptime to the right // bottom screen corner the way how watermark is?". // Well, this is our first scenario: // === What to do: // It's actually pretty easy: just grab your files from my repo - how to implement you will // easily find out from prepared files - just follow repo structure. // Done? OK - so you integrated 'fnc_IBEN_uniSTime' into your compiled files and you can // use it now. // Everyone has some kind of debug monitor, right? So just add this piece of code: while {1 == 1} do { private ["_Tinfo","_Tval",...some local vars]; // ... your debug monitor code // ======================================================================= // GUI: RESTART TIMEOUT (see picture bellow) // (but you can add uptime with/withou label - look for examples above) // ======================================================================= _Tval = [SERV_RESTART,["restart","Restart in"]] call fnc_IBEN_uniSTime; _Tinfo = format ["<t size='.35' align='right' font='TahomaB'>%1</t>", _Tval]; [ _Tinfo ,safezoneX * -1 ,0.98 * safezoneH + safezoneY ,9999 ,0 ,0 ,50009 ] spawn BIS_fnc_dynamicText; // your code for parsing text bellow uiSleep 2; }; // === Scenario 02: // Let's implement formatted time info into your debug output (logs). // === What to do: // Just add: diga_log format ["=== [DEBUG] Player %1 (%2) just found your secret item. [%3]", (name player), getPlayerUID player, [SERV_RESTART,["uptime","Uptime"]] call fnc_IBEN_uniSTime)]]; // RPT output: "=== [DEBUG] Player iben (8542514521...) just found your secret item. [Uptime: 1h:30min]" // === Done! ===
      Screen right bottom time watermark (showcase):

      ===
      ...that's all... Have Fun!!!
      Cheers...
      ===
    • By Thug
      In the HiveExt.ini if I wanted to set the time to say 1415, would you set it as 1415, 14:15 or does it have to be on the hour?
      [Time]
      ;Possible values: Local, Custom, Static
      ;You cannot use Static on OFFICIAL Hive, it will just revert to Local
      Type = Static
      ;If using Custom type, offset from UTC in hours (can be negative as well)
      Offset = -4
      ;If using Static type (Hour value always the same on every server start), the value (0-24) to set the Hour to
      Hour = 14
    • By kangawroon
      I've tried searching for this for 2 days now, but I can't seem to find it:
      - How do I make the food and drink drop slower on my server?
    • By Howlz123
      I love the Arma 3 epoch and the feel, it's such an amazing upgrade from Arma 2. My only issue is the vehicle lock times, I have a life, work and school as most other people do and cannot keep logging in every day to check on a vehicle I secured. I want to build a base but to do that I need to gather materials and store them temporarily in a car but the problem I had on previous servers was that the vehicles became unlocked after server restart or after about 30 minutes of not being used and all my stuff would get stolen. I miss the Arma 2 version where if you locked a car, no one could loot or steal it (unless they stole parts of the car or just blew it up, which is fair game in my opinion). Can someone please recommend a couple of servers that implement this script/version? I have a 4 man squad looking to really get into Arma 3, but this issue is hindering us. Thanks.
  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...