trigger · can_select_trait
Definition
- Supported scope:
CHARACTER,COMBATANT - Supported target:
none
Description
check if leader can select a trait
can_select_traitCHARACTER, COMBATANTnonecheck if leader can select a trait
Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.
can_select_trait is commonly used in mods to implement custom promotion systems or trait unlock interfaces for commanders, checking whether the current character is eligible to select a new trait and determining whether to display or activate relevant buttons/options. For example, in a general growth system, a trait selection event only triggers when conditions are met:
# In the trigger block of a unit_leader_event
trigger = {
can_select_trait = yes
is_corps_commander = yes
skill > 2
}
[has_trait](/wiki/trigger/has_trait): Used in conjunction with can_select_trait to first confirm that the character does not yet possess the target trait before checking eligibility, avoiding duplicate trait assignments.[add_trait](/wiki/effect/add_trait): After confirming can_select_trait = yes, execute the actual trait addition in the effect block, forming a complete "condition check → state modification" workflow.[has_unit_leader_flag](/wiki/trigger/has_unit_leader_flag): Used to mark whether this character's trait selection process has already been triggered, working with can_select_trait to prevent duplicate event triggers.[add_max_trait](/wiki/effect/add_max_trait): After expanding the maximum number of traits a character can hold, use can_select_trait to verify whether selection eligibility is truly unlocked, ensuring the limit expansion and selection logic remain synchronized.can_select_trait under country scope or province scope, causing the script to fail silently or throw errors. This trigger is only valid under CHARACTER / COMBATANT scope; always ensure the current scope has switched to the specific character or combat unit.can_select_trait only checks selection eligibility and does not guarantee sufficient trait slots. If add_max_trait is not used beforehand to expand the limit, executing add_trait directly may be ineffective if slots are full, and no error message will be displayed.