Custom Ingame Server Time: Difference between revisions

From Survival Servers
Jump to navigation Jump to search
[wiki:wiki-operator] Add the Badlands mission folder, dayzOffline.nasdara (Ryan yes 10/27)
[wiki:wiki-operator] Reworded to the house writing rules; facts that were wrong today corrected (approved by Ryan, Nov 17)
Line 1: Line 1:
{{#seo:|title=DayZ Custom Server Time: Keep Your Server Day or Night|description=Keep your DayZ server's in-game clock between a start hour and a stop hour with a small server-side script added to your map's init.c.}}
{{#seo:|title=DayZ Custom Server Time: Keep Your Server Day or Night|description=Keep your DayZ server's in-game clock between a start hour and a stop hour with a small script on the server, added to your map's init.c.}}
With the release of DayZ Standalone there have been some requests out there to enable server owners to keep the time of day on their server set to certain point. For example some may want their server to always remain in daylight and others might want eternal darkness.
You can keep the time of day on your DayZ server in a set range of hours. Some owners want daylight all the time, and others want it always dark.


<h1>Installation</h1>
<h1>Installation</h1>
<ol>
<ol>
   <li>Bring down the server by hitting STOP on your server's page in the Command Center</li>
   <li>Stop the server by clicking STOP on the Game Server page in the Command Center.</li>
   <li>Log into your FTP client. (Info here for [[FTP Access|FTP]])</li>
   <li>Log in with an FTP program (FileZilla). How to connect: [[FTP Access|FTP Access]].</li>
   <li>Head into the following directory: <b>/MPmissions/dayzOffline.chernarusplus</b> (on Livonia it is <b>dayzOffline.enoch</b>, on Frostline <b>dayzOffline.sakhal</b> and on Badlands <b>dayzOffline.nasdara</b>; use your map's folder name in the steps&nbsp;below&nbsp;too)</li>
   <li>Open the <b>/MPmissions/dayzOffline.chernarusplus</b> folder. On Livonia it's <b>dayzOffline.enoch</b>, on Frostline <b>dayzOffline.sakhal</b> and on Badlands <b>dayzOffline.nasdara</b>. Use your map's folder name in the later&nbsp;steps&nbsp;too.</li>
   <li>Next download a copy of the Capps' Custom DayZ SA Time. You can get a copy of the <b>"Scripts"</b> folder from [https://github.com/Capps0611/Custom-DayZ-Standalone-Time/releases/download/v0.0.2/Scripts.zip GitHub]</li>
   <li>Download Capps' Custom DayZ SA Time: get the <b>"Scripts"</b> folder from [https://github.com/Capps0611/Custom-DayZ-Standalone-Time/releases/download/v0.0.2/Scripts.zip GitHub].</li>
   <li>Extract the <b>"Scripts"</b> folder into your <b>MPMissions\dayzOffline.chernarusplus directory</b></li>
   <li>Extract the <b>"Scripts"</b> folder into your <b>MPMissions\dayzOffline.chernarusplus</b> folder.</li>
   <li>Open your Init.c file</li>
   <li>Open your Init.c file</li>
   <li>At the top of the Init.c file add directly above <b>void main()</b> </li>
   <li>At the top of the Init.c file, add these lines right before <b>void main()</b>:</li>
   <pre>
   <pre>
   #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\cappsTimeLoop.c"   
   #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\cappsTimeLoop.c"   
Line 16: Line 16:
   int setStopHour = 16;  
   int setStopHour = 16;  
  </pre>
  </pre>
  <li>To configure the script you will want to adjust the <b>setStartHour</b> and <b>setStopHour</b>. To get an idea, <b>0 is 12:00am and 23 is 11:00pm</b></li>
  <li>To set the hours, change <b>setStartHour</b> and <b>setStopHour</b>. <b>0 is 12:00am and 23 is 11:00pm</b>.</li>
  <li>Next inside of the <b>void main()</b> at the very bottom, you will want to add</li>
  <li>At the very bottom of <b>void main()</b>, add this line:</li>
   <pre>
   <pre>
   cappsTimeLoop(setStartHour,setStopHour,true);
   cappsTimeLoop(setStartHour,setStopHour,true);
   </pre>
   </pre>
  <li>Next scroll down to just underneath <b>override void StartingEquipSetup(PlayerBase player, bool clothesChosen)</b> inside of the <b>class CustomMission: MissionServer:</b></li>
  <li>Scroll down to right after <b>override void StartingEquipSetup(PlayerBase player, bool clothesChosen)</b> inside <b>class CustomMission: MissionServer:</b>.</li>
  <li>You are going to add the following code:</li>
  <li>Add this code there:</li>
   
   
  <pre>
  <pre>
Line 56: Line 56:
</ol>
</ol>


You can [https://www.survivalservers.com/services/game_servers/dayz/ host your own DayZ server] with Survival Servers with instant setup.
[https://www.survivalservers.com/services/game_servers/dayz/ Rent a DayZ server] from Survival Servers with instant setup.

Revision as of 08:41, 17 November 2026

You can keep the time of day on your DayZ server in a set range of hours. Some owners want daylight all the time, and others want it always dark.

Installation

  1. Stop the server by clicking STOP on the Game Server page in the Command Center.
  2. Log in with an FTP program (FileZilla). How to connect: FTP Access.
  3. Open the /MPmissions/dayzOffline.chernarusplus folder. On Livonia it's dayzOffline.enoch, on Frostline dayzOffline.sakhal and on Badlands dayzOffline.nasdara. Use your map's folder name in the later steps too.
  4. Download Capps' Custom DayZ SA Time: get the "Scripts" folder from GitHub.
  5. Extract the "Scripts" folder into your MPMissions\dayzOffline.chernarusplus folder.
  6. Open your Init.c file
  7. At the top of the Init.c file, add these lines right before void main():
  8.    #include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\cappsTimeLoop.c"  
       int setStartHour = 10;   
       int setStopHour = 16; 
     
  9. To set the hours, change setStartHour and setStopHour. 0 is 12:00am and 23 is 11:00pm.
  10. At the very bottom of void main(), add this line:
  11.   cappsTimeLoop(setStartHour,setStopHour,true);
      
  12. Scroll down to right after override void StartingEquipSetup(PlayerBase player, bool clothesChosen) inside class CustomMission: MissionServer:.
  13. Add this code there:
  14.  override void TickScheduler (float timeSplice)
    	{
    		GetGame().GetWorld().GetPlayerList(m_Players);
    		if( m_Players.Count() == 0 ) return;
    		for(int i = 0; i < SCHEDULER_PLAYERS_PER_TICK; i++)
    		{
    	     if(m_currentPlayer >= m_Players.Count() )
    	     {
    	        m_currentPlayer = 0;
    	     }
    	     PlayerBase currentPlayer = PlayerBase.Cast(m_Players.Get(m_currentPlayer));
    	     currentPlayer.OnTick();
    	     m_currentPlayer++;
    
    	   }
    		//Ignore above code that is required to keep food,drink and other survival elements working
    
    		int currentTime = GetGame().GetTime() * 0.001;
    		static int newTime = 0;
    		int timeDelay = 180;
    		if (currentTime >= newTime + timeDelay)
    		{
    			//GetGame().ChatPlayer(1,"3 minute check on reset!");//for debug pruposes
    			cappsTimeLoop(setStartHour,setStopHour,false);
    			//GetGame().ChatPlayer(1,"Passed the time switch call");//for debug pruposes
    			newTime = currentTime;
    		}
    	}
    

Rent a DayZ server from Survival Servers with instant setup.