Wiki

trigger · has_completed_goal

Definition

  • Supported scope:COUNTRY
  • Supported target:any

Description

Checks if the country was a member of a faction when a specific goal was completed.
Persists across faction disband/recreate, unlike has_completed_faction_goal.

### Examples

TAG = { has_completed_goal = goal_id }

实战 · 配合 · 坑

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

实战用法

has_completed_goal 常用于联盟目标系统相关的 mod 场景,例如判断某国是否曾参与完成了特定阵营目标(如联合征服或资源共享目标),从而解锁奖励或触发剧情事件。与 has_faction_goal 不同,它在阵营解散后仍能持续追踪历史记录,适合长线剧情 mod。

# 检查国家是否曾完成某联盟目标,若是则给予奖励
country_event = {
    id = my_mod.5
    trigger = {
        has_completed_goal = faction_goal_joint_industry
        has_war = no
    }
    option = {
        name = my_mod.5.a
        add_stability = 0.05
        add_research_slot = 1
    }
}

配合关系

  • has_faction_goal:两者语义互补,has_faction_goal 检查当前进行中的阵营目标状态,而 has_completed_goal 检查历史完成记录,常在 OR/AND 块中组合使用以覆盖完整目标周期。
  • is_in_faction:用于先确认国家当前仍在某阵营中,再配合 has_completed_goal 判断其历史贡献,避免对游离国家误触发。
  • add_faction_goal:作为 effect 端的配对命令,用于给阵营添加新目标,与 has_completed_goal 构成"添加目标→完成目标→检测结果"的完整流程。
  • has_country_flag:阵营目标完成后常通过 flag 记录额外状态,与 has_completed_goal 并列使用以实现更精细的条件判断。

常见坑

  1. 将其误用于非成员国:该 trigger 检查的是"完成目标时该国是否为阵营成员",若某国在目标完成后才加入阵营,即使当前在阵营中,结果也会返回 false,新手常因此误判逻辑。
  2. has_faction_goal 混淆has_faction_goal 检查的是目标是否当前存在且未完成,而 has_completed_goal 检查的是已完成的历史记录;阵营解散重建后前者会失效,后者不会,使用前需明确需求。

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_goal is commonly used in mod scenarios involving faction goal systems — for example, checking whether a country previously participated in completing a specific faction goal (such as a joint conquest or resource-sharing objective) in order to unlock rewards or trigger story events. Unlike has_faction_goal, it continues to track historical records even after a faction has been dissolved, making it well-suited for long-running narrative mods.

# Check whether a country has ever completed a faction goal; if so, grant a reward
country_event = {
    id = my_mod.5
    trigger = {
        has_completed_goal = faction_goal_joint_industry
        has_war = no
    }
    option = {
        name = my_mod.5.a
        add_stability = 0.05
        add_research_slot = 1
    }
}

Synergy

  • has_faction_goal: The two triggers are semantically complementary — has_faction_goal checks the status of an ongoing faction goal, while has_completed_goal checks the historical completion record. They are frequently combined inside OR/AND blocks to cover the full lifecycle of a goal.
  • is_in_faction: Used to first confirm that a country is currently still part of a faction before using has_completed_goal to evaluate its historical contributions, preventing accidental triggers for countries that have left.
  • add_faction_goal: The counterpart effect command for adding a new goal to a faction. Together with has_completed_goal, it forms the complete workflow of "add goal → complete goal → check result."
  • has_country_flag: After a faction goal is completed, flags are often used to record additional state. Pairing has_country_flag with has_completed_goal allows for more granular condition checks.

Common Pitfalls

  1. Applying it to non-member countries: This trigger checks whether the country was a faction member at the time the goal was completed. If a country joined the faction only after the goal was already finished, the trigger will return false even if that country is currently in the faction — a logic error that frequently trips up newer modders.
  2. Confusing it with has_faction_goal: has_faction_goal checks whether a goal currently exists and has not yet been completed, whereas has_completed_goal checks the historical record of a completed goal. If a faction is dissolved and rebuilt, the former will no longer fire while the latter will still hold — make sure you know which behavior you actually need before using either.