effect · set_global_flag
Definition
- Supported scope:
any - Supported target:
none
Description
set global flag
set_global_flaganynoneset 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.
set_global_flag is commonly used to track global narrative states across countries and events, such as marking a historical event as triggered or a world-level mission as completed. Since it operates in the global namespace, any country scope can read it, making it ideal for multi-nation collaborative scripts or achievement unlock logic.
# When a country completes nuclear weapon research, set a global flag for other country events to detect
country_event = {
id = my_mod.1
option = {
name = my_mod.1.a
set_global_flag = first_nuclear_power_emerged
}
}
[has_global_flag](/wiki/trigger/has_global_flag): After setting a global flag, this trigger is typically paired in trigger blocks of other events or focuses to check whether the flag exists, forming a "write-read" closed loop.[clr_global_flag](/wiki/effect/clr_global_flag): When a narrative phase concludes or state needs to be reset, use this command to clear previously set flags and prevent them from permanently lingering and affecting subsequent logic.[modify_global_flag](/wiki/effect/modify_global_flag): If you need to attach numerical values to a flag (such as a counter), use this command to modify an existing flag, combined with set_global_flag to implement stateful global counting.[hidden_effect](/wiki/effect/hidden_effect): Wrap set_global_flag inside a hidden effect block to prevent players from seeing unnecessary internal state change notifications in event options.set_global_flag and has_global_flag / clr_global_flag must match exactly (case-sensitive). If a typo changes the capitalization or underscores anywhere, the trigger will never detect that flag, and the game won't report an error, making it extremely difficult to debug.set_country_flag instead of set_global_flag. Otherwise, multi-playthrough or multi-nation coexistence scenarios will cause state pollution.