Wiki

trigger · has_completed_focus

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

has country completed focus

实战 · 配合 · 坑

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

实战用法

has_completed_focus 最常见于国策链的后续解锁判断,例如只有当玩家/AI 完成了某个前置国策后,才允许触发特定决策、战争目标或剧本事件。也可用在 available 块中限制决策的可用条件,或在 trigger 块中检查对话条件是否满足。

# 只有当本国完成了"工业化计划"国策后,才允许激活该决策
decision_my_expansion = {
    available = {
        has_completed_focus = industrial_plan
    }
    # ...
}

# 在事件触发条件中检查国策完成情况
country_event = {
    trigger = {
        has_completed_focus = secret_rearmament
        NOT = { has_country_flag = rearm_event_fired }
    }
}

配合关系

  • [has_country_flag](/wiki/trigger/has_country_flag):国策完成后通常会设置国家旗帜,二者组合可以区分"完成了国策但事件只触发一次"的逻辑,避免重复判断。
  • [has_decision](/wiki/trigger/has_decision):与 has_completed_focus 联用,可构建"完成国策 + 拥有决策"的复合前置条件,精确控制解锁链路。
  • [complete_national_focus](/wiki/effect/complete_national_focus):在 effect 端强制完成某个国策后,往往需要在后续 trigger 中用 has_completed_focus 来校验状态,二者形成"写入-读取"配对。
  • [focus_progress](/wiki/trigger/focus_progress):当需要区分"国策进行中"与"国策已完成"两种状态时,可与 has_completed_focus 并用,实现更细粒度的进度判断。

常见坑

  1. 国策 ID 写错或作用域错误:该 trigger 只在 COUNTRY scope 下有效,若写在州(STATE)或角色(CHARACTER)scope 内会静默失败或报错;同时国策 ID 必须与 focus_tree 文件中定义的 id 字段完全一致,包括大小写,拼写差一个字母就永远返回 false
  2. 误以为可以检查其他国家的国策has_completed_focus 默认检查当前 scope 所代表的国家,若想检查盟友或敌国是否完成了某个国策,必须先用 any_allied_country/any_neighbor_country 等迭代器切换 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

has_completed_focus is most commonly used to check prerequisites in focus tree chains—for instance, allowing a specific decision, war goal, or scripted event to trigger only after the player or AI has completed a particular focus. It can also be used within an available block to restrict decision eligibility, or in a trigger block to verify dialogue conditions.

# Only allow this decision if the nation has completed the "Industrial Plan" focus
decision_my_expansion = {
    available = {
        has_completed_focus = industrial_plan
    }
    # ...
}

# Check focus completion status in event trigger conditions
country_event = {
    trigger = {
        has_completed_focus = secret_rearmament
        NOT = { has_country_flag = rearm_event_fired }
    }
}

Synergy

  • [has_country_flag](/wiki/trigger/has_country_flag): Completing a focus typically sets a country flag; combining the two allows you to distinguish "focus completed but event fires only once" logic and avoid redundant checks.
  • [has_decision](/wiki/trigger/has_decision): Used together with has_completed_focus, you can construct composite prerequisites like "focus completed + decision available" to precisely control unlock chains.
  • [complete_national_focus](/wiki/effect/complete_national_focus): After forcibly completing a focus via effect, subsequent triggers often need has_completed_focus to verify state, forming a "write-read" pairing.
  • [focus_progress](/wiki/trigger/focus_progress): When you need to distinguish between "focus in progress" and "focus completed" states, combine it with has_completed_focus for finer-grained progress checks.

Common Pitfalls

  1. Typos in focus ID or scope errors: This trigger only works in COUNTRY scope; using it in STATE or CHARACTER scope will silently fail or throw an error. Additionally, the focus ID must exactly match the id field defined in the focus_tree file, including capitalization—a single letter difference will always return false.
  2. Mistakenly assuming you can check other nations' focuses: has_completed_focus checks the focus status of the current scope's nation by default. To check whether an ally or enemy has completed a focus, you must first switch scope using iterators like any_allied_country or any_neighbor_country. Beginners often miss this step, resulting in the check always evaluating against their own nation.