Modding Structure – DayZ

From Bohemia Interactive Community
Jump to navigation Jump to search

This page details the structure of DayZ mods as well as their configuration and presentation.


Mod structure

Mod is loaded using the -mod= launch parameter

-mod=C:\MyMods\TestMod

Typical mod folder downloaded from steam workshop will contain:

  • Addons folder, holds the mod's .pbo files
  • Keys folder, contains public .bikey used to sign the .pbo files (required for client-server signature verification)
  • meta.cpp file, holds workshop meta data (will be automatically created during mod publishing)
  • mod.cpp optional config file, holds information for mod presentation

dayz modstructure.png


PBO structure

The only required part of .pbo is config.cpp:

class CfgPatches		// required
{
	class TestMod
	{
		requiredAddons[]=
		{
			"DZ_Data",	// addon depedency
		};
	};
};

class CfgMods			// required in pbo's which add/modify scripts or inputs
{
	class TestMod
	{
		type = "mod";										// required
		inputs = "mods\testmod\inputs\my_new_inputs.xml";	// optional, when using custom inputs
		skeletonDefinitions = "mods\testmod\skeleton\skeletons.xml";	// optional, when using custom skeletons.anim.xml
		dependencies[]={"Game"};							// optional, when you need to set class dependency

		class defs
		{
			// optional: you can add custom imagesets like this
			class imageSets
			{
				files[]={"mods/testmod/gui/imagesets/mod1.imageset", "mods/testmod/gui/imagesets/mod2.imageset" };
			};

			// optional: you can add custom widget styles like this
			class widgetStyles
			{
				files[]={"mods/testmod/gui/looknfeel/mod1.styles", "mods/testmod/gui/looknfeel/mod2.styles"};
			};
			class engineScriptModule
			{
				value=""; // when value is empty, default entry function is used
				files[]={"mods/testmod/scripts/1_Core"}; // you can add any number of files or directories and they will be compiled together with original game module scripts
			};

			/*
			script module config classes are optional, define only what you want to mod
			class gameLibScriptModule
			{
				value="";
				files[]={"mods/testmod/scripts/2_GameLib"};
			};*/

			class gameScriptModule
			{
				value="CreateGameMod"; // when value is filled, default script module entry function name is overwritten by it
				files[]={"mods/testmod/scripts/3_Game"};
			};

			class worldScriptModule
			{
				value="";
				files[]={"mods/testmod/scripts/4_World"};
			};

			class missionScriptModule
			{
				value="";
				files[]={"mods/testmod/scripts/5_Mission"};
			};
		};
	};
};

The internal structure is largely up to the modders themselves, e.g. in case of script files, it doesn't matter where they are placed as long as they are in their respective script module and paths are set properly.


Mod presentation

Configured through mod.cpp in the mod root folder, used for mod presentation in the main menu of the game:

name = "Mod name"; 								// name
picture = "Mods/TestMod/modpic.tga";			// picture in expanded description
logoSmall = "Mods/TestMod/modlogosmall.tga";	// icon next to mod name when description is not expanded
logo = "Mods/TestMod/modlogo.tga";				// logo below game menu
logoOver = "Mods/TestMod/modlogohover.tga";		// on mouse hover over logo
tooltip = "tooltip";							// tool tip on mouse hover
overview = "Bestest mod"; 						// overview
action = "https://dayz.com/";					// link
author = "modguy";								// author
version = "1.5";								// version