How to replace attack orders with set target in widget code, finding command constants, and picking the right text editor for BAR modding.
If a widget uses CMD.ATTACK with spGiveOrderToUnit() but you need the unit to set a target instead of attacking immediately, swap in CMD_UNIT_SET_TARGET with the command ID 34923.
The full pattern looks like this:
local CMD_UNIT_SET_TARGET = 34923
spGiveOrderToUnit(unitID, CMD_UNIT_SET_TARGET, {nearestEnemy}, {})
The command constant lives in the BAR source file at luaui/Widgets/cmd_default_set_target.lua. This reference is useful whenever you need custom target-setting behavior in widgets that would otherwise trigger immediate attacks.
You can edit BAR widget files in any text editor. Notepad works. But an editor that understands Lua syntax saves time through syntax highlighting, bracket matching, and error detection.
Recommended options:
VS Code is the community preference for its integrated terminal, file search, and Lua debugging extensions.
The right tools make learning faster. Creed of Champions members share setup advice from editors to widgets to control schemes. No one gets mocked for starting with Notepad.
[Crd] 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.
Win with skill, teamwork, and respect.