Hands-On Usage
has_global_flag is commonly used to track global narrative checkpoints—for example, to determine whether a specific world event has already been triggered, thereby controlling the available or trigger conditions of subsequent events to prevent duplicate triggers. It can also be combined with the value field to implement "counter"-style phase progression checks, such as tracking which stage of a global conflict has been reached.
# The available block of a certain decision: only usable after the global nuclear war event is triggered
available = {
has_global_flag = {
flag = global_nuclear_war_started
days > 30
}
}
Synergy
[set_global_flag](/wiki/effect/set_global_flag): The most direct companion—use set_global_flag to set a flag first, then use has_global_flag to check its existence, forming a "write-read" closed loop.
[clr_global_flag](/wiki/effect/clr_global_flag): Clear the flag after a phase-specific logic is complete; combined with has_global_flag, this enables "valid only within a certain phase window" conditional logic.
[modify_global_flag](/wiki/effect/modify_global_flag): Used to modify the value counter of a flag; paired with the value < field of has_global_flag, this enables multi-stage progress gating.
[date](/wiki/trigger/date): When you need to simultaneously constrain both "flag is set" and "game date", write it alongside the date trigger in an AND block to avoid the complex date range logic that is difficult to express using only the flag's date > field.
Common Pitfalls
- Writing the
flag field in shorthand by mistake: Beginners often write has_global_flag = test_flag, then later try to add a days > sub-condition in the same place but forget to switch to the curly-brace block syntax ({ flag = ... days > ... }), resulting in parse errors or silent failure of the sub-condition.
- Assuming that clearing a flag will reset the
days > condition: After clr_global_flag followed by set_global_flag, the set time is recorded anew; however, if you only modify the value without resetting the flag, the days timer still counts from the initial set timestamp, easily causing time judgment mismatches with expectations.