silentfart

day/night cycle

15 posts in this topic

hi guys im fairly new to all this but have some experience i now have a server with gtxgaming ive been trying to get the day night cycle sorted i have tried the methods already posted here they dont seem to work , if theres any one who could help it would be appreciated.

Share this post


Link to post
Share on other sites

something like a 2hrs day and 1hr night going back to day time with a 3hrs server restart??
 use this than ( it will override  the standard exile time):

Name of script = time.sqf

if (!isServer) exitWith {};

//SET DATE
_startingdate = [2039,03,17, 3+floor (random 8), 00]; //2039 = Year, 07 = Month, 3+floor //(random 8) = random time between 3am and 10am, 00 = minite
setdate _startingdate;

//If you dont want a random start time change 3+floor (random 8) to a solid 24 hour time integer, like 10 for 10am

while {true} do
{
    if (daytime >= 19 || daytime < 5) then   // Adjust these for when you want "night time"
    {
        setTimeMultiplier 15      // adjust this value for slower or faster night cycle
    }
    else
    {
        setTimeMultiplier 5      // adjust this value for slower or faster day cycle  
    };

    uiSleep 60;
};

Share this post


Link to post
Share on other sites
Advertisement

I am using the following script to do day and night, which works, but what i really would like is for it to be day the first 2 1/2 hours and last 30 minutes be night.. or 2 hours day 1 hour night. Any suggestions to get that to happen?

Spoiler

if (!isServer) exitWith {};

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

    uiSleep 30;
};

 

Share this post


Link to post
Share on other sites
4 hours ago, geekm0nkey said:

2 1/2 hours and last 30 minutes be night.. or 2 hours day 1 hour night.

Depending on how you like the night/dark hit into the server, you don't need a script for that.

@ExileServer\addons\exile_server_config\config.cpp
class Time
	{
		// Uses Dedicated Server time as ingame Time
		useRealTime = 0;

		// Will overide RealTime
		useStaticTime = 1;

		// time in ARMA FORMAT << CONFIG
		// https://community.bistudio.com/wiki/setDate

		staticTime[] = {2039,10,24,17,30};
	};

Just as an example, if you have 3h restart periode and want a smooth transition from day to night, ending in pitchblack when server is restarting. Set the ingame servertime to about 1700-1730.

In arma the sun start to sets at ~ 1900. (Don't use any script to accelerate time here).

 

 

If you like to have  it pitchblack, without smoothtransition/sunset - still set the time to around 1700 but use your script to accelerate night times:

if (!isServer) exitWith {};

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

    uiSleep 30;
};

You might have to tweek the first multiplier a bit, if it's going hit night time to quickly for your likings.

 

Edited by WURSTKETTE

Share this post


Link to post
Share on other sites

Thank you.. your first option is what i think i need. Could you explain what this line does. I know its year, month day, others are time?

staticTime[] = {2039,10,24,17,30};

Share this post


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

Thank you.. your first option is what i think i need. Could you explain what this line does. I know its year, month day, others are time?


staticTime[] = {2039,10,24,17,30};

Yip, 17,30 = 5.30pm

JEmJqKA.png

Edited by WURSTKETTE

Share this post


Link to post
Share on other sites

Where do I put this section of code? Has me a bit confused. also is the multiplier number larger for faster and lower for closer to real time?

if (!isServer) exitWith {};

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

    uiSleep 30;
};

 

Share this post


Link to post
Share on other sites
On 6.12.2017 at 10:08 PM, geekm0nkey said:

What static time would get me about 2 hours of daylight, follow by pitch black before restart? 1700?

Yeh, start trying with 17,00 but you need to accelerate the nighttime then, to get rid of sunset/transition to night.

The higher the multiplier, the faster the time.

you either can put that code into init.sqf or create a file called timeacc.sqf, drop it into missionfile and put following line into init.sqf:

[] execVM "timeacc.sqf";

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.