Wiki

effect · set_project_flag

Definition

  • Supported scope:SPECIAL_PROJECT
  • Supported target:none

Description

set project flag

实战 · 配合 · 坑

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

实战用法

set_project_flag 常用于特殊项目(Special Project)的里程碑管理,例如在某个研究阶段完成时打上标记,供后续事件或触发器判断当前进度状态。典型场景包括:在核武器研发项目完成某一原型阶段后设置标记,以便后续事件链或奖励分支能感知该状态。

# 在特殊项目的某个阶段完成时,标记"第一阶段已完成"
SPECIAL_PROJECT_SCOPE = {
    set_project_flag = phase_one_complete
}

配合关系

  • [has_project_flag](/wiki/trigger/has_project_flag) — 读取由 set_project_flag 写入的标记,用于条件判断该项目是否已到达特定阶段,两者构成"写入-读取"的完整闭环。
  • [clr_project_flag](/wiki/effect/clr_project_flag) — 在需要重置或切换状态时清除已设置的标记,与 set_project_flag 配合实现状态机式的阶段流转。
  • [modify_project_flag](/wiki/effect/modify_project_flag) — 若标记需要携带数值型状态(而非简单布尔),可先 set_project_flag 初始化,再用此命令修改其值。
  • [add_project_progress_ratio](/wiki/effect/add_project_progress_ratio) — 常在同一执行块中与标记一起使用,在推进项目进度的同时打上阶段标记,保持进度与状态的同步。

常见坑

  1. Scope 用错set_project_flag 只能在 SPECIAL_PROJECT scope 下执行,若误写在 country 或 state scope 中脚本会静默失败,且日志报错不总是直观,新手容易花大量时间排查。
  2. 与普通 set_country_flag 混淆:项目标记仅存在于该特殊项目自身的上下文中,无法用 has_country_flag 从国家 scope 读取;必须用 [has_project_flag](/wiki/trigger/has_project_flag) 在对应项目 scope 内查询,否则条件永远不会触发。

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

set_project_flag is commonly used for milestone management in Special Projects, such as marking completion at a particular research phase to inform subsequent events or trigger conditions about the current progress state. Typical scenarios include: setting a flag after a nuclear weapons development project completes a prototype phase, allowing subsequent event chains or reward branches to detect this state.

# Mark "phase one complete" when a special project reaches a certain stage
SPECIAL_PROJECT_SCOPE = {
    set_project_flag = phase_one_complete
}

Synergy

  • [has_project_flag](/wiki/trigger/has_project_flag) — Reads flags written by set_project_flag, used in conditional checks to determine whether the project has reached a specific phase; the two form a complete "write-read" feedback loop.
  • [clr_project_flag](/wiki/effect/clr_project_flag) — Clears previously set flags when resetting or switching states, working with set_project_flag to implement state machine-like phase transitions.
  • [modify_project_flag](/wiki/effect/modify_project_flag) — If a flag needs to carry numeric state (rather than simple boolean values), initialize with set_project_flag first, then modify its value using this command.
  • [add_project_progress_ratio](/wiki/effect/add_project_progress_ratio) — Often used alongside flags in the same execution block, advancing project progress while applying phase markers to keep progress and state in sync.

Common Pitfalls

  1. Incorrect Scopeset_project_flag can only execute within SPECIAL_PROJECT scope; using it in country or state scope will cause silent script failure, and log errors are not always intuitive, making it easy for new modders to spend considerable time debugging.
  2. Confusion with Generic set_country_flag — Project flags exist only in the context of that specific project and cannot be read from country scope using has_country_flag; you must use [has_project_flag](/wiki/trigger/has_project_flag) within the corresponding project scope to query it, otherwise the condition will never trigger.