Wiki

effect · clr_unit_leader_flag

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

clear unit leader flag
This effect is deprecated in favor of clr_character_flag.

Hands-On Notes

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.

Hands-On Usage

clr_unit_leader_flag is used in legacy mods to clear custom boolean flags attached to unit leaders under the CHARACTER scope. For example, it can be used to remove a status flag previously set with set_unit_leader_flag after an event concludes, preventing flag residue from causing subsequent trigger misevaluations. Since the official implementation has marked it as deprecated, you will only encounter it when maintaining older mods or ensuring compatibility with legacy saves.

# Legacy usage example: clearing a leader's special mission flag
character_event = {
    id = my_mod.10
    ...
    option = {
        name = my_mod.10.a
        # Mission complete, clear the flag
        clr_unit_leader_flag = my_special_mission_active
    }
}

Synergy

  • [set_unit_leader_flag](/wiki/effect/set_unit_leader_flag) — Used as a counterpart to this command; set the flag first, then clear it with clr to form a complete flag lifecycle management cycle.
  • [has_unit_leader_flag](/wiki/trigger/has_unit_leader_flag) — Typically check flag existence with this trigger before clearing to avoid executing meaningless clear operations when no flag is present.
  • [clr_character_flag](/wiki/effect/clr_character_flag) — The officially recommended replacement command; when migrating legacy mods, replace clr_unit_leader_flag one-to-one with this command.
  • [modify_unit_leader_flag](/wiki/effect/modify_unit_leader_flag) — Part of the legacy leader flag system; if you need to modify rather than clear, consider this as an alternative.

Common Pitfalls

  1. Using this command in new mods: This effect has been officially deprecated; new mods should use clr_character_flag directly. While continuing to use the old command may not produce errors in the short term, future version compatibility cannot be guaranteed. Migration is strongly recommended immediately.
  2. Incorrect scope: This command must be executed under CHARACTER scope; if called within COUNTRY scope (for example, writing it directly in a country event's immediate block without first switching to a specific character), the script will silently fail and the flag will not be cleared, making it difficult to debug.