Create a Config Class – Arma Reforger

From Bohemia Interactive Community
Jump to: navigation, search

Creating a class used as .conf root is as easy as creating a standard class, with a few additions.

Be sure to read Config Editor documentation as well as the Config Object guidelines before following this tutorial.


Creation

Class

Let's create a class with the wanted properties, using the Resource Manager: Config Editor documentation:

Copy
class TAG_SuperConfig { [Attribute(defvalue: "DEFAULT VALUE", category: "Personal Details")] string m_sName; // member variables are not protected as this class is considered a databag // let's not clutter it with getters [Attribute(defvalue: "100", params: "1 500", category: "Damage")] int m_iTotalHealth; bool m_bOtherValue; // other properties without [Attribute()] will be ignored by the .conf UI but are still accessible by script }

Make It Root

The class exists, now to make it appear as an option in Resource Manager > Create > Config file; all it takes is this class decorator:

Copy
[BaseContainerProps(configRoot: true)]

making the end result look like:

Copy
[BaseContainerProps(configRoot: true)] class TAG_SuperConfig { [Attribute(defvalue: "DEFAULT VALUE", category: "Personal Details")] string m_sName; [Attribute(defvalue: "100", params: "1 500", category: "Damage")] int m_iTotalHealth; }

Now, the class can be used as config root.


Config File Creation

  1. In Resource Manager's Resource Browser, browse to the directory in which to create the config file; then click on the Create button and select the Config File option
  2. Enter the new file's name in the appearing dialog
  3. Look for the wanted "BaseContainerProp" class in the next dialog
  4. After clicking the classname once, the file is created from this model in the selected directory.
    Double-click on it to open it and edit it.


Example

See a broad SCR_ConfigExample class: