Wiki

trigger · has_government

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

does country government (ruling party) belong to ideology group

实战 · 配合 · 坑

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

实战用法

has_government 常用于政治类 mod 中,根据国家当前执政意识形态解锁或限制特定国策、决议和事件选项。例如,只允许法西斯政府触发某场政变事件,或为民主国家提供专属的外交加成决议。

# 在一个决议的 available 块中,限制只有法西斯政府才能执行
decision_example = {
    available = {
        has_government = fascism
    }
    cost = political_power
    ...
}

配合关系

  • [has_country_leader_ideology](/wiki/trigger/has_country_leader_ideology)has_government 检查执政党意识形态组,而 has_country_leader_ideology 检查具体领袖意识形态,两者搭配可以做到更精细的政治状态过滤。
  • [has_country_flag](/wiki/trigger/has_country_flag):常一起用于事件 trigger 块,先用 flag 记录已触发状态,再用 has_government 确认当前政体仍符合条件,防止政体改变后重复触发。
  • [add_popularity](/wiki/effect/add_popularity):在 effect 块中配套使用,当条件满足时为对应意识形态增加支持率,形成"当前政体 → 强化自身人气"的逻辑闭环。
  • [any_neighbor_country](/wiki/trigger/any_neighbor_country):在外交 AI 或事件中,遍历邻国时叠加 has_government 过滤,仅对意识形态相同的邻国触发结盟或干涉逻辑。

常见坑

  1. 混淆意识形态组与具体意识形态has_government 的值应填意识形态(如 fascismdemocraticcommunismneutrality),而不是子意识形态(如 nazismstalinism)。填写子意识形态不会报错但永远返回 false,极难排查。
  2. 政体切换后条件失效:在 focus 或 mission 的 available 中仅靠 has_government 把关,若玩家在进行途中通过内战或政变换了政体,条件会立即失效导致任务中断或无法完成,建议搭配 [has_country_flag](/wiki/trigger/has_country_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

has_government is commonly used in political mods to unlock or restrict specific national focuses, decisions, and event options based on a country's current ruling ideology. For example, you can allow only fascist governments to trigger a coup event, or provide exclusive diplomatic bonus decisions for democratic nations.

# In a decision's available block, restrict execution to fascist governments only
decision_example = {
    available = {
        has_government = fascism
    }
    cost = political_power
    ...
}

Synergy

  • [has_country_leader_ideology](/wiki/trigger/has_country_leader_ideology): has_government checks the ruling party's ideology group, while has_country_leader_ideology checks the specific leader's ideology. Combining both allows for more granular filtering of political states.
  • [has_country_flag](/wiki/trigger/has_country_flag): Frequently used together in event trigger blocks. First use a flag to record whether an event has been triggered, then use has_government to confirm the current government still meets conditions, preventing duplicate triggers after regime changes.
  • [add_popularity](/wiki/effect/add_popularity): Use together in effect blocks to add support for the corresponding ideology when conditions are met, creating a logical loop of "current government → reinforces own popularity."
  • [any_neighbor_country](/wiki/trigger/any_neighbor_country): When iterating through neighboring countries in diplomatic AI or events, stack has_government filters to trigger alliance or intervention logic only for neighbors with matching ideologies.

Common Pitfalls

  1. Confusing ideology groups with specific ideologies: The value for has_government should be an ideology group (such as fascism, democratic, communism, neutrality), not a sub-ideology (such as nazism, stalinism). Using sub-ideologies won't cause an error but will always return false, making it extremely difficult to debug.
  2. Conditions become invalid after regime change: If you rely solely on has_government in a focus or mission's available block, and the player changes their government through civil war or coup mid-completion, the condition immediately fails causing the mission to abort or become uncompletable. It's recommended to pair this with [has_country_flag](/wiki/trigger/has_country_flag) to lock the state at trigger time.