BAR Modding: Weapon XP Range Scaling, Customparams, and Debug Tips

Three scattered modding topics that come up repeatedly: scaling weapon range with experience, configuring colorblind-friendly team colors, and inspecting runtime Lua tables.

Tags: modding · customparams · lua · xp-scaling · colorblindness · beyond all reason

Scaling Weapon Range on XP Gain

Units with multiple weapons cannot use the default XP range bonus out of the box. The built-in system at unit_xp_range_bonus.lua accepts a single customparam for range scaling. To handle multi-weapon units, you need to change the customparam to accept weapon number mappings.

The pattern looks like this:

armpw.customparams.rangexpscale = { {1, 123}, {2, 456} }

This means weapon 1 gets a 123 XP range factor and weapon 2 gets 456. The implementation requires editing the gadget itself and updating any units that currently use the feature, such as the Gunslinger. Tables may not pass through customparams unchanged, so stringification might be required depending on whether the param parser handles nested tables.

Colorblind-Friendly Team Colors

Both BAR teams use yellow variants that look nearly identical to players with color vision differences. Enable Developer UI under Interface settings to access orange and red text config items that provide additional contrast cues for team identification. The configuration is accessible without any code changes, though the default team color palette could benefit from wider separation between the two yellow tones.

Inspecting Runtime Lua Tables

The modoptions and tweakunits tables are populated at runtime. There is no static file that shows the final merged state after all mods load. To inspect what actually loaded, print the table recursively and check the Spring logs. The Recoil Lua Library provides utilities for this kind of introspection.

Creed of Champions

Clear information and clean execution help teams improve without pointless blame. Debugging modding issues is straightforward when you know where to look, and sharing that knowledge saves everyone hours.

"Before discovering Creed, I was thinking the only thing that separates BAR from the perfect RTS is a friendly and safe social environment for new players to learn and feel included."

Advertisement