Beginner’s Guide to DayZ Mods development (2024)

This guide will help you set up your first mod and work with it. You will learn how to:

  • Set up your environment for working on a mod
  • Configure and use DayZ modding tools
  • Pack your very first mod
  • Test and debug your mod in the game
  • Make changes in the mod without a need to restart the game

Recently I decided to try DayZ modding tools since their Enforce Script is really tempting to use. Bohemia Interactive Community Wiki provides some basic guides for getting started with mods for the game. Sadly the information provided on the site is full of gaps and spread across different pages. Often they mention another page as an optional read, while in fact, it is mandatory; often they assume you have a knowledge of Arma 3 mods, or simply they miss important information which cannot be found anywhere on the web. Such a case for me was with the file patching feature and it has driven me to find the answers and write this text.

I researched the topic of setting up a modding environment and since part of it was impossible to find on the web I decided to gather them in this place. It shows how to set up the mod development environment from zero to hero. I use wiki examples or explanations wherever possible to stay as close to their pages as possible and help you with moving forward later.

I am not considering myself a mod coder (yet). Especially for DayZ or Arma 3. I am just a humble developer. I had only a little experience with Arma 3 mods while helping Dynamic Frontline mod team in their work. In no way I consider myself an expert on the topic of making mods. But I am still a code developer and as such, I feel attracted to the new Enforce Script syntax, which is light years ahead of the previously used by Bohemia Interactive SQF. It is quite easy to use for anyone familiar with C++ or C# and the such. This guide is mainly for coders who also feel attracted by Enforce Script to start making their own mods, but experienced mods creators from other games may find it useful.

Before starting, you will need little preparation:

  • Installed DayZ and DayZ Tools. Later you may want to use DayZ Server as well. You will find all of them in your Steam Library after buying the game.
  • Also, you need to run DayZ at least once to accept all EULAs as the development tools will throw errors without it and information, what caused the issue (true story)
  • Extra 15–40GB of storage space on your computer for development depending on how far you will go with copying data files
  • Something to watch, eat or drink during the copying process — it may take time.

Note: this is described on the Community Wiki, though I see the authors assumed you know what P drive is. I didn’t at first. It is not explained there so I will in here.

The P:\ drive is a virtual drive on your computer that is mapped from the target folder with necessary data files for modding. Arma 3 modders are familiar with it, but it may be new to you. It is not necessary to use it when you start as you may always point to the files somewhere in your file system. But for the simplicity of this guide, I will use to reference files in the P:\ drive in the examples.

Say you will keep your data files in C:\modding\DayZ\ - DayZ tools let you set up this dir to be mapped to P:\. So any files in the source directory will be available as well under P:\. Easy, right? Let's set it up.

Beginner’s Guide to DayZ Mods development (2)
  1. Run DayZ Tools to set the P drive.
  2. Open Settings from the menu and uncheck “Default” for the Path to the Project Drive (hence P).
  3. Provide a path to your selected directory and hit Apply.
  4. Now go to the Tools menu and select Extract Game Data.

This process will take a few minutes. For regular HDD it may take even 20 minutes, so relax, grab some food or drink and wait patiently.

What does it do? It will extract source scripts from the DayZ game and copy them with some other files for working on projects. I think they may not be required for modding, but they will be useful, as later in the Script Editor, you can open the source files and see the actual code for reuse — the API. Mind that there’s no official docs page for the standard available API, so you may need to go into the source files a lot in your work.

Once your files are copied, from Tools select Mount Drive P. You will have it mounted next to the other drives in My Computer.

Note: workbench setup is marked as optional in the wiki, but developing mods without it can be really time-consuming without automatic suggestions. And even though it does not support auto indentations and formatting yet, I would recommend using it for coding and especially debugging.

  1. While DayZ Tools are open, hit the Workbench button. It will start the Enfusion workbench editor. Initialization may take some time.
  2. In the main window select Workbench → Options dialog box.
  3. Under the Source data directory set P:\

This will point to your extracted files as the place to look for the data.

As noted in the Wiki, you can now create your first mod. They called it: FirstMod. As a developer, I thought Workbench is able to create files for the project. I wasn’t able to find an option for that. But it can still open .c files if you just drag and drop them into it.

  1. Start the Script Editor. It is in the Workbench under the Editors menu.
  2. Note that on the left in the Projects window you have sources of the standard DayZ scripts. It will be useful on your journey later.
  3. In the Windows Explorer in the P:\ directory create a directory called FirstMod.
  4. Inside the directory create a file config.cpp - we will get back to it later.
  5. Also, next to config.cpp create a new directory: WorldScripts - this will be the place for your script
  6. Inside WorldScripts create a new file called MyScript.c.
  7. Now drag and drop both new files into the Script Editor.
  8. For clearance, we will use the mod code from the wiki. Into the MyScript.c file put:
modded class PlayerBase // modded keyword for modding existing class
{
override void OnJumpStart() // overriding existing function
{
super.OnJumpStart(); // call the original jump function so we don't break stuff
Print("My first mod, yay!"); // our modded print
}
}

Similarly, into the config.cpp file paste:

class CfgPatches
{
class FirstMod
{
requiredAddons[]=
{
// ""
};
}
}
class CfgMods
{
class FirstMod
{
type = "mod";

class defs
{
class worldScriptModule
{
value = "";
files[] = {"FirstMod/WorldScripts"};
}
}
}
}

The mod is ready. Now we will build and pack it.

pbo is the format for the script files packed together. Now, “packed” is not necessarily a good naming, because Bohemia tends to call the final mod also packed, while such mods do not only consist of the pbo files. So you should be aware of that. Later you will see why.

  1. For now, open DayZ Tools again and select the Addon Builder button. It will start another app for building pbos.
  2. In the source directory input provide: P:\FirstMod.
  3. The destination can be anything, as long as you know the path and remember it. Let’s follow the wiki suggestion and call it P:\PackedPbos.
  4. The wiki also suggests to set up the Path to project folder in the options. At first, I didn’t and it worked anyway, but it may be wise to do so.
  5. Pack the mod and you will have a ready to use pbo file as a result. But this is not a mod ready to use yet.
  6. Create a directory P:\FirstModPacked.
  7. Inside put an empty mod.cpp file and a directory called Addons.
  8. Copy your pbo file from P:\PackedPbos to the Addons directory.

The wiki refers to the mod structure page, but you need to read it in order to know, how the mod should be made. Long story short: you need to provide at least mod.cpp file with some contents:

name = "First mod"; // name
picture = ""; // picture in expanded description
logoSmall = ""; // icon next to mod name when description is not expanded
logo = ""; // logo below game menu
logoOver = ""; // on mouse hover over logo
tooltip = "Some tooltip?"; // tool tip on mouse hover
overview = "Some first mod overview"; // overview
action = "https://dayz.com/"; // link
author = "ivellios"; // author
version = "1.0"; // version

Now your mod is ready to use in the game.

Now, to test the mod it is best to have a lightweight simple mission for that. Arma 3 players who were having fun with its mission editor, know well how that works. But if you are new to the BI products, you need to know that you should create a specific directory. Let’s do it in our P drive.

  1. Create a directory P:\singleplayer.ChernarusPlus — the singleplayer is the name of the mission. The name after the dot is the name of the map that will be used for the mission.
  2. In that directory create a new file called init.c — this is the file that will be called on the mission start. Inside paste the code proposed on the wiki:
class CustomMission: MissionGameplay
{
void CustomMission()
{
}
};
Mission CreateCustomMission(string path)
{
return new CustomMission();
}
void main()
{
// Create player
PlayerBase player = PlayerBase.Cast( ( GetGame().CreatePlayer( NULL, "SurvivorF_Linda", "2200 10 2200", 0, "NONE") ) );
// Set your gear
player.CreateInInventory("TShirt_Black");
// Select player
GetGame().SelectPlayer(NULL, player);
}

That’s all we need. The mission is ready.

Wiki mentions that you can use Script Editor to see the output printed when the character will jump (as our mod script does). If you go to the separate wiki page on workbench script debugging, you will see that you need to run Workbench by providing the used mod path, so it can be debugged. Let’s do it now.

  1. Open your command line (cmd or power shell — whichever you like more)
  2. Go to the directory, where your DayZ Tools are installed (wherever your steamapps/common/DayZ Tools/Bin/Workbench/workbenchApp.exe is - as a Steam user you should be already familiar with it)
  3. Let’s run workbench from here (mind having it closed from the previous run):
.\workbenchApp.exe -mod=P:\FirstModPacked

So you are pointing to the packed mod that contains mod.cpp file and pbo file in the Addons directory.

This will start the workbench application. When you go into the Script Editor, you can see that in the Project window under the World('scripts/4_World') there is your MyScript.c file. It was extracted from the pbo. That's cool because it will allow you to put breakpoints for debugging.

  1. Open the file and place the breakpoint by clicking on the “6” number of the 6th line in the code.
  2. It will show a red dot. This is the breakpoint. The script will pause its execution when it gets here in the runtime. You will see that in a few minutes.
Beginner’s Guide to DayZ Mods development (3)

Now let’s run the game with the mod.

  1. Again, open the command line
  2. Go to the game directory. It should be something like: steamapps/common/DayZ/— where is a file called DayZDiag_x64.exe.
  3. We will use it. Run the command:
.\DayZDiag_x64.exe -mod=P:\FirstModPacked -mission=P:\singleplayer.ChernarusPlus

This will start a game (most likely in the window mode) with your mod and simple mission. During the loading process in the bottom right corner of your screen, you should see a notification that the game has connected to the workbench. That means you can debug the script.

  1. Once it is loaded, hit space to jump.
  2. The game should freeze.
  3. Now you can see in the Script Editor that the red dot has a yellow arrow that points to the location, where the breakpoint was caught.
  4. To resume hit F5 or Debug→Run from the menu.
  5. In the Output window of Script Editor, you should see the printed string.

Congrats! You have your mod working.

At this point, one can think that from now on it’s an easy ride. Try changing the string in the print function, save the file and jump in the game again. See? The text didn’t change. Because the mod is packed, its pbo’s source is used for the mission and anything you change in the editor, will not affect the game. If you want it to be updated, you would have to close both: the game and the editor. Rebuild the pbo and copy it into the packed directory. Then start the game and editor again.

So that sucks! We want to develop fast and be able to check results in the game at the same time. Not waste our time to rebuild files all the time.

There’s a solution though. In order to achieve this we need to use file patching (-filePatching) option.

The wiki page provides some information on file patching, but it does not work if you only follow the provided rules. In fact, it is currently not possible to find an answer on the web on how to make this work. But now I will give you my solution on this, as after hours of trying different options, finally, I was able to find the right setup.

First of all, we will need to have our mod source code in the game directory. This is in the: steamapps/common/DayZ/. The easiest way to achieve this is to make a junction link via the command line. Since the P drive is not always mounted, we will not use it. Instead, we will use the original path of the FirstMod directory.

Say we have our data files in C:\modding\DayZ\ as I have proposed before. So our sources are now under: C:\modding\DayZ\FirstMod.

  1. In the command line, go to the DayZ game directory
  2. Run the command:
mklink /J FirstMod C:\modding\DayZ\FirstMod

Note: this will not work in Power Shell. If you are using it, simply change the directory in it to the C:\modding\DayZ\ and then run start cmd which will open cmd in this directory and you can run mklink command now.

With file patching DayZ allows you to use the source code of your script instead of the pbo’s ones. But it will look for the source code in its game directory only. Also, we need to provide the packed mod to the game as a skeleton for the loaded mod. In fact, first, the packed mod will be loaded, then its files will be overridden by the source code script files.

We need to link to the directory with the source code because while DayZ will use code from its game directory, at the same time, Workbench will only see the source code in the P drive. Changing the file in one location will result in a change in the other one as in fact, this is the same file for both: game and the editor.

To run the game with file patching you need to run the command:

.\DayZDiag_x64.exe -mod=P:\FirstModPacked -mission=P:\singleplayer.ChernarusPlus -filePatching

Now when you jump, you will see that the very same text appears as previously.

  1. Change it in the source code now and save the file
  2. Go to the menu Debug and select Recompile File on Host or simply hit F7.

This will update the game with a newly compiled version of the script. When you hit space again, the text will be changed.

Congratulations! From now on, you are free to develop your mode interactively.

Wiki page on file patching gives a warning on using prefixes. This functionality is well known to Arma 3 mods developers and prefixes can be provided in the Addon Builder as an option when compiling mod to the pbo file. In theory, we should put our mod source code (FirstMod directory) into the game directory wrapped with the prefix directory to better organize multiple mods — especially 3rd party ones. This is a good pattern, but from my recent experience and multiple tries, it looks like this functionality does not work for DayZ. I didn't dig deeper into this topic as my focus was to make this environment run with the simple mod for now. But perhaps it requires further research to make our mods clean and free of any conflicts with the others.

As you can see, some information on building the mod is scattered across the wiki. Sometimes, some answers can be found on the web, since the wiki lacks details. File patching is the only thing that had no real answers found neither on the wiki; nor on the web forums. This guide helps you to use it properly.

We have started a singleplayer game. I do not cover running mod for servers along with a client as this is a far more advanced topic and I haven’t been exploring it yet. While working on mods though it may be important for you to also do some debugging that way with a standalone DayZ Server.

Also worth noting is a GitHub project DayZ-BoutDangTimeTools by joetex. It helps you to set up the whole environment by copying the game into the P drive — along with execs. That way you do not interfere with your regular play while developing the mods. I tried this option and looks like the batch scripts provided by joetex are working fine. He also provides extra plugins for the Script Editor, so you have handy shortcuts for starting/stopping/restarting the server and the client.

From my experience, this blueprint is really load-heavy on the machine. The mission it uses is really extensive compared to the simple one provided in the wiki. It will give you a real-life server/client environment but may block you from testing at some point as well. I had issues with connecting to my localhost server as loading took so long it resulted in timeouts.

Hope you enjoyed this guide and successfully ran your very first DayZ mod. Let me know how did it go in the comments. Good luck on your modding journey!

Your next step is the wiki page on Enforce Script Syntax.

Kudos to Stack (Overfl0) for helping me with research on the topic and reverse engineering how the file patching actually should be used.

Beginner’s Guide to DayZ Mods development (2024)
Top Articles
Latest Posts
Article information

Author: Frankie Dare

Last Updated:

Views: 5830

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Frankie Dare

Birthday: 2000-01-27

Address: Suite 313 45115 Caridad Freeway, Port Barabaraville, MS 66713

Phone: +3769542039359

Job: Sales Manager

Hobby: Baton twirling, Stand-up comedy, Leather crafting, Rugby, tabletop games, Jigsaw puzzles, Air sports

Introduction: My name is Frankie Dare, I am a funny, beautiful, proud, fair, pleasant, cheerful, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.