effect · set_country_flag
Definition
- Supported scope:
COUNTRY - Supported target:
none
Description
set country flag
set_country_flagCOUNTRYnoneset country flag
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
set_country_flag 常用于记录国家级事件的触发状态或关键剧情节点,例如标记某条国策已被激活、某次外交行动已发生,防止同类事件重复触发。在民族焦点链、事件链或决策脚本中,往往在 immediate 或 option 块里打上标记,再在后续触发条件中用 flag 判断是否已经执行过。
# 某国策完成时打标记
focus = {
id = my_focus_secret_deal
...
completion_reward = {
set_country_flag = secret_deal_signed
country_event = { id = my_events.1 days = 3 }
}
}
# 后续事件中读取该标记
trigger = {
has_country_flag = secret_deal_signed
}
[has_country_flag](/wiki/trigger/has_country_flag) — 与 set_country_flag 成对使用,在触发条件中检测该 flag 是否已被设置,构成"打标→检查"的完整逻辑闭环。[clr_country_flag](/wiki/effect/clr_country_flag) — 用于在适当时机清除已设置的 flag,实现可重置的状态机,例如完成某阶段后重置标记以允许再次触发。[country_event](/wiki/effect/country_event) — 通常与 flag 配合,在设置标记后同步触发后续事件,确保事件链按顺序推进且不会因缺少 flag 而卡住。[add_dynamic_modifier](/wiki/effect/add_dynamic_modifier) — 某些 modifier 的添加需以 flag 作为前提保护,避免多次重叠叠加,先 set_country_flag 再判断后添加。set_country_flag 与 has_country_flag / clr_country_flag 中使用的字符串必须完全相同(区分大小写),哪怕多一个下划线或大小写不同,触发条件永远无法匹配,且游戏不会报错,极难排查。clr_country_flag 显式清除。若设计了可重复触发的事件链却忘记清理旧 flag,会导致后续分支条件永远被满足或永远被跳过,逻辑错乱。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.
set_country_flag is commonly used to record the trigger state of nation-level events or key story milestones, such as marking that a specific national focus has been activated or a diplomatic action has occurred, preventing duplicate triggers of similar events. In national focus chains, event chains, or decision scripts, flags are typically set within immediate or option blocks and then checked in subsequent trigger conditions to determine whether they have already been executed.
# Set flag when a focus completes
focus = {
id = my_focus_secret_deal
...
completion_reward = {
set_country_flag = secret_deal_signed
country_event = { id = my_events.1 days = 3 }
}
}
# Read the flag in subsequent events
trigger = {
has_country_flag = secret_deal_signed
}
[has_country_flag](/wiki/trigger/has_country_flag) — Used in pair with set_country_flag, checks whether the flag has been set in trigger conditions, forming a complete "set → check" logic loop.[clr_country_flag](/wiki/effect/clr_country_flag) — Clears a set flag at the appropriate time, enabling a resettable state machine; for example, reset the flag after completing a phase to allow re-triggering.[country_event](/wiki/effect/country_event) — Typically paired with flags, triggers subsequent events after setting a flag, ensuring event chains proceed in order and won't get stuck due to missing flags.[add_dynamic_modifier](/wiki/effect/add_dynamic_modifier) — Some modifier additions require a flag as a prerequisite guard to prevent multiple overlapping stacks; set the flag first with set_country_flag, then check before adding.set_country_flag and has_country_flag / clr_country_flag must match exactly (case-sensitive). Even a single extra underscore or case difference will prevent the trigger from ever matching, and the game won't report an error, making it extremely difficult to debug.clr_country_flag. If you design a repeatable event chain but forget to clean up old flags, subsequent branch conditions will either always be satisfied or always be skipped, causing logic to become corrupted.