Hands-On Usage
add_corps_commander_role is commonly used in mods to dynamically unlock the corps commander position for a character—for example, transforming a specific person from a civilian advisor into a battlefield-ready commander after focus completion, or granting initial command capabilities to a newly generated character when an event triggers. The following example demonstrates adding a corps commander role to a designated character within a national scope through focus effects:
focus = {
id = GER_promote_rommel
# ...
completion_reward = {
add_corps_commander_role = {
character = GER_Character_token
traits = { brilliant_strategist }
skill = 3
attack_skill = 4
defense_skill = 2
planning_skill = 3
logistics_skill = 2
}
}
}
Synergy
[create_corps_commander](/wiki/effect/create_corps_commander): If a character does not yet exist, you must first use this command to create the character and simultaneously grant the commander role; add_corps_commander_role is used to add a role type to an existing character. Each serves its purpose at different stages of a character's lifecycle.
[add_field_marshal_role](/wiki/effect/add_field_marshal_role): When designing character progression paths, you can use both in combination—first grant the corps commander role to accumulate experience, then add the field marshal role under specific conditions later, implementing a promotion logic.
[remove_unit_leader_role](/wiki/effect/remove_unit_leader_role): When you need to replace a character's role type, use this command first to remove the old role, then add the new corps commander role, avoiding conflicts from a character holding incompatible positions simultaneously.
[has_character](/wiki/trigger/has_character): Before executing, use this trigger to verify whether the target character exists in the current country, preventing script errors caused by missing characters.
Common Pitfalls
- Forgetting the
character field in COUNTRY scope: The character = ... field can only be omitted when the script is already within that character's own CHARACTER scope. If you call this in a country scope without specifying the character token, the game will fail to locate the target character, the effect fails silently with no error message, making it extremely difficult to debug.
- Repeatedly adding the role to a character who already has a corps commander role: If a character already holds a corps commander role, executing this command again may cause skill values or traits to stack abnormally. It is recommended to use conditional logic similar to
[has_advisor_role](/wiki/trigger/has_advisor_role) (or check the character's current role status) before execution to ensure the command only runs when the character does not yet have that position.