Hands-On Usage
has_unit_leader_flag is primarily used to check whether a specific character/leader has been assigned a custom flag, commonly appearing in event chains to determine whether a character has already experienced a particular narrative moment (such as being wounded, undergoing a promotion ceremony, or completing a secret mission), thereby branching the subsequent event flow accordingly. Since the official maintainers have marked it as deprecated, new mods should prioritize has_character_flag instead; however, it remains frequently encountered when maintaining legacy mods.
# Check if a leader has been flagged as "experienced frontline wound event"
character_event = {
id = my_mod.10
trigger = {
is_corps_commander = yes
has_unit_leader_flag = frontline_wounded
}
# ...subsequent event content
}
# Variant with day condition: only trigger after the flag has been set for more than 30 days
trigger = {
has_unit_leader_flag = {
flag = secret_mission_assigned
days > 30
}
}
Synergy
[set_unit_leader_flag](/wiki/effect/set_unit_leader_flag): The corresponding effect command for setting flags; typically used first in events or on_action handlers to apply a flag, then checked with this trigger to form a complete "write→detect" logic cycle.
[clr_unit_leader_flag](/wiki/effect/clr_unit_leader_flag): Clears a flag; used in conjunction with this trigger to implement a "fire-once" mechanism—detect the flag after execution, then immediately clear it to prevent repeated triggering.
[has_character_flag](/wiki/trigger/has_character_flag): The official recommended replacement for this trigger with identical behavior; new conditional blocks should directly use this command to maintain forward compatibility.
[is_corps_commander](/wiki/trigger/is_corps_commander) / [is_field_marshal](/wiki/trigger/is_field_marshal): Leader flags typically only have meaning for characters in specific positions; filtering character types before checking flags prevents false positives on unintended characters.
Common Pitfalls
- Using outside CHARACTER scope: This trigger only functions within CHARACTER scope; calling it directly in COUNTRY, STATE, or other scopes will silently fail or error. You must enter the correct scope first using
any_character, every_character, or similar commands before applying this trigger.
- Forgetting to migrate to
has_character_flag: While reusing this command in new mods won't cause immediate errors, official maintainers could remove it entirely in a future patch; adopt the habit of rewriting all new logic to use has_character_flag instead, avoiding the maintenance burden of mass replacements later.