Wiki

effect · modify_mio_flag

Definition

  • Supported scope:INDUSTRIAL_ORG
  • Supported target:none

Description

Modify the matching flag in the military industrial organization in scope. Happens only if the flag already exists.
ex:
var:my_mio_var = {
  modify_mio_flag = {
    flag = my_flag
    value = 5 (optional, default = 0. Will be added to the current value)
    days = 13 (optional, default = 0. if > 0, the flag will be deleted after this number of days)
  }
}

实战 · 配合 · 坑

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

实战用法

modify_mio_flag 适用于需要对军工组织已有的计数器或临时状态进行累加/修改的场景,例如追踪某组织完成了多少次特定任务、记录研发阶段进度等。与 set_mio_flag 不同,它只修改已存在的 flag,天然起到"有则改之、无则略过"的保护作用,适合在事件或决策链中反复触发而不产生副作用。

# 每次某国家完成一次武器测试,就给对应军工组织的进度 flag +1
# 在某个 INDUSTRIAL_ORG scope 的 event option 中:
modify_mio_flag = {
    flag = weapon_test_progress
    value = 1
}

配合关系

  • [has_mio_flag](/wiki/trigger/has_mio_flag):在执行 modify_mio_flag 之前用来检查目标 flag 是否存在,避免逻辑分支出错,也可读取当前数值决定后续行为。
  • [set_mio_flag](/wiki/effect/set_mio_flag):通常用于初始化阶段——先用 set_mio_flag 创建并赋予初始值,之后的所有累加才交给 modify_mio_flag 处理,两者形成"创建-修改"分工。
  • [clr_mio_flag](/wiki/effect/clr_mio_flag):在某个阶段完成后清除 flag,与 modify_mio_flag 配合构成完整的"计数→清零"生命周期。
  • [has_mio_size](/wiki/trigger/has_mio_size):常与 flag 值联动,当 flag 累加到一定程度后,配合组织规模条件触发奖励或解锁新特性。

常见坑

  1. 对不存在的 flag 调用无效modify_mio_flag 在 flag 不存在时会静默跳过,不会自动创建。新手经常忘记先用 set_mio_flag 初始化,导致整条累加逻辑完全不生效却没有任何报错提示,排查时极易遗漏。
  2. days 参数的覆盖行为:每次调用若都带上 days,计时器会被重置为新的倒计时,而不是在原有剩余时间上叠加。在循环触发的脚本里,这会导致 flag 始终无法到期删除,产生永久残留的"僵尸 flag"。

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

modify_mio_flag is suited for scenarios where you need to accumulate or modify existing counters or temporary states on a military industrial organization—for example, tracking how many times an organization has completed a specific task, or recording research progress stages. Unlike set_mio_flag, it only modifies existing flags, providing inherent protection with a "modify if exists, skip if absent" behavior. This makes it ideal for repeated triggering in event chains or decision trees without unwanted side effects.

# Each time a nation completes a weapon test, increment the corresponding MIO's progress flag by 1
# In an event option within an INDUSTRIAL_ORG scope:
modify_mio_flag = {
    flag = weapon_test_progress
    value = 1
}

Synergy

  • [has_mio_flag](/wiki/trigger/has_mio_flag): Use before executing modify_mio_flag to check whether the target flag exists, preventing logic branch errors. Also allows reading the current value to determine subsequent behavior.
  • [set_mio_flag](/wiki/effect/set_mio_flag): Typically used in initialization phase—first use set_mio_flag to create and assign an initial value, then delegate all subsequent accumulations to modify_mio_flag, forming a clear "creation-modification" division of labor.
  • [clr_mio_flag](/wiki/effect/clr_mio_flag): Clear the flag after a stage is completed, working with modify_mio_flag to form a complete "count→reset" lifecycle.
  • [has_mio_size](/wiki/trigger/has_mio_size): Often linked with flag values; when a flag accumulates to a certain threshold, combine it with organization size conditions to trigger rewards or unlock new features.

Common Pitfalls

  1. Calling on non-existent flags is ineffective: modify_mio_flag silently skips when a flag doesn't exist and won't auto-create it. Beginners often forget to initialize with set_mio_flag first, causing the entire accumulation logic to fail silently without error messages, making it extremely easy to overlook during troubleshooting.
  2. Overwrite behavior of the days parameter: Each call with days resets the timer to a new countdown instead of stacking on the remaining time. In repeatedly-triggered scripts, this causes the flag to never expire and delete, leaving behind permanent "zombie flags" in the system.