Wiki

trigger · has_faction_goal

Definition

  • Supported scope:COUNTRY
  • Supported target:any

Description

Checks if the country's faction has an active or completed goal

### Examples

TAG = { has_faction_goal = goal_id }

实战 · 配合 · 坑

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

实战用法

has_faction_goal 常用于派系机制 mod 中,判断某个派系目标是否已经激活或完成,从而触发后续奖励、解锁选项或叙事事件。例如在自定义派系目标完成后,给予成员国政治点数或解锁特殊决议:

# 当派系已激活或完成某个目标时,才让该决议可用
available = {
    has_faction_goal = faction_goal_naval_supremacy
}

配合关系

  • [has_completed_faction_goal](/wiki/trigger/has_completed_faction_goal)has_faction_goal 检查目标是否处于激活完成状态,而此 trigger 专门判断目标是否已完成,两者搭配可区分"进行中"与"已完成"两个阶段的逻辑分支。
  • [add_faction_goal](/wiki/effect/add_faction_goal):通常先用该 effect 向派系添加目标,再用 has_faction_goal 作为后续条件检查,形成"添加→检测"的完整流程。
  • [faction_goal_fulfillment](/wiki/trigger/faction_goal_fulfillment):配合使用可在目标存在的前提下,进一步量化目标的完成进度,用于阶段性奖励判断。
  • [add_political_power](/wiki/effect/add_political_power):常见的"目标达成后发放奖励"模式,在 has_faction_goal 确认目标存在后,通过此 effect 给予对应国家激励。

常见坑

  1. 混淆激活与完成状态has_faction_goal 在目标激活中已完成时均返回真,若只想判断已完成的情况(例如发放最终奖励),应改用 has_completed_faction_goal,否则奖励可能在目标刚激活时就被错误触发。
  2. 目标 ID 拼写错误导致永远为假:goal_id 必须与 add_faction_goal 或派系目标定义文件中的 key 完全一致(区分大小写),写错 ID 不会报错但条件永远不满足,排查时需仔细核对 common/faction_goals/ 下的定义文件。

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_faction_goal is commonly used in faction mechanics mods to check whether a specific faction goal has been activated or completed, triggering subsequent rewards, unlocking options, or narrative events. For example, after a custom faction goal is completed, grant political power to member nations or unlock special decisions:

# Make the decision available only when the faction has activated or completed a specific goal
available = {
    has_faction_goal = faction_goal_naval_supremacy
}

Synergy

  • [has_completed_faction_goal](/wiki/trigger/has_completed_faction_goal): While has_faction_goal checks whether a goal is in an activated or completed state, this trigger specifically determines whether a goal has completed. Using both together allows you to distinguish logic branches between "in progress" and "completed" phases.
  • [add_faction_goal](/wiki/effect/add_faction_goal): Typically you first use this effect to add a goal to a faction, then use has_faction_goal as a subsequent condition check, forming a complete "add → detect" workflow.
  • [faction_goal_fulfillment](/wiki/trigger/faction_goal_fulfillment): Combined usage allows you to further quantify goal completion progress on the premise that the goal exists, useful for staged reward judgments.
  • [add_political_power](/wiki/effect/add_political_power): A common "reward upon goal completion" pattern—after has_faction_goal confirms the goal exists, use this effect to grant corresponding nation incentives.

Common Pitfalls

  1. Confusing activated and completed states: has_faction_goal returns true both when a goal is in progress and when it is completed. If you only want to check the completed state (for example, awarding final rewards), use has_completed_faction_goal instead. Otherwise, rewards may be incorrectly triggered as soon as the goal activates.
  2. Goal ID spelling errors causing perpetual false returns: The goal_id must exactly match the key in add_faction_goal or the faction goal definition file (case-sensitive). A typo won't generate an error but the condition will never be satisfied. When troubleshooting, carefully verify definitions in common/faction_goals/.