effect · clr_global_flag
Definition
- Supported scope:
any - Supported target:
none
Description
clear global flag
clr_global_flaganynoneclear global 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.
clr_global_flag is commonly used in mods to clear global state flags that persist across countries and event chains. This is typically done after a war ends, a story phase completes, or the player makes a critical choice, resetting previously set global flags to allow event chains to retrigger or unlock alternative branches. Typical scenarios include clearing a "world war has erupted" flag to allow re-detection logic, or cleaning up temporary global state when periodic events conclude.
# In an event option, concluding a global story phase
option = {
name = my_event.1.a
# After executing conclusion logic, clear the global flag
clr_global_flag = global_crisis_phase_one_active
}
[set_global_flag](/wiki/effect/set_global_flag): Typically used as a pair—set_global_flag sets the flag, and clr_global_flag removes it when conditions are met, forming a complete "toggle" control flow.[has_global_flag](/wiki/trigger/has_global_flag): Before clearing a flag, it's often necessary to first check if the flag exists using this trigger to avoid logic errors or redundant clearing attempts.[modify_global_flag](/wiki/effect/modify_global_flag): When modifying a flag's value rather than removing it entirely, this serves as an alternative; understanding the distinction helps select the correct command.[if](/wiki/effect/if): Used alongside conditional blocks to only clear the flag when specific conditions are true, preventing unconditional clearing from breaking state dependencies in other event chains.clr_global_flag must match exactly with the name in set_global_flag (including case sensitivity). Even a single letter difference will cause the command to clear a non-existent flag while leaving the original flag intact, triggering event chain logic errors that are extremely difficult to debug.clr_country_flag instead). In reality, clr_global_flag always operates on global flags regardless of the current scope's country context. Confusing the two leads to clearing the wrong target.