Scripting Conf File Usage – Arma Reforger
Sometimes, a .conf file can be useful in order to store multiple settings/values that would otherwise be flooding a class' member variables.
Two main approaches exist to refer to a .conf file:
ResourceName Approach | Object Approach |
---|---|
|
|
The following examples assume a .conf file is to be used in a custom entity.
ResourceName Approach
The simplest course of action is to target the wanted .conf file with a ResourceName path:
A proper way to make things easy is to have this property as an attribute:
At this point, any config file can be used. This is not what is wanted here. Hopefully, the Attribute can be made to target the specific config type we want:
With this done, the entity now either has a path to a config, or an empty path. Remains here to load this config, cast it to make sure of its content - requiring a dedicated method:
Object Approach
This way is faster to setup, but disallows a default value:
This method makes the Config field void of any data, but allows to either click the "set class" button to create a config on the fly or to drag and drop a .conf file to fill the field instantly.