effect · set_unit_leader_flag
Definition
- Supported scope:
CHARACTER - Supported target:
none
Description
set unit leader flag
This effect is deprecated in favor of set_character_flag.
set_unit_leader_flagCHARACTERnoneset unit leader flag
This effect is deprecated in favor of set_character_flag.
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.
set_unit_leader_flag is used to set custom flags on character entities, commonly employed in mods to track whether a specific character has triggered certain events or is in a particular state (e.g., "wounded," "received orders," etc.). Since this command has been officially deprecated, it is recommended in actual development to use it only when maintaining legacy mods. New projects should use set_character_flag directly.
# Legacy syntax (still functional, but not recommended for new mods)
some_character = {
set_unit_leader_flag = received_secret_orders
}
[has_unit_leader_flag](/wiki/trigger/has_unit_leader_flag): The corresponding trigger that directly pairs with set_unit_leader_flag, used to check whether a character has been assigned a given flag, forming a complete "set → check" logic loop.[clr_unit_leader_flag](/wiki/effect/clr_unit_leader_flag): Clears previously set flags at appropriate moments, preventing flag persistence from causing logic errors.[set_character_flag](/wiki/effect/set_character_flag): The officially recommended alternative command with equivalent functionality but broader applicability. This should be prioritized when migrating legacy mods.[unit_leader_event](/wiki/effect/unit_leader_event): Commonly used alongside flags to trigger character-related events, with flags controlling subsequent branch logic within the event.set_unit_leader_flag directly from legacy mods or online tutorials without realizing it has been deprecated. Prolonged use of deprecated commands may cause compatibility issues in future game updates. Adopt the habit of using set_character_flag instead.CHARACTER scope. If called directly in a country or province scope without first switching to the specific character, the script fails silently without error reporting, resulting in the flag never being set.