Hands-On Usage
has_country_flag is commonly used to track whether a player or AI has completed a critical decision/event branch, for example preventing the same event chain from triggering repeatedly or recording the completion of diplomatic agreements. Its most typical use cases are checking prerequisites in the available block of a focus/decision, or verifying whether a particular historical event has occurred in an event's trigger block.
# This decision is only available if signed_pact_flag was previously set via an event
available = {
has_country_flag = {
flag = signed_pact_flag
days > 30 # The flag must be set for at least 30 days before this opens
}
}
Synergy
[clr_country_flag](/wiki/effect/clr_country_flag): After a flag has completed its purpose, use this command to clear it, preventing "one-time" logic from being triggered repeatedly. Together with has_country_flag, they form a complete cycle of "write → check → clear".
[country_event](/wiki/effect/country_event): After confirming a flag exists, trigger the corresponding follow-up event, commonly used for controlling event chain transitions.
[has_completed_focus](/wiki/trigger/has_completed_focus): Combined with has_country_flag for dual verification, confirming both that the focus is completed and that the event chain's internal state is valid, avoiding gaps from relying solely on focus checks.
[has_decision](/wiki/trigger/has_decision): Used together with flags to distinguish between two different stages: "decision currently executing" and "decision completed with flag left behind" for branching logic.
Common Pitfalls
- Forgetting the
flag = keyword: The shorthand form has_country_flag = my_flag and the block form { flag = my_flag ... } cannot be mixed when adding extra fields. Once you need to add days > or value <, you must use the block form, otherwise parsing fails or fields are silently ignored.
- Wrong flag scope:
has_country_flag is only valid in COUNTRY scope. If the current scope is STATE or CHARACTER, you must first jump back to country scope using ROOT/FROM or similar, otherwise the flag can never be read and the condition silently returns false without error, making it extremely difficult to debug.