Wiki

trigger · has_global_flag

Definition

  • Supported scope:any
  • Supported target:any

Description

has global flag been set.Check flag val date set and days since set.
Example: has_global_flag = test_flag
has_global_flag = { 
	flag = <name> (mandatory)
	value < <int> (optional)
	date > <date> (optional)
	days > <int> (optional)
}

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

has_global_flag 常用于追踪全局剧情节点,例如判断某个世界事件是否已经触发过,从而控制后续事件的 availabletrigger 条件,避免重复触发。也可配合 value 字段实现"计数器"式的阶段判断,比如追踪某个全局战争阶段进展到哪一步。

# 某个决策的 available 块:仅在全球核战争事件触发后方可使用
available = {
    has_global_flag = {
        flag = global_nuclear_war_started
        days > 30
    }
}

配合关系

  • [set_global_flag](/wiki/effect/set_global_flag):最直接的搭档,先用 set_global_flag 设置标记,再用 has_global_flag 检查是否存在,构成"写-读"闭环。
  • [clr_global_flag](/wiki/effect/clr_global_flag):在阶段性逻辑完成后清除旗帜,配合 has_global_flag 可实现"仅在某阶段窗口内有效"的条件判断。
  • [modify_global_flag](/wiki/effect/modify_global_flag):用于修改旗帜的 value 计数,与 has_global_flagvalue < 字段配合可实现多阶段进度门控。
  • [date](/wiki/trigger/date):当需要同时约束"旗帜已设置"与"游戏日期"时,与 date trigger 并列写在 AND 块中,避免仅靠旗帜的 date > 字段难以表达的复杂日期区间逻辑。

常见坑

  1. 误把 flag 字段写成简写形式:新手常写成 has_global_flag = test_flag 后,又在同一处想加 days > 子条件,却忘记切换成花括号块语法({ flag = ... days > ... }),导致解析报错或子条件静默失效。
  2. 以为清除旗帜会让 days > 条件重置clr_global_flag 后再 set_global_flag 会重新记录设置时间,但若只是修改 value 而不重设旗帜,days 计时仍从最初设置时刻算起,容易造成时间判断与预期不符。

Hands-On Notes

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.

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

  1. 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.
  2. 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.