You want to swap a weapon on an existing unit using tweakunits. It is possible, but the syntax is particular and getting the weapon definition slots wrong will break the unit entirely.
Tags: BAR tweakunits, weapon replacement, unit definitions, Lua, modding beyond all reason
Tweakunits is the right tool when you need to change weapon definitions on existing units without building a full mod. The approach works through the lobby advanced options panel using base64-encoded Lua tables.
This does not work well for changing the visual model or animation rig. The weapon slot index must correspond to what the unit model actually supports. If a unit only has one weapon hardpoint, assigning a weapon to slot two will silently fail or crash.
The structure requires two nested sections: weapondefs to define the new weapon properties, and weapons to assign that definition to a specific hardpoint index.
The pattern looks like this: you define lua { unit_internal_name = { weapondefs = { my_cool_weapon = { your weapon stats here } } }, weapons = { [1] = { def = "my_cool_weapon" } } } }
The weapons array uses numeric indices matching the hardpoint order from the unit model. Slot one is typically the primary weapon. Slot zero may also work depending on the unit definition format.
A related but different problem is removing specific building types from the build menu entirely. If you want to disable bot factories or vehicle factories for a custom game mode, you need to remove entries from buildoptions rather than setting maxthisunit to zero.
A practical approach iterates through unit postfixes. For standard factory types you loop through identifiers like "lab" and "vp", then for each faction prefix like arm, cor, and leg, you look up the full unit name in UnitDefs and set maxthisunit to zero.
The faction naming varies slightly. T3 labs and amphibious labs use different internal names than standard T1 variants. Check the full unit name list before building your exclusion table.
When tweaking unit self-destruct behavior, the explosions table controls the damage values while selfdRadius defines the blast radius. Both values need adjustment if you want meaningful changes to self-destruct behavior. Changing only one without the other creates inconsistent results.
Building custom game modes takes patience and attention to detail. The same qualities make for great teammates in competitive BAR matches. Creed of Champions brings together players who value structured practice, mutual respect, and steady improvement.
[Crd] One of the few places where you can for sure coordinate with people in matches with a good supportive attitude. Everybody tends to be understanding and constructive.
Whether you are balancing custom unit configs or learning team strategy, having a community that values growth over ego makes the whole experience better.