Jump to content
Sign in to follow this  
soundblaster

Make a day be 6 hours instead of 24

Recommended Posts

How do I make a trigger or something that is compartible with multi player to accelerate time that 1 day is 6 hours.

Thanks,

Soundblaster

Share this post


Link to post
Share on other sites
something like this:

GAM-TimeXleration

"signature keys are included but a multiplayer environment as not been tested, and this is just that type of think that is prone to break on this regard"

Also isn't it possible to make a script instead of an addon?

Share this post


Link to post
Share on other sites

Not tested but something like this:

while {true} do {skipTime 0.00026;sleep 1;};

Share this post


Link to post
Share on other sites

Roughly something like this in the init.sqf:

#define TIME_COMPRESSION 4
#define PV_VAR "PV_Date"

[] spawn {
if (isServer) then {

	PV_VAR spawn {
		_nextBroadcast = time + 60;
		while {true} do {
			//Skip seconds every second
			skipTime ((TIME_COMPRESSION - 1) / 3600);
			//Send new time to clients
			if (time > _nextBroadcast) then {
				_nextBroadcast = time + 60;
				missionNameSpace setVariable [_this, date];
				publicVariable _this;
			};
			sleep 1;
		};
	};	

} else {

	waitUntil {!isNil PV_VAR};
	setDate (missionNameSpace getVariable PV_VAR);

	[] spawn {
		sleep 1.0;
		skipTime ((TIME_COMPRESSION - 1) / 3600);
	};

	PV_VAR addPublicVariableEventHandler {setDate (_this select 1);};

};
};

Every second every machine skips 4 seconds instead of only 1 giving you a 6 hour day. Also about every minute the time is synchronized for all to the server time so they the times don't stray too far.

Edited by Muzzleflash

Share this post


Link to post
Share on other sites
Roughly something like this in the init.sqf:

#define TIME_COMPRESSION 4
#define PV_VAR "PV_Date"

[] spawn {
if (isServer) then {

	PV_VAR spawn {
		_nextBroadcast = time + 60;
		while {true} do {
			//Skip seconds every second
			skipTime ((TIME_COMPRESSION - 1) / 3600);
			//Send new time to clients
			if (time > _nextBroadcast) then {
				_nextBroadcast = time + 60;
				missionNameSpace setVariable [_this, date];
				publicVariable _this;
			};
			sleep 1;
		};
	};	

} else {

	waitUntil {!isNil PV_VAR};
	setDate (missionNameSpace getVariable PV_VAR);

	[] spawn {
		sleep 1.0;
		skipTime ((TIME_COMPRESSION - 1) / 3600);
	};

	PV_VAR addPublicVariableEventHandler {setDate (_this select 1);};

};
};

Every second every machine skips 4 seconds instead of only 1 giving you a 6 hour day. Also about every minute the time is synchronized for all to the server time so they the times don't stray too far.

Does that work on multiplayer cause it worked in mission editor but now my my server it doesn't.

Share this post


Link to post
Share on other sites
Does that work on multiplayer cause it worked in mission editor but now my my server it doesn't.

It should unless I made a typo. However, im unable to play Arma at the moment so haven't tested it.

Share this post


Link to post
Share on other sites
It should unless I made a typo. However, im unable to play Arma at the moment so haven't tested it.

Ye, I tried to recheck it and it doesn't work on my multiplayer dedicated server however it does work on a clientside server creation any idea's?

Good news it works now.

Edited by soundblaster

Share this post


Link to post
Share on other sites

Is it possible the fast time can make the client/server lag?

Fixed thanks all!

Edited by soundblaster

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  

×