Giving every commander the ability to build T1 constructors from all three factions requires careful buildoptions manipulation.
Tags: BAR modding, buildoptions, cross-faction, T1 constructors, commander build
Using string.sub on unit names to find all commanders across factions works for bulk modification:
for name, u in pairs(UnitDefs) do
f = string.sub(name, 4, 6)
if f == "com" then
u.buildoptions = {
[1] = "armck", [2] = "armcv", [3] = "armbeaver",
[4] = "armca", [5] = "armcs", [6] = "armmls",
[7] = "armch", [8] = "corck", [9] = "corcv",
[10] = "cormuskrat", [11] = "corca", [12] = "corcs",
[13] = "cormls", [14] = "corch", [15] = "legck",
[16] = "legcv", [17] = "legaceb", [18] = "legca",
[19] = "legcs", [20] = "legch"
}
end
end
This replaces the entire buildoptions table for every commander. Any existing build options — including standard T1 constructors — get replaced with this explicit list. If you want to preserve original build options alongside new ones, use table.insert instead of direct assignment.
This tweak only affects the build menu. If you select Legion faction and the commander has Armada constructors in its build options, you can build them — but they count toward your actual faction's unit cap and economy. The units themselves function normally regardless of faction mismatch. This works because the buildoptions table just references unit definition names, and those units exist in the game's unit pool regardless of which faction is selected.
The syntax #UnitDefs.armca.buildoptions + 20 as an array index is not valid Lua for multi-value assignment. Each buildoptions entry must be assigned individually — you cannot write multiple values to a single array index. The error is usually silent, producing an empty build slot rather than a visible error message. If a tweak string produces an empty build button, the assignment syntax is almost certainly wrong.
Testing tweaks thoroughly before sharing prevents teammates from loading broken configs mid-lobby. Creed of Champions includes players who verify their code works, then share the clean version with the community. Better teammates make better games.
[Crd] Crd is the first really comfortable community I have been a part of. Everyone is nice and kind, the atmosphere is relaxed, and I am not getting yelled at for not being optimal.