命令百科

trigger · has_project_flag

Definition

  • Supported scope:SPECIAL_PROJECT
  • Supported target:any

Description

Check if flag has been set within the special project in scope.
May checks on the value or date/days since last modified date.
Examples:
has_project_flag = my_flag
has_project_flag = {
	flag = my_flag (mandatory)
	value < 12 (optional)
	date > 1936.3.25 (optional, compare with the date where the flag was last modified )
	days > 365 (optional, compare with the number of days since the flag was last modified )
}

实战 · 配合 · 坑

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

实战用法

在特殊项目(Special Project)的推进逻辑中,has_project_flag 常用于判断某个研究阶段是否已经触发过特定事件或达成过某个里程碑,从而控制后续奖励或分支条件是否开放。例如在一个核武器研发项目中,可检查"完成材料提纯"标志是否存在、设置多久,再决定是否解锁下一阶段选项:

available = {
    has_project_flag = {
        flag = material_purification_done
        days > 30
    }
}

配合关系

  • [set_project_flag](/wiki/effect/set_project_flag):最直接的搭档,先用 effect 打上标志,再用 has_project_flag 在其他条件块中检测该标志是否存在及其时效。
  • [clr_project_flag](/wiki/effect/clr_project_flag):当需要重置某一阶段状态时先清除标志,可用 has_project_flag 作为清除前的保护判断,避免对不存在的标志执行无意义操作。
  • [modify_project_flag](/wiki/effect/modify_project_flag):用于修改标志的数值,配合 has_project_flagvalue 比较,可实现累计计数器式的进度门控逻辑。
  • [hidden_trigger](/wiki/trigger/hidden_trigger):将复杂的 has_project_flag 组合条件包裹在 hidden_trigger 中,使 UI 提示更整洁,避免玩家看到内部实现细节。

常见坑

  1. 忘记 scope 限制has_project_flag 只能在 SPECIAL_PROJECT scope 下使用,新手常在国家或角色 scope 里直接调用,导致脚本报错或条件永远为假,需确保外层已通过类似 any_special_project 等方式切换到正确 scope。
  2. 混淆 datedays 的语义date 比较的是标志最后一次被修改时的绝对日期,而 days 比较的是距今已过去的天数,两者容易在逻辑上颠倒使用,导致条件在意料之外的时间点触发或永远不触发。