Custom Ingame Server Time: Difference between revisions
Jump to navigation
Jump to search
m Add link to the game service page (internal linking sweep) |
[wiki:ss-claude-11372] Fixes: wrong or outdated steps, labels and facts corrected, current pictures, dead links fixed, search title and description |
||
| 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.}} | |||
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. So with that, This page will help you install a small server side script to do just that! Lets dive right into it! | 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. So with that, This page will help you install a small server side script to do just that! Lets dive right into it! | ||
<h1>Installation</h1> | <h1>Installation</h1> | ||
<ol> | <ol> | ||
<li>Bring down the server by hitting | <li>Bring down the server by hitting STOP on your server's page in the Command Center</li> | ||
<li>Log into your FTP client. (Info here for [ | <li>Log into your FTP client. (Info here for [[FTP Access|FTP]])</li> | ||
<li>Head into the following directory: <b>/MPmissions/dayzOffline.chernarusplus</b></li> | <li>Head into the following directory: <b>/MPmissions/dayzOffline.chernarusplus</b> (on Livonia it is <b>dayzOffline.enoch</b> and on Frostline <b>dayzOffline.sakhal</b>; use your map's folder name in the steps below 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>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> | <li>Extract the <b>"Scripts"</b> folder into your <b>MPMissions\dayzOffline.chernarusplus directory</b></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 directly above <b>void main()</b> </li> | ||
| Line 15: | Line 16: | ||
int setStopHour = 16; | int setStopHour = 16; | ||
</pre> | </pre> | ||
<li>To configure the script you will want to adjust the <b> | <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>Next inside of the <b>void main()</b> at the very bottom, you will want to add</li> | <li>Next inside of the <b>void main()</b> at the very bottom, you will want to add</li> | ||
<pre> | <pre> | ||
cappsTimeLoop(setStartHour,setStopHour,true); | cappsTimeLoop(setStartHour,setStopHour,true); | ||
</pre> | </pre> | ||
<li>Next | <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>You are going to add the following code:</li> | <li>You are going to add the following code:</li> | ||
Revision as of 20:59, 14 October 2026
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. So with that, This page will help you install a small server side script to do just that! Lets dive right into it!
Installation
- Bring down the server by hitting STOP on your server's page in the Command Center
- Log into your FTP client. (Info here for FTP)
- Head into the following directory: /MPmissions/dayzOffline.chernarusplus (on Livonia it is dayzOffline.enoch and on Frostline dayzOffline.sakhal; use your map's folder name in the steps below too)
- Next download a copy of the Capps' Custom DayZ SA Time. You can get a copy of the "Scripts" folder from GitHub
- Extract the "Scripts" folder into your MPMissions\dayzOffline.chernarusplus directory
- Open your Init.c file
- At the top of the Init.c file add directly above void main()
- To configure the script you will want to adjust the setStartHour and setStopHour. To get an idea, 0 is 12:00am and 23 is 11:00pm
- Next inside of the void main() at the very bottom, you will want to add
- Next scroll down to just underneath override void StartingEquipSetup(PlayerBase player, bool clothesChosen) inside of the class CustomMission: MissionServer:
- You are going to add the following code:
#include "$CurrentDir:\\mpmissions\\dayzOffline.chernarusplus\\Scripts\\cappsTimeLoop.c" int setStartHour = 10; int setStopHour = 16;
cappsTimeLoop(setStartHour,setStopHour,true);
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;
}
}
You can host your own DayZ server with Survival Servers with instant setup.