Fixing the tweakunits Battle Setting Error in BAR

Players trying to apply tweakunits presets sometimes hit a wall with the error message saying the battle setting is not allowed. The cause is simpler than it looks.

Tags: Beyond All Reason, battle preset, tweakunits, battle settings, custom game, modding

Why the tweakunits blocked error happens

The error reads something like: "for battle setting tweakunits is not allowed with current mod or battle preset." This appears when trying to apply tweaked unit definitions in a lobby that restricts modifications.

Tournament mode and certain rated presets lock out tweakunits entirely. The game does not permit any unit modifications in those modes, which preserves competitive integrity but blocks casual experimentation.

The fix is straightforward. Change the battle setting to Coop or Custom instead of Tournament. Those modes allow tweakunits to load and apply without restriction.

Custom tweak scripts and Base64 encoding

Beyond simple tweaks, BAR supports custom scripts embedded in unit definitions through Base64-encoded Lua. The pattern looks like this:

This approach lets modders attach arbitrary behavior to individual units without modifying core game files. The decoded script gets echoed to logs on load, which helps with debugging. Any errors during execution also appear in the log with the unit name attached.

Custom script error handling

The custom tweak script wrapper uses pcall for both the Base64 decode and the function execution. If the decode fails, the error gets logged. If the decoded function throws, the failure gets logged with the unit name and the failing script content. This dual-layer error catching means broken scripts do not crash the lobby, they just log and skip.

For production use, custom tweak scripts would need stress testing and code review before merging into the main repository. The encoding approach is sound but carries risks when arbitrary Lua execution is involved.

Tweak units for special builds

Players occasionally ask about tweak units for special commander variants like the epic commander. These exist as community-created content and typically work through the same customParams and tweakunits pipeline described above. Setting up a lobby to Custom mode and loading the appropriate tweak string lets those variants function in multiplayer.

Bottom line

Most tweakunits errors come down to one thing: wrong lobby mode. Switch to Custom or Coop, apply the tweak, and move forward. The Base64 custom script system adds flexibility for modders who want more than simple stat adjustments.

It is so easy to get on with everyone and there is zero toxicity. Just fun games of BAR which can have quite a toxic community usually.