Tags: bar modding, armordefs, customparams, tweakdefs, unitdefs, lua scripting, beyond all reason modding

BAR Modding Guide: ArmorDef and CustomParams in TweakDefs

How to change unit armor assignments and work around the limits of customparams when modding Beyond All Reason.

The armordef problem

BAR modders run into the same wall early. You want a unit to use different armor, so you open customparams and try to define a brand new armor type. The file just ignores it. The reason sits inside armordefs.lua: new armor definitions cannot be created through customparams. Players can only assign units to armor types that already exist in the game.

So if you made flying boats and tried ud.armortype = "vtol", the unit keeps its original heavy boat armor because the armordef assignment lives in a separate processing layer. The fix points to adding entries at a specific line in armordefs.lua where preexisting armor categories get extended.

Working with preexisting armor types

The practical path is straightforward. Open armordefs.lua and find the section that maps units to existing armor categories. You can add units to an existing category using the unitDef.customparams.armordef field. This means moving three units into the VTOL armor group works fine. Creating a brand new space armor type requires touching the core armordef processing code instead of relying on customparams alone.

The specific code pattern for adding new categories involves clearing the old armordef for a unit name and then inserting a new entry in the armorDefs table. Without that extra step, the engine defaults back to the original armor assignment before customparams get a chance to override it.

Energy orb visuals are off-limits

Some modders ask about making energy orbs spin or appear on custom units. Those visual effects are handled by a separate gadget/widget system, not by unit definitions. No amount of tweaking in unitdefs.lua will produce an energy orb effect. The render logic lives in a different layer entirely and would require writing a custom gadget to replicate.

Useful files for tweakdef modding

Where to learn more

Catching the broader modding workflow helps fill in the gaps between armor assignments and unit behavior. The Beyond All Reason YouTube channel covers strategy and modding content that connects the dots for newer developers getting started.

Creed of Champions

Creed of Champions runs a competitive BAR environment built on teamwork and clear communication. Players in the group learn fast because information flows cleanly and mistakes become learning points without the usual blame cycle.

[Crd] Gaming actually fulfills a human purpose here - cooperation, mutual upbuilding, fun and striving for greatness together. Instead of random anonymity, you meet, learn from, and enjoy real people.