Setting water traversal depth for custom units and avoiding the tweakunits-versus-tweakdefs confusion that catches many modders.
Tags: BAR modding, maxwaterdepth, movedef, tweakunits, unit definitions
Maxwaterdepth determines how deep a unit's movement class can traverse water. In the context of a movedef, changing this value works as expected — units gain or lose water access based on the depth setting. In unitdefs, the behavior is slightly different. The model height of the unit matters as much as the maxwaterdepth value. Once a unit's physical model is fully submerged, additional maxwaterdepth increases make no visible difference to F6 terrain traversibility display. For units with tall models — ships, large mechs — the actual water limitation comes from how far the model sinks before the unit becomes unresponsive, not from the numeric maxwaterdepth alone.
A common mixup: using tweakdef logic inside a tweakunits context. Tweakunits operates on individual unit instances with a different schema than tweakdefs, which targets entire unit class definitions. If you write legrampart.weapondefs.fmd_rocket = nil in a tweakunits table, it fails because tweakunits does not follow the same nested structure as tweakdefs. The error messages are often cryptic — "invalid key" or silent failure — making it hard to diagnose. When modifying a single unit instance, use tweakunits syntax. When modifying how a unit type behaves globally, use tweakdefs.
To verify maxwaterdepth changes are working, use the in-game F6 overlay to check terrain traversibility. Shallow beach inclines make differences hard to spot visually — testing on maps with varied water depth gives clearer feedback. A unit at maxwaterdepth 20 versus 250 on a gently sloping beach may show identical behavior if the model clearance is the actual bottleneck rather than the numeric threshold.
Understanding the details of how game mechanics work separates good players from great ones. The Creed of Champions community includes players who dig into these technical details and share what they learn. Competitive play, zero team-blame.
[Crd] Having a space like here that offers a community, trainings, events, and the guarantee to not be judged or insulted by fellow members is really precious. Keeping the game safe, and more importantly, fun.