Headless AI: Basic Use - Global-Conflicts-ArmA/Olsen-Framework-Arma-3 GitHub Wiki
How to use the Headless AI module
The module consists of "arrays" of objects and units tied to a Game Logic
system object, found under the Systems
and then Logic Entities
tabs.
These game logic objects must be named in order to reference them in the module later. They may be given any valid variable name. All synced objects, vehicles, and AI will be spawned when this name is called in the spawn function, meaning that you want to split up your arrays of objects and units depending on the combinations you want to have spawned.
Objects, Vehicles, and AI must be "synced" to the game logic in order to be collected properly. To sync an object, select the objects you want to sync, then right click on one of them, go under the connect option, and click the "Sync to" option. This will give you a sync cursor and you will see dark blue lines emanating from each of the selected objects. Click on the game logic object you wish to sync them to.
A group of AI synced to a game logic object with a varname of hc_2
The next step is to edit the module settings.hpp file to include our game logic object. In this case we would put in "hc_2"
If we are testing in the SP editor, the objects and units synced to the hc_2 game logic should now disappear in game. If so, it means that the headless AI module has detected the game logic object and collected the information about the units and objects synced to it and has deleted them from the game.
In order to spawn them locally on the headless client machine, we will need to either call the PZAI_fnc_spawnArray
function, or to enter them into the initialSpawn
array in the settings.hpp file. Including the game logic array name in initialSpawn
will automatically spawn the array in at the start of the mission.
An alternative to spawning the array in initialSpawn
is using the PZAI_fnc_spawnArray
function, which you can call from a trigger or other script. This allows the mission maker to spawn in objects and AI according to trigger activation or other script conditions, simulating a QRF or reinforcements, or simply to break up the amount of active AI on the server at one time. (initialSpawn for the first objective, then a triggered PZAI_fnc_spawnArray
function call to spawn the AI at the subsequent objective)