Tweakdefs pitfalls including weapon versus unit attributes, one-liner traps, and target exclusion patterns.
A frequent error places weapon-level attributes at the unit level. Writing beamtime directly on a unit def does nothing. It lives inside weapondefs:
{ armflea = {
metalcost = 0.1,
energycost = 0.1,
weapondefs = {
flea_laser = { range = 1400 }
}
} }
Attributes like beamtime, range, and damage all nest under specific weapon names inside weapondefs. Putting them at the unit level either silently fails or triggers parsing errors.
Condensing entire unit definitions onto single lines looks clever until something breaks. Formatted multi-line structures let modders read the nesting hierarchy at a glance. The time saved on debugging far exceeds the keystrokes lost to formatting:
{ armflea = {
metalcost = 17,
weapondefs = {
flea_laser = {
range = 140
}
}
} }
Get it working readable first. Compress later if space matters.
Applying a weapon change to all factions except solar units requires a filter. Adding an if not check before the modification skips the excluded targets:
for name, ud in pairs(UnitDefs) do
if not (name == "armsolar" or name == "corsolar") then
-- apply changes
end
end
This pattern extends to any set of units that should remain untouched by a bulk modification.
Clean code habits translate to clean gameplay habits. Players who build their strategies on solid foundations outperform those who rush in without checking their assumptions.
Creed of Champions is a great place to learn and play BAR in a friendly atmosphere. Training sessions, team gameplay, even some non-BAR stuff. Large cross section of abilities, time zones, and game mode interests.