effect · set_country_flag
Definition
- Supported scope:
COUNTRY - Supported target:
none
Description
set country flag
set_country_flagCOUNTRYnoneset country 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_country_flag is commonly used to record the trigger state of nation-level events or key story milestones, such as marking that a specific national focus has been activated or a diplomatic action has occurred, preventing duplicate triggers of similar events. In national focus chains, event chains, or decision scripts, flags are typically set within immediate or option blocks and then checked in subsequent trigger conditions to determine whether they have already been executed.
# Set flag when a focus completes
focus = {
id = my_focus_secret_deal
...
completion_reward = {
set_country_flag = secret_deal_signed
country_event = { id = my_events.1 days = 3 }
}
}
# Read the flag in subsequent events
trigger = {
has_country_flag = secret_deal_signed
}
[has_country_flag](/wiki/trigger/has_country_flag) — Used in pair with set_country_flag, checks whether the flag has been set in trigger conditions, forming a complete "set → check" logic loop.[clr_country_flag](/wiki/effect/clr_country_flag) — Clears a set flag at the appropriate time, enabling a resettable state machine; for example, reset the flag after completing a phase to allow re-triggering.[country_event](/wiki/effect/country_event) — Typically paired with flags, triggers subsequent events after setting a flag, ensuring event chains proceed in order and won't get stuck due to missing flags.[add_dynamic_modifier](/wiki/effect/add_dynamic_modifier) — Some modifier additions require a flag as a prerequisite guard to prevent multiple overlapping stacks; set the flag first with set_country_flag, then check before adding.set_country_flag and has_country_flag / clr_country_flag must match exactly (case-sensitive). Even a single extra underscore or case difference will prevent the trigger from ever matching, and the game won't report an error, making it extremely difficult to debug.clr_country_flag. If you design a repeatable event chain but forget to clean up old flags, subsequent branch conditions will either always be satisfied or always be skipped, causing logic to become corrupted.