Sign in to follow this  

Improved time script

2 posts in this topic


I've modified ExileServer_system_weather_initialize.sqf and the Time class from Exile_Server\config.cpp

The goal was to be able to use a static date or a static time independently and also to allow time zone adjustments.

In the process I've removed useRealTime because it was redundant since useStaticTime is the opposite.

I've also integrated a parameter to set a time shift that can be used with real time to push the night a little later.

New Time Class : 

	class Time

		// Use a static server start time instead of the server UTC time.
		useStaticTime = 0;
		// Use a static server start date instead of the server UTC date.
		useStaticDate = 0;
		//Time Zone adjustment in hours. Will be applied regardless of previous settings.
		timeZone = -5;
		//Time shift adjustment in hours. Will be applied on to of the previous settings. Use it to delay night time.
		timeShift = -4;

		// time in ARMA FORMAT << CONFIG

		staticTime[] = {05,30};
		staticDate[] = {2039,06,24};

The new : ExileServer_system_weather_initialize.sqf

 * Exile Mod
 * © 2015 Exile Mod Team
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit
call ExileServer_system_weather_thread_weatherSimulation;
_useStaticTime = getNumber (configFile >> "CfgSettings" >> "Time" >> "useStaticTime");
_staticTime = getArray (configFile >> "CfgSettings" >> "Time" >> "staticTime");
_useStaticDate = getNumber (configFile >> "CfgSettings" >> "Time" >> "useStaticDate");
_staticDate = getArray (configFile >> "CfgSettings" >> "Time" >> "staticDate");
_timeZone = getNumber (configFile >> "CfgSettings" >> "Time" >> "timeZone");
_timeShift = getNumber (configFile >> "CfgSettings" >> "Time" >> "timeShift");
_dateTime = [];
_startTime = ExileServerStartTime;
_float = 0;

if(_useStaticDate isEqualTo 1)then
	_dateTime append _staticDate;
	_dateTime append (_startTime select [0,3]);

if(_useStaticTime isEqualTo 1)then
	_dateTime append _staticTime;
	_dateTime append (_startTime select [3,2]);

//Time ajustement
_dateTime set [3,((_dateTime select 3) + (_timeZone + _timeShift))];

setDate _dateTime;

_changetime = round(getNumber (configFile >> "CfgSettings" >> "Weather" >> "interval") * 60);
[_changetime, ExileServer_system_weather_thread_weatherSimulation, [], true] call ExileServer_system_thread_addTask;

I'm currently using the function overwrite to use this one.

Thank you

  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.