tags: widgets, modding, lua, buildoptions, beyond-all-reason
BAR Widget Toggles, Unit Tweaks, and Buildoptions Syntax
Three practical Lua tips from the modding scene: making widgets toggleable, using unit-tweak-scripts for quick testing, and getting buildoptions quoting right.
Making Widgets Toggleable
Widgets can expose an onoffable flag that lets you turn them on and off during a match without digging into config files. The pattern lives in the widget header - check how corjamt.lua handles it in the BAR repo. Set the flag, hook it to a keybind, done. If you are running a widget constantly but only need it for specific fights, onoffable is the cleanest route.
Unit Tweak Scripts for Single Player Testing
When you are tweaking unit stats, editing individual unit files across the archive gets tedious fast. A single unit-tweak-scripts file is much faster. All your test changes live in one place. Load it in single player, iterate quickly, then push the working changes to the actual unit definitions once you know what you want. This is how most modders test balance changes without touching the core game files.
Buildoptions and the Quotes Thing
Buildoptions entries list unit names as strings, which means they need quotes in your Lua file. Skip the quotes and the engine looks for variables that do not exist and your build menu breaks. It is a small thing that trips up newcomers constantly. Every unit name in a buildoptions list gets wrapped in double quotes. No exceptions.
Watch It in Action
See how experienced BAR players structure their widget setups in practice at the BAR YouTube channel. Replays speak louder than writeups when you are trying to understand what working widget configs look like mid-game.
Creed
"The first and only community I have seen that actually holds up to its values. I have honestly not had a single bad experience here."