Custom Ingame Server Time: Difference between revisions
Jump to navigation
Jump to search
Created page with "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 s..." |
[wiki:wiki-operator] Fixes from the review of the rewording: claims, example addresses, names and wording (approved by Ryan, Nov 19) |
||
| (7 intermediate revisions by 3 users not shown) | |||
| 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 script on the server, added to your map's init.c.}} | |||
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> | <li>Stop the server by clicking STOP on the Game Server page in the Command Center.</li> | ||
<li>Log | <li>Log in with an FTP program (FileZilla). How to connect: [[FTP Access|FTP Access]].</li> | ||
<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 steps too.</li> | ||
<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> | <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 | <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 15: | Line 16: | ||
int setStopHour = 16; | int setStopHour = 16; | ||
</pre> | </pre> | ||
<li>To | <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> | <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> | <li>Scroll down to right after <b>override void StartingEquipSetup(PlayerBase player, bool clothesChosen)</b> inside <b>class CustomMission: MissionServer</b>.</li> | ||
<li> | <li>Add this code there:</li> | ||
<pre> | <pre> | ||
| Line 37: | Line 38: | ||
currentPlayer.OnTick(); | currentPlayer.OnTick(); | ||
m_currentPlayer++; | m_currentPlayer++; | ||
} | } | ||
| Line 55: | Line 55: | ||
</pre> | </pre> | ||
</ol> | </ol> | ||
[https://www.survivalservers.com/services/game_servers/dayz/ Rent a DayZ server] from Survival Servers with instant setup. | |||
Latest revision as of 12:08, 19 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
- Stop the server by clicking STOP on the Game Server page in the Command Center.
- Log in with an FTP program (FileZilla). How to connect: FTP Access.
- 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.
- Download Capps' Custom DayZ SA Time: get the "Scripts" folder from GitHub.
- Extract the "Scripts" folder into your MPMissions\dayzOffline.chernarusplus folder.
- Open your Init.c file
- At the top of the Init.c file, add these lines right before void main():
- To set the hours, change setStartHour and setStopHour. 0 is 12:00am and 23 is 11:00pm.
- At the very bottom of void main(), add this line:
- Scroll down to right after override void StartingEquipSetup(PlayerBase player, bool clothesChosen) inside class CustomMission: MissionServer.
- Add this code there:
#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;
}
}
Rent a DayZ server from Survival Servers with instant setup.