Jump to content

Joelma's Time Control


Donnovan

Recommended Posts

  • 1 month later...
  • 1 month later...

Hello.

I keep getting kicked. Restriction# 0

Jestertriks (69.126.52.194:2304) 2eb8f50a1e3e4b9c2c672ee93c3bc088 - #0 "cad_pvar_send_owner" = <NULL-object>

I have added the battleeye filter as described in the list. I added this after yours !="cad_pvar_send_owner"

am I maybe adding it in the wrong location in publicvariable.txt?

tyvm

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...
On 8/27/2014 at 0:16 AM, Donnovan said:

If you like my work, please consider a donation:

 

btn_donate_LG.gif $USD

 

btn_donate_LG.gif $EURO

 

*** UPDATED THE FILE TIME_CONTROL.SQF IN 2014-10-09 13:00 ***

*** TIME_CONTROL.SQF WAS CHANGED, THE CHANGED PARTE HAVE ***

*** THE COMMENT "//LAST CHANGE WAS IN THIS SPAWN" ***

 

JOELMA'S TIME CONTROL SYSTEMA

 

Default configuration: A day of 2 hours.

- 60 minutes completely day time (08:00 - 16:00)

- 36 minutes of sunrise and sunfall (04:00 - 08:00, 16:00 - 20:00)

- 24 minutes of night (00:00 - 04:00, 20:00 - 24:00)

 

CLIENT SIDE: TIME_CONTROL.SQF

In your mission folder, create the folder custom if it does not exist.

Create inside the custom folder a txt file called time_control.sqf.

Put inside time_control.sqf the content bellow:

 

 


donn_sleep = 0.2;
donn_multi = 2;
drn_fnc_DynamicWeather_SetWeatherLocal = {};
0 setOvercast 0;
0 setFog 0.05;

if (!isDedicated) then {
	"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);};
	};
};

[] spawn {  //LAST CHANGE WAS IN THIS SPAWN
	private ["_tm","_tmLen"];
	_tm = diag_tickTime;
	waitUntil {!isNil "donn_speed"};
	while {true} do {
		sleep donn_sleep; 
		_tmLen = diag_TickTime - _tm;
		_tm = _tm + _tmLen;
		skipTime ((_tmLen*(donn_speed*donn_multi-1))/3600);
	};
};

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;
		};
	};
};

CLIENT SIDE: INIT.SQF

 

Step 1

On your mission folder, open the file init.sqf.

 

Inside it change this:

 

 


//Start Dynamic Weather
execVM "\z\addons\dayz_code\external\DynamicWeatherEffects.sqf";

To this:

 


//Start Dynamic Weather
//execVM "\z\addons\dayz_code\external\DynamicWeatherEffects.sqf";

Step 2

At the end of your init.sqf file, add this line:

 

 


call compile preprocessFileLineNumbers "custom\time_control.sqf";

SERVER SIDE: SERVER_FUNCTIONS.SQF

 

Now we need to modify files inside dayz_server.pbo.

 

At the end of the file init\server_functions.sqf add this code:

 

 

 


initialSend = false;
donn_server_timeSync = server_timeSync;
server_timeSync = {if (!initialSend) then {[] call donn_server_timeSync;}; initialSend = true;};
[] spawn {
	waitUntil {initialSend};
	while {true} do {
		_dayTime = dayTime;
		//========================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;};
		//=================================================================
		cad_pvar_server_date = [date, donn_speed];
		publicVariable "cad_pvar_server_date";
		sleep 30;
	};
};
"cad_pvar_send_owner" addPublicVariableEventHandler {
	cad_pvar_server_date = [date, donn_speed];
	owner (_this select 1) publicVariableClient "cad_pvar_server_date";
};

BATTLEYE FILTER:

 

On the BattlEye filter publicvariable.txt search for the line that start with 5 "" and add at the end of it an empty space and than !"cad_pvar_s".

 

My line is like that after the adition:

 

 

EXTRA:

To have a 3 hours day, change the line "donn_multi = 2;" in time_control.sqf:

 

 


donn_multi = 1;   -> 4 hours day
donn_multi = 4/3; -> 3 hours day
donn_multi = 2;   -> 2 hours day

Help Please,

I'm trying to get this working on 1061 

Simple instructions - Server will start with the script installed

I can log in no errors open map look at watch and ... the script is not running

Where to start?

Link to comment
Share on other sites

@Bricktop the "PVDZE_plr_SetDate" in the script seems   been changed in the 1.6 publicEH.sqf by

"dayzSetDate" addPublicVariableEventHandler {
		_newdate = _this select 1;
		_date = +(date); // [year, month, day, hour, minute].
		//diag_log ['Date & time received:', _newdate, 'Local date on this client:', _date];
		{
			if (_x != _newdate select _forEachIndex) exitWith {
				setDate _newdate;
				//diag_log ['Date has been reset. Local date on this client:', date];
			};
		} forEach _date;
	};

 

Link to comment
Share on other sites

  • 2 weeks later...

I have changed PVDZE_plr_SetDate to dayzSetDate in time_control.sqf,
and RPT says "
Error Undefined variable in expression: server_timeSync" in server_function.sqf,
so I changed
server_timeSync to sched_sync in server_function.sqf.
https://github.com/EpochModTeam/DayZ-Epoch/blob/master/Documents/1.0.6 Variable Name Changes.txt

RPT still says "Error Undefined variable in expression: sched_sync":huh:
it seems server_function.sqf is called before sched_sync.sqf is read.
(I'll try  with waitUntil {(!isNil "sched_sync")}; added before initialSend = false; on server_function.sqf)
I removed

Spoiler

initialSend = false; donn_server_timeSync = server_timeSync; server_timeSync = {if (!initialSend) then {[] call donn_server_timeSync;}; initialSend = true;};

and

Quote

waitUntil {initialSend};

from server_function.sqf modification, then this script seems to be working now...
 

please note, I haven't removed DynamicWeatherEffects.sqf as this script does not touch time.
Instead,  I have removed
drn_fnc_DynamicWeather_SetWeatherLocal = {}; from time_control.sqf
(I think this will make the start time can be defined in Hive.ini, and there will be weather change...)

 

now conclusion to make it work:

create MPMissions\DayZ_Epoch_11.Chernarus\Custom\time_control.sqf

Spoiler
donn_sleep = 0.2;
donn_multi = 2;
//drn_fnc_DynamicWeather_SetWeatherLocal = {};
//0 setOvercast 0;
//0 setFog 0.05;
if (!isDedicated) then {
 "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);};
 };
};
[] spawn {  //LAST CHANGE WAS IN THIS SPAWN
 private ["_tm","_tmLen"];
 _tm = diag_tickTime;
 waitUntil {!isNil "donn_speed"};
 while {true} do {
  sleep donn_sleep;
  _tmLen = diag_TickTime - _tm;
  _tm = _tm + _tmLen;
  skipTime ((_tmLen*(donn_speed*donn_multi-1))/3600);
 };
};
if (!isDedicated) then {
 [] spawn {
  for "_x" from 1 to 10 do {
   "infiSTAR_SetDate" addPublicVariableEventHandler {};
   "dayzSetDate" addPublicVariableEventHandler {};
   cad_pvar_send_owner = player;
   publicVariableServer "cad_pvar_send_owner";
   sleep 0.5;
  };
 };
};

At the end of MPMissions\DayZ_Epoch_11.Chernarus\init.sqf file, add this line:

call compile preprocessFileLineNumbers "custom\time_control.sqf";

 

in dayz_server\init\server_functions.sqf, add these at the very bottom, ( if you have some other scripts, then put below them):

Spoiler

//time ctrl
[] spawn {
 while {true} do {
  _dayTime = dayTime;
  //========================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;};
  //=================================================================
  cad_pvar_server_date = [date, donn_speed];
  publicVariable "cad_pvar_server_date";
  sleep 30;
 };
};
"cad_pvar_send_owner" addPublicVariableEventHandler {
 cad_pvar_server_date = [date, donn_speed];
 owner (_this select 1) publicVariableClient "cad_pvar_server_date";
};

and put something mentioned at original post into battleyefilter

 

 

Link to comment
Share on other sites

  • 2 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...