Creating an Addon – Arma 3
Lou Montana (talk | contribs) m (Fix formatting) |
(Almost finished) |
||
Line 49: | Line 49: | ||
When the game loads an addon, it looks for a file called '''config.cpp''' to determine how to process the addon contents. Without such file, almost nothing will happen. In other words, '''config.cpp''' is the hub through which '''all of the addon contents''' will be applied to the game. | When the game loads an addon, it looks for a file called '''config.cpp''' to determine how to process the addon contents. Without such file, almost nothing will happen. In other words, '''config.cpp''' is the hub through which '''all of the addon contents''' will be applied to the game. | ||
At the bare minimum, the '''config.cpp''' file requires a [[CfgPatches|CfgPatches]] class. This will allow the game to determine what external addons are required by this addon, what objects/weapons are being added, as well as other information about the addon such as the author, version, etc.<br> | At the bare minimum, the '''config.cpp''' file requires a [[CfgPatches|CfgPatches]] class. This will allow the game to determine what external addons are required by this addon, what objects/weapons are being added, as well as other information about the addon such as the author, version, etc.<br> | ||
All added/patched classes should be | All added/patched classes should be added to this file in order to be recognized by the game. | ||
=== Config modifications === | === Config modifications === | ||
Line 77: | Line 76: | ||
Some community modifications, such as '''Community Based Addons 3 (CBA)''', add more ways to execute scripts. | Some community modifications, such as '''Community Based Addons 3 (CBA)''', add more ways to execute scripts. | ||
{{Clear}} | |||
== Signing the Addon (optional) == | |||
Signing an addon allows it to be used in multiplayer servers that check for addon signatures. To sign an addon, a private key is required. | |||
=== Keys and Signatures === | |||
There are two types keys used in the context of addons. | |||
==== Private Key ==== | |||
A private key is a file in {{ic|.biprivatekey}} format. It is used to sign addons. | |||
{{Feature | Important | The private keys, as the name suggests, should never be given to the public!}} | |||
==== Public Key ==== | |||
A public key is a file in {{ic|.bikey}} format. It is used to check the addon signatures by the server. <br> | |||
These files are safe to give to the public (typically published with the mod itself). | |||
==== Signature ==== | |||
A signature is a file placed next to the PBO file, to verify its contents.<br> | |||
They are named as {{ic|addon_name.key_name.bisign}} | |||
=== Creating the Keys === | |||
To create a key, use the [[DSUtils]] program in Arma 3 Tools. | |||
{{Feature | Informative | There is no need to create a new key with every version of an addon! That would require all servers using the addon to update the key after every update, which is inconvenient. }} | |||
{{Wiki|stub}} | |||
== Building the Addon == | == Building the Addon == | ||
=== Addon Builder === | |||
'''Main interface''' | |||
* '''Addon source directory:''' Should be the path to the Addon folder | |||
* '''Destination directory or filename:''' The output folder which will contain the PBO file, as well as the signature (if "Sign output PBO" is checked) | |||
* '''Binarize:''' Binarized configs are loaded faster by the game. They will also be checked for syntax errors during the packing process. | |||
[[File:Addon Builder Folder Setup.png|frameless|right|Folder Setup in Addon Builder]] | [[File:Addon Builder Folder Setup.png|frameless|right|Folder Setup in Addon Builder]] | ||
'''Options''' | |||
* '''List of files to copy directly:''' By default, only '''.cpp''' files are included in the addon. If other files need to be copied to the addon (e.g. scripts, models, etc.), they must be added too. For example: | |||
*.p3d;*.paa;*.sqf;*.fxy;*.xml;*.bisurf;*.rvmat;*.h | |||
{{Feature | Informative | When the "Binarize" option is checked, all [[PreProcessor_Commands#.23include|#include]]d '''.hpp''' files in '''config.cpp''' will be added to '''config.bin''' file. Therefore there is no need to add '''.hpp''' to the list of files to add (unless they're used elsewhere in the mod, such as scripts)}} | |||
* '''Addon Prefix:''' See [[Arma_3:_Creating_an_Addon#Addon_Prefix|Addon Prefix]] | |||
* '''Path to private key file:''' Set this path to the private key file (if "Sign output PBO" is checked) | |||
Other options can be left at their default values. | |||
Finally, click on "Pack" to start the packing process! | |||
=== Mikero's pboProject === | |||
{{Wiki|stub}} | {{Wiki|stub}} |
Revision as of 00:59, 16 August 2021
This page explains the steps required to create an addon (PBO file).
Prerequisites
- An addon making tool, such as the official Arma 3 Tools, or Mikero's Tools.
- A text editor, such as Notepad++ or Visual Studio Code.
Preparing the Addon
Place all required files (scripts, textures, fonts, models, etc.) in an empty folder, which hereafter will be referred to as the Addon folder.
It is recommended to categorize the files into separate folders to avoid clutter.
Addon Prefix
In simple terms, Addon Prefix is a virtual (in-game) path to the root of an addon. This virtual path should be unique to prevent collision with other addons. The addon prefix is added to the PBO properties by the packing tool.
The addon prefix is typically a single word:
Addon_Name
It is also possible to use a directory-like structure, which is typically used by mods that contain several addons:
Mod_Name\Addon_Name\Category\...
For example:
My_Faction_Mod\Faction_Name\Vehicles
Once the addon prefix is set, the path to addon files will become:
Addon_Prefix\Folder\File.sqf
Setting the Addon prefix
There are several ways to set the addon prefix, depending on the packing tool used. The instructions for two commonly used tools, namely Addon Builder and Mikero's Tools are explained.
Using Addon Builder
To set the addon prefix using Addon Builder, simply navigate to "Options" and modify the "Addon prefix" edit box.
Using Mikero's pboProject
To set the addon prefix using Mikero's pboProject, create a text file called $PBOPREFIX$
(no file format is required, but .txt is also possible) in the root of the addon folder, and put the addon prefix in the file.
Config.cpp
When the game loads an addon, it looks for a file called config.cpp to determine how to process the addon contents. Without such file, almost nothing will happen. In other words, config.cpp is the hub through which all of the addon contents will be applied to the game.
At the bare minimum, the config.cpp file requires a CfgPatches class. This will allow the game to determine what external addons are required by this addon, what objects/weapons are being added, as well as other information about the addon such as the author, version, etc.
All added/patched classes should be added to this file in order to be recognized by the game.
Config modifications
All added/modified config classes, such as CfgVehicles, CfgWeapons, CfgAmmo, CfgFunctions, CfgCloudlets, etc. need to be added to this file.
If the class contents are too long, it is recommended to put them in external files (e.g. CfgFunctions.hpp
) and #include them in the config.cpp file:
class CfgPatches
{
// ...
};
#include "cfgFunctions.hpp"
#include "some_other_file.hpp"
#include "ui\gui_defines.hpp"
// etc.
Scripts
There are several ways to execute scripts, depending on the time and place where that is supposed to happen.
For example, scripts that are to be executed at mission init can be added to the CfgFunctions class with an init flag, such as preInit = 1
.
Scripts that need to execute when a certain event takes place, can be executed using appropriate Event Handlers, if applicable.
Some community modifications, such as Community Based Addons 3 (CBA), add more ways to execute scripts.
Signing the Addon (optional)
Signing an addon allows it to be used in multiplayer servers that check for addon signatures. To sign an addon, a private key is required.
Keys and Signatures
There are two types keys used in the context of addons.
Private Key
A private key is a file in .biprivatekey
format. It is used to sign addons.
Public Key
A public key is a file in .bikey
format. It is used to check the addon signatures by the server.
These files are safe to give to the public (typically published with the mod itself).
Signature
A signature is a file placed next to the PBO file, to verify its contents.
They are named as addon_name.key_name.bisign
Creating the Keys
To create a key, use the DSUtils program in Arma 3 Tools.
Building the Addon
Addon Builder
Main interface
- Addon source directory: Should be the path to the Addon folder
- Destination directory or filename: The output folder which will contain the PBO file, as well as the signature (if "Sign output PBO" is checked)
- Binarize: Binarized configs are loaded faster by the game. They will also be checked for syntax errors during the packing process.
Options
- List of files to copy directly: By default, only .cpp files are included in the addon. If other files need to be copied to the addon (e.g. scripts, models, etc.), they must be added too. For example:
*.p3d;*.paa;*.sqf;*.fxy;*.xml;*.bisurf;*.rvmat;*.h
- Addon Prefix: See Addon Prefix
- Path to private key file: Set this path to the private key file (if "Sign output PBO" is checked)
Other options can be left at their default values.
Finally, click on "Pack" to start the packing process!