Hands-On Usage
add_naval_commander_role is commonly used in mods to dynamically assign naval commander status to specific historical figures. For example, after a nation completes a particular focus tree or triggers an event, you can promote a preset character to fleet commander. It can also be used in war outbreak triggers to instantly generate naval commanders with exclusive skills and traits, enhancing a specific nation's naval combat capabilities.
# Assign naval commander role to a German character after focus completion
GER = {
add_naval_commander_role = {
character = GER_karl_doenitz
traits = { spotter superior_tactician }
skill = 4
attack_skill = 3
defense_skill = 3
maneuvering_skill = 4
coordination_skill = 3
}
}
Synergy
[add_field_marshal_role](/wiki/effect/add_field_marshal_role) / [add_corps_commander_role](/wiki/effect/add_corps_commander_role): When the same character needs to hold different military positions based on story branches, use these mutually exclusively with this command to keep character roles clear and distinct.
[add_trait](/wiki/effect/add_trait): After assigning the naval commander role, you can further add additional traits to implement step-by-step character development designs.
[remove_unit_leader_role](/wiki/effect/remove_unit_leader_role): If a character previously held other unit leader roles, use this command to clear them before calling this command to avoid role conflicts or display anomalies.
[has_advisor_role](/wiki/trigger/has_advisor_role): Commonly used as a prerequisite check to confirm whether the character is currently serving in an advisor role, preventing logic errors from stacking character identities.
Common Pitfalls
- Omitting the
character field in COUNTRY scope: The character parameter can only be omitted when called within a CHARACTER scope; if you don't specify character = token under a country scope, the game cannot determine the target character, causing the effect to silently fail without error messages, making it extremely difficult to debug.
- Skill point totals exceeding implicit caps can be written but display abnormally: The sum of individual skill categories (attack/defense/maneuvering/coordination) should theoretically remain consistent with the
skill field according to game logic. If the sum of individual skills diverges significantly from skill, the game will recalculate the display value according to its own formula, causing actual performance to differ from script definitions.