Wiki

trigger · has_stability

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

check value of stability 0-1: Example has_stability < 0.6

实战 · 配合 · 坑

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

实战用法

has_stability 常用于政治事件或国策分支中,根据国家稳定度高低触发不同结果,例如低稳定度时触发罢工事件、高稳定度时解锁特定国策选项。也常用于 available 块中限制某项决议只有在稳定度达标时才可激活。

# 示例:稳定度低于 0.5 时触发内乱事件
country_event = {
    id = my_mod.1
    trigger = {
        has_stability < 0.5
        NOT = { has_country_flag = unrest_event_fired }
    }
    ...
}

配合关系

  • [add_stability](/wiki/effect/add_stability):最直接的配套 effect,检测到稳定度不足后立即通过该 effect 进行奖惩调整,构成"判断→改变"的完整逻辑链。
  • [has_war_support](/wiki/trigger/has_war_support)(注:同类数值 trigger,写法完全对称)→ 实际列表中对应 [has_bombing_war_support](/wiki/trigger/has_bombing_war_support):稳定度与战争支持度往往联动设计,二者同时检测可反映国内政治健康程度。
  • [add_political_power](/wiki/effect/add_political_power):稳定度达到阈值时奖励政治点数,常见于国策完成后的条件性奖励 effect 块。
  • [has_country_flag](/wiki/trigger/has_country_flag):配合国家标记防止同一稳定度区间内重复触发事件,是事件去重的标准搭档。

常见坑

  1. 比较运算符写在 trigger 名后面而非值后面:正确写法是 has_stability < 0.6,新手容易误写成 has_stability = { value < 0.6 } 这种不存在的块语法,导致脚本报错或条件永远不成立。
  2. 忽略数值范围是 0–1 而非百分比:游戏 UI 显示的是百分比(如 60%),但脚本中必须使用小数(0.6),直接填写 60 会导致条件永远为真(因为实际值永远小于 60)。

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_stability is commonly used in political events or national focus branches to trigger different outcomes based on a nation's stability level—for example, firing unrest events when stability is low or unlocking specific focus options when stability is high. It is also frequently used in available blocks to restrict certain decisions so they can only be activated when stability meets the threshold.

# Example: Trigger internal unrest event when stability falls below 0.5
country_event = {
    id = my_mod.1
    trigger = {
        has_stability < 0.5
        NOT = { has_country_flag = unrest_event_fired }
    }
    ...
}

Synergy

  • [add_stability](/wiki/effect/add_stability): The most direct complementary effect. After detecting insufficient stability, immediately apply adjustments via this effect to create a complete "check → modify" logic chain.
  • [has_war_support](/wiki/trigger/has_war_support) (Note: similar numeric trigger with identical syntax) → corresponding [has_bombing_war_support](/wiki/trigger/has_bombing_war_support) in the actual list: Stability and war support are often designed to work together. Checking both simultaneously reflects overall domestic political health.
  • [add_political_power](/wiki/effect/add_political_power): Grant political power when stability reaches a threshold, commonly seen in conditional reward effect blocks after focus completion.
  • [has_country_flag](/wiki/trigger/has_country_flag): Pair with country flags to prevent duplicate event triggers within the same stability range—the standard companion for event deduplication.

Common Pitfalls

  1. Placing comparison operators after the trigger name rather than after the value: The correct syntax is has_stability < 0.6. Beginners often mistakenly write has_stability = { value < 0.6 }, which is invalid block syntax and causes script errors or conditions that never evaluate to true.
  2. Forgetting that numeric values range from 0–1, not percentages: The game UI displays percentages (e.g., 60%), but scripts must use decimals (0.6). Entering 60 directly will cause the condition to always be true (since the actual value is always less than 60).