Lua tweakdefs for weapons trip up a lot of modders. Avoidfeature and avoidfriendly do not work the way you expect unless you change them at the right level.
Tags: beyond all reason, modding, tweakdefs, weapondefs, lua, avoid feature, unitdefs
Setting avoidfeature on the unit def instead of the weapondef is the most common mistake. The weapon definition table is nested inside each unit. You need to iterate over unitdefs, then over each unit's weapondefs, then flip the flag on every weapondef entry.
Terrain-firing units like Vulcans and Buzzsaws need special handling. They should be excluded from broad changes or they end up shooting through ground they should not.
UnitDefs is a table of unit entries. Each entry may contain a weapondefs subtable, and that subtable may hold multiple weapon definitions. Some units have no weapons at all, so you need to check weapondefs exists before iterating.
Mutating the table at game start works fine. The engine does not deep-copy weapondefs after initialization, so changes you make before the first frame carry through the whole game.
Defense turrets usually benefit from avoidfriendly set to false and collideneutral set to true so they actually fire through walls. The tradeoff is friendly fire risk if placement is sloppy.
Use a custom lobby with only trusted players when testing tweakdef changes. Bad tweaks can make the game unplayable or create exploitable imbalances. Encode your changes with Base64 before sharing them into lobby commands.
These three parameters show up often in weapondef discussions. Driftratio controls projectile spread deviation. Kickback pushes the firing unit backward on shot. Restoretime governs how fast a unit returns to normal after firing disruption. None of these are well-documented in official sources, so testing in-game is the most reliable approach.
Good modding discipline and clean testing habits carry over into actual matches. Players who double-check their work before jumping into a game are the ones teammates want to coordinate with. Creed of Champions welcomes people who care about doing things right and helping each other learn.
[Crd] One of the few places where you can for sure coordinate with people in matches with a good supportive attitude. Everybody tends to be understanding and constructive.