Config (CfgConvert)
A DayZ mod declares what it adds to the game in a config (config.cpp): each item, weapon
or vehicle is a class with properties, and most classes inherit from a class of the game. This
page does two things. Convert & check finds the mistakes of your config.cpp and converts
it to config.bin, the binary form the game loads, or turns a config.bin back into readable
text; it replaces CfgConvert of DayZ Tools. Game config browser shows every class of the
game with its inherited values, so you can see what a class is made of and start your own from
it. The check also warns when your file redefines a class of the game (class WoodenCrate { … }
in CfgVehicles): that changes the game's item on every server that loads the mod, so inherit a
new class instead unless you mean it. The browser, the requiredAddons check and that warning
need the DayZ folder set in Settings; checking syntax and converting need nothing.
The screen
- Tabs: Convert & check and Game config browser.
- Convert & check
- Input: a
config.cpp,.hpp,.h,.rvmatorconfig.bin. - Convert to: Binary (.bin) or Text (.cpp). It follows the input's extension.
- Output: where the result is written. Filled with the input's name and the other extension.
- Check: parses the input and lists its problems. Writes nothing.
- Convert: checks, then writes the output. Nothing is written when there are errors.
- Problems: one line per problem, with file, line and column, and after an arrow what to do about it. A click opens the file at that line in the Script Editor.
- Result: the config as text, after
#includeand macros were applied. - Game config browser
- Search (left): a class name searches every section;
CfgVehicles/lists that section;CfgVehicles/cansearches inside it. The buttons under it list the usual sections. - Classes (left): the matches, as paths such as
CfgVehicles/Canteen. At most 300. - Class (right): its path, a line on what the section is for, the inheritance chain
(click a parent to open it), the Addon that defines it, a picture of the item as the
inventory shows it when the class has a model, and all its properties with inheritance
applied. Underlined keys (
scope,itemSize,hiddenSelections…) have a tooltip. - New class from this: a dialog that writes a class inheriting from the one shown.
First steps
- Open Config in the rail and click Game config browser. The first time, the configs of all the game's PBOs (its packed archives) are merged; this takes a few seconds.
- Type
canteenin the search box. - Click
CfgVehicles/Canteen. - Read the chain next to Inheritance:
Bottle_Base → Edible_Base → Inventory_Base → …. Everything the canteen does not set itself comes from these parents. - Read Addon:
DZ_Gear_Drinks. A mod that inherits fromCanteenlists this name in itsrequiredAddons[]. - Hover
scopeanditemSizein the properties to read what they mean.
Take the tour (in the app)
Common tasks
Check a config.cpp
- In Convert & check, pick your
config.cppas Input. - Press Check.
- Click a problem to open the file at its line. Fix it, save: the check runs again by itself when the file changes on disk.
Tour: check and convert (in the app)
Convert config.cpp to config.bin
- Pick the
config.cpp. Convert to is set to Binary (.bin) and Output toconfig.binnext to it. - Press Convert. The line "Wrote …" confirms the file.
The PBO Packer can binarise the configs of a mod while it packs, so you rarely need to do this by hand.
Read a config.bin
- Pick a
config.bin(for example one extracted from another mod you are allowed to study). - Press Check to read it in the result area, or Convert to write a
config.cpp.
Find what to inherit from
- In the browser, search something close to what you want to make (
akm,barrel,hatchback). - Open it and follow its parents: a
…_Baseclass or a class withscope = 0is usually the one meant to be inherited. - Note the Addon for your
requiredAddons[].
Create a class from a game class
- Select the parent class and press New class from this.
- Give the class a name (letters, digits and
_). - In Write to, choose a
config.cppof your mod (those of your workspaces are listed), Other file… or Copy to clipboard. - Tick what the class should set. model path placeholder off keeps the parent's model
(a retexture); on writes a path to replace with your own
.p3d. - Read the preview, then press Create and open. The class is added to its section, its
name to the CfgPatches list, the parent's addon to
requiredAddons[], and the file opens.
Examples
- An item: the canteen (in the app):
CfgVehicles/Canteen. Look atscope,itemSize,weight, and the parents down toInventory_Base. - A weapon: the AKM (in the app):
CfgWeapons/AKM. Most values come fromAKM_BaseandRifle_Base; click the parents to see where each one is set. - A vehicle: the Ada 4x4 (in the app):
CfgVehicles/OffroadHatchback. Nested classes describe its seats, doors, engine and damage zones. - CfgPatches of a game addon (in the app):
CfgPatches/DZ_Gear_Drinks, with itsunits[],weapons[]andrequiredAddons[].
Concepts
- Class and inheritance:
class Canteen: Bottle_Base { … };definesCanteenwith everythingBottle_Basehas, plus or instead what is written between the braces. The browser shows the result;$baseis the direct parent. - Sections: the top-level classes group things by kind.
CfgVehiclesholds every object you can place or carry (items, clothing, buildings, cars),CfgWeaponsthe firearms,CfgMagazinesmagazines and ammo piles,CfgAmmothe projectiles,CfgModsthe scripts of a mod. - CfgPatches: every addon (PBO) declares itself with one class in
CfgPatches: the classes it adds (units[],weapons[]) and the addons that must load before it (requiredAddons[]). See https://community.bistudio.com/wiki/CfgPatches. - requiredAddons: the game loads configs in the order these lists impose. If your class
inherits from
Canteenbut your CfgPatches does not requireDZ_Gear_Drinks, your config may load first and the parent is missing. Use the Addon shown by the browser. - scope: 2 = the class can be spawned and listed in
types.xml; 1 = hidden but usable; 0 = a base class only, meant to be inherited. - Text and binary:
config.cppis text with#includeand#define.config.binis the same content binarised ("rapified"): no comments, no macros, faster to load. The conversion here gives the same bytes as CfgConvert. - Forward declaration: before inheriting from a class of another addon, a config names it
(
class Bottle_Base;) inside the same section. A missing one is reported as an undefined base class. - hiddenSelections: named parts of a model whose texture or material a class replaces with
hiddenSelectionsTextures[]/hiddenSelectionsMaterials[]. This is how a retexture works without a new model.
Pitfalls
- A
requiredAddons[]entry that is not a CfgPatches class of the game is reported by Check, with the place to look the right name up. The check is skipped, and says so, while the game config is still merging or when the DayZ folder is not set. __EVAL(…)with anything but simple arithmetic stays a string inconfig.bin; Check tells you to write the number.- A class from a mod that is not in your workspaces shows as an unknown parent or addon. Add the mod's folder to the workspaces in Settings.
- Converting a
config.binto text does not bring back comments, macros or includes: they were gone when it was binarised. - When the output file exists, Convert warns first; click it again within 10 seconds to
replace the file. Check the Output path when the input is a
.hppor.rvmat: it is empty until you choose one. - The browser shows the game's merged config, not your mod's. To see your own classes, check
your
config.cppand read the result. - New class from this edits the chosen
config.cppin place. Read the preview first, and replace the placeholder paths and texts afterwards. When the addon of the parent cannot be determined, the dialog says so and you add it torequiredAddons[]yourself.
For agents
Tools of dzt that do the same work without the window:
config_check: preprocess and parse aconfig.cpp/.hpp(or read aconfig.bin); returns diagnostics with file, line and column (syntax, undefined base classes,requiredAddonsunknown to the game) and a CfgPatches / CfgMods summary.config_convert: text to binary or back; the output extension chooses (.bin= binary).game_config_search: class names in the merged game config; returns class paths.game_config_class: one class with its properties resolved and its inheritance chain (CfgVehicles/Canteen).item_preview: renders a class's model as the inventory shows it, to a PNG.vfs_read: reads a gameconfig.binby virtual path, as text.
Files: Convert & check reads the input and its includes (next to the file, and on the
project drive set in Settings) and writes only the Output file. The browser reads the
config.bin of every game PBO and writes nothing. New class from this writes the chosen
config.cpp or the clipboard.
What the page tells the assistant: on Convert & check, the tab, the input file, the output path and the problems of the last check with their hints; it also offers the request "check this config". On the browser, the tab, the search text, the selected class path, its inheritance chain and the CfgPatches addon that defines it.
Examples reach the page as requests: req:class:<path> (class:CfgWeapons/AKM) selects a
class in the browser; req:tab:convert and req:tab:browser show a tab.
Anchors for studio_guide: config-tabs, config-tab-convert, config-tab-browser,
config-input, config-direction, config-output, config-check, config-convert,
config-problems, config-explorer, config-search, config-sections, config-classes,
config-detail, config-inheritance, config-properties, config-new-class.
See also
- Script Editor: edits
config.cpp; problems open there. - PBO Packer: packs the mod and binarises its configs.
- Models: the
.p3da class names inmodel, and its named selections. - Textures (PAA): textures and materials used by
hiddenSelections. - Central Economy:
types.xml, where a class withscope = 2is made to spawn. - Getting started