[ARCHIVE] Adding A Custom Faction (Below 0.8) - Ansible2/Arma-3-Survival GitHub Wiki
This will apply to any version below 0.8; you can still reuse any factions made in this format for the newer version, just need to copy-paste a bit.
Files To Edit:
Headers\Faction Headers\Unit Tables\Master Unit Table.hppHeaders\Faction Headers\Define Factions.hpp
Create A Table File:
In this hypothetical, the faction I am adding will be called MyFaction.
-
Create a header (.hpp or .h) file in
Headers\Faction Headers\Unit Tablesfolder. This is where you will put the information for the faction. I will refer to my file asMyFaction Unit Table.hpp. -
In the
Master Unit Table.hppfile, put a#includewith the filename that you just created. Mine will be#include "MyFaction Unit Table.hpp"
Ideally, this file you just created is where you should place all the faction tables for the specific addon you want to support.
Adding Infantry To Your Table:
- Begin by thinking of a name for your table to be used with
#defineSEE NOTE 1. I'll title mineMY_FACTION_UNITS. Then create an array for it as seen below:
#define MY_FACTION_UNITS \
[\
]
- Now add your infantry classnames to the list (don't forget
""marks, SEE NOTE 2):
#define MY_FACTION_UNITS \
[\
"B_Soldier_A_F",\
"B_soldier_AAR_F"\
]
Adding Vehicles To Your Table (OPTIONAL):
It is important to note that these vehicles are optional. Any support that uses vehicles will default to vanilla vehicles most of the time if a problem is encountered such as a vehicle being undefined. If you do want a vehicle to be undefined and revert to vanilla, use "" in its place in the vehicle array. If you want no vehicles at all, just don't even add a vehicle array to the faction table.
- Start by adding an array within the table:
#define MY_FACTION_UNITS \
[\
"B_Soldier_A_F",\
"B_soldier_AAR_F",\
[\
]\
]
- Read note 3 to understand the array context
- I'm going to add a complete list to my vehicle array
#define MY_FACTION_UNITS \
[\
"B_Soldier_A_F",\
"B_soldier_AAR_F",\
[\
"B_LSV_01_armed_F",\ // Light Car
"B_MRAP_01_hmg_F",\ // Heavy Car
"B_APC_Wheeled_01_cannon_F",\ // Light Armor
"B_MBT_01_cannon_F",\ // Heavy Armor
"B_Heli_Transport_01_F",\ // Transport Helicopter
"B_T_VTOL_01_vehicle_F",\ // Cargo Aircraft
"B_Plane_CAS_01_F",\ // CAS Plane
"B_Heli_Attack_01_dynamicLoadout_F",\ // Attack Helicopter
"B_T_VTOL_01_armed_F"\ // Heavy Gunship
]\
]
Alternate Syntax (SEE NOTE 4) for having multiple vehicle classes for a vehicle type section
#define MY_FACTION_UNITS \
[\
"B_Soldier_A_F",\
"B_soldier_AAR_F",\
[\
["B_LSV_01_armed_F","B_MRAP_01_hmg_F"],\ // Either one can spawn for a Light car
["B_MRAP_01_hmg_F","B_LSV_01_armed_F"],\ // Either one can spawn for a Heavy car
"B_APC_Wheeled_01_cannon_F",\
"B_MBT_01_cannon_F",\
"B_Heli_Transport_01_F",\
"B_T_VTOL_01_vehicle_F",\
"B_Plane_CAS_01_F",\
"B_Heli_Attack_01_dynamicLoadout_F",\
"B_T_VTOL_01_armed_F"\
]\
]
Implementing Your Faction:
Now begins the tedious part. All of the obtuse nature of this is because of limitations with Arma 3's Mission Parameter framework. Something that I will likely circumvent in the future, but for now...
- Navigate to the
Headers\Faction Headers\Define Factions.hpp. You'll find 3 #defines inside:FACTION_COUNT,FACTION_STRINGS, andFACTION_VARS. These defines need to remain synced to each other (particularlyFACTION_STRINGSandFACTION_VARS) for proper operation (SEE NOTE 5). - Start by adding a new number to the bottom of
FACTION_COUNT:
BEFORE:
...
62,\
63
AFTER:
...
62,\
63,\
64
- Now add a string name to the
FACTION_STRINGSlist. This is what will show up in the mission parameter selection list.
BEFORE:
...
"Zombies & Demons - Spider Zombies", \
"Zombies & Demons - Walkers"
AFTER:
...
"Zombies & Demons - Spider Zombies", \
"Zombies & Demons - Walkers",\
"My Faction Name"\
- And lastly, add that #define you made earlier for your faction to the
FACTION_VARS#define array.
BEFORE:
#define FACTION_VARS \
[ \
...
...
ZND_SPIDERS,\
ZND_WALKERS
]
AFTER:
#define FACTION_VARS \
[ \
...
...
ZND_SPIDERS,\
ZND_WALKERS,\
MY_FACTION_UNITS \
]
- Profit
Notes:
- Tables are separated between infantry classnames and a vehicle array filled with the vehicle classnames. The vehicle array can be anywhere in the table but I put it at the bottom for neatness sake. I also used multi-line #defines (read about it here) for this reason also. Basically, where you want the
#defineto end, don't add a\. Every other line you want to be a part of the#defineneeds one. If you understand none of that then just reference the vanilla tables I made in terms of where\are placed - The simplest way to get classnames is to load in the editor, find the units you want, drop them down, select those you want, and
right-click->Log->Log Classes To Clipboard. 3den Enhanced has a wonderful option to do this (in the same Log menu) and includes the""already. - The vehicle array within a table is divided into 9 possible sections. These are (in order): Light Cars, Heavy Cars (MRAPs), Light Armor (APCs & IFVs), Heavy Armor (Tanks), Transport Helicopter (Something to carry troops, preferably with door gunners to be used with supports, but not required), Cargo/Transport Aircraft (To be used for paratroopers and dropping off supplies, can be fixed wing or rotary, should have seats for troops), CAS Plane (should have rocket pods), Attack Helicopter (Only add helicopters with turrets that can rotate to a significant degree so that the helicopter gunner support can work as intended), Heavy Gunship (AC-130 type aircraft).
- Lets say you want to use multiple classes for a vehicle type, such as wanting two different cars to be able to spawn for Light Cars, just change the vehicle array's entry for that section into an array and place all the classes into the sub-array.
- When I say that the lists need to be synched, I mean that the count of
FACTION_COUNT(which starts from 0) should match the number of entries inFACTION_STRINGSandFACTION_VARS.FACTION_VARSandFACTION_STRINGSshould directly correlate. So for a given spot in the faction strings list, the faction var to use for that string needs to be at the same index in the faction vars array.