Wiki

effect · clr_country_flag

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

clear country 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_country_flag is commonly used in the final stages of event or decision chains to clear status markers previously set with set_country_flag, preventing stale flags from interfering with subsequent logic checks. For example, after a diplomatic event is resolved, you may need to reset a "warning issued" state:

country_event = {
    id = my_mod.5
    option = {
        name = my_mod.5.a
        # Event processing complete, clear the previously set warning flag
        clr_country_flag = warned_target_flag
    }
}

Synergy

  • [has_country_flag](/wiki/trigger/has_country_flag): The most typical companion—first use this trigger to check if the flag exists, then decide whether to clear it, avoiding redundant operations or logic conflicts.
  • [country_event](/wiki/effect/country_event): After clearing a flag, it's common to immediately fire the next event, ensuring the new event executes in a "clean" flag environment.
  • [add_ideas](/wiki/effect/add_ideas): Some mods use country flags to track the activation state of a focus/idea, and when clearing flags, the corresponding idea is often removed in sync. The two often appear as a paired operation.
  • [activate_targeted_decision](/wiki/effect/activate_targeted_decision): Decision visibility/availability conditions frequently depend on country flags. Clearing a flag can directly control whether that decision continues to display. These are commonly used together to manage decision tree flow.

Common Pitfalls

  1. Inconsistent flag name spelling: You set my_event_done with set_country_flag, but clear it as my_event_Done. Since flag names are case-sensitive, the clear operation will fail and the stale flag persists indefinitely, causing subsequent has_country_flag checks to always return true.
  2. Calling in the wrong scope: This command only works in COUNTRY scope. If called directly within a state scope (e.g., inside every_owned_state), you must first switch back to country scope using owner = { clr_country_flag = ... }. Otherwise, the script will silently error or have no effect.