effect · clr_global_flag
Definition
- Supported scope:
any - Supported target:
none
Description
clear global flag
clr_global_flaganynoneclear global flag
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
clr_global_flag 常用于 mod 中清除跨国家、跨事件链的全局状态标记,例如在一场战争结束、某个剧情阶段完成或玩家做出关键选择后,将之前设置的全局 flag 重置,以允许该事件链重新触发或解锁其他分支。典型场景包括:清除"世界大战已爆发"标记以允许二次触发检测,或在周期性事件结束时清理临时全局状态。
# 在某个事件选项中,结束一个全局剧情阶段
option = {
name = my_event.1.a
# 执行结束逻辑后,清除全局标记
clr_global_flag = global_crisis_phase_one_active
}
[set_global_flag](/wiki/effect/set_global_flag):通常成对使用,set_global_flag 负责设置标记,clr_global_flag 在条件满足后将其清除,构成完整的"开关"控制流。[has_global_flag](/wiki/trigger/has_global_flag):在清除 flag 之前,往往需要先用此 trigger 检查该 flag 是否存在,避免逻辑混乱或重复清除。[modify_global_flag](/wiki/effect/modify_global_flag):当需要修改 flag 的值而非彻底清除时可作为替代;了解二者区别有助于选择正确指令。[if](/wiki/effect/if):配合条件块使用,只在特定条件成立时才清除 flag,防止无条件清除破坏其他事件链的状态依赖。clr_global_flag 使用的 flag 名称必须与 set_global_flag 完全一致(包括大小写),哪怕只有一个字母不同也会导致清除的是一个不存在的 flag,而原 flag 仍然保留,引发事件链逻辑错误且极难排查。clr_country_flag),实际上 clr_global_flag 始终操作全局标记,不受当前 scope 的国家身份影响,混淆两者会导致清除目标错误。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.