BAR Tweakdefs Troubleshooting: DPS, Targeting, and Mod Format Basics

A beginner-to-practical guide for fixing BAR tweakdefs, adjusting weapon DPS, restricting unit targeting categories, and understanding the difference between tweakunits and tweakdefs.

Tags: BAR tweakdefs, weapondefs DPS, unit targeting, Beyond All Reason modding, tweakunits

Tweakunits versus tweakdefs

The distinction matters from the first line. tweakunits is a plain data table. tweakdefs is a Lua script. Using the wrong format means the engine ignores your changes or throws a parse error. Simple value changes like health or metal cost belong in tweakunits. Weapon behavior modifications that need calculation logic live in tweakdefs.

A common first-timer mistake writes a tweakunits table with Lua syntax. The file looks right but the loader expects JSON-format key-value pairs. The opposite mistake writes tweakdefs as a static table when the engine expects executable Lua.

Adjusting weapon damage output

DPS in BAR is not a direct field. It comes from the interaction of fire rate, reload time, and damage per shot. The formula lives in weapondefs, but tweaking DPS means adjusting the damage key within the weapon definition itself. Setting damage to reach approximately 700 DPS means dividing the target DPS by the weapon's fire rate and using that as the damage value.

For a unit like the Legions Dragon's Constitution (internal key: legrwall), the weapon table structure sits under weapondefs with subkeys for each weapon type. Changing damage means targeting the correct weapon key and setting the numeric value.

Restricting targeting categories

Stopping a unit from shooting at air targets means modifying the onlytargetcategory field under the unit's weapons table. The syntax is straightforward: onlytargetcategory = "NOTSUB NOTAIR". This tells the weapon to ignore submarines and aircraft. The categories moved into alldefs in recent BAR versions, which is why older guides reference locations that no longer exist.

The weapons table is separate from weapondefs. Weapons holds firing behavior and targeting constraints. Weapondefs holds the actual damage, projectile, and explosion data. Both need correct entries for targeting changes to take effect.

Full mods versus tweakdefs

Tweakdefs are light overrides. Full mods mean creating a Recoil package with modinfo.lua, custom units, models, and gadgets. The process differs: full mods can add new units entirely, while tweakdefs only modify existing ones. A scaler gadget changes values at runtime without touching definition files. Modding models replaces visual assets directly.

For players asking whether their changes need a full mod or a simple tweakdef, the answer depends on scope. Changing existing unit stats means tweakdefs. Adding new units requires a full mod package.

Creed of Champions

"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." — Crd-003