Wiki

effect · set_stability

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Sets the stability to the country in scope. Example: set_stability = 80

实战 · 配合 · 坑

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

实战用法

set_stability 常用于国家焦点、决策或事件中直接将稳定度强制设置到某个固定值,例如内战结束后将稳定度重置到一个基准水平,或者在某个特殊剧情节点为玩家创造戏剧性的急剧变化。与 add_stability 不同,它不做加减而是直接覆盖,适合需要"硬性锁定"稳定度的场合。

# 内战结束事件:将稳定度重置为 40%
country_event = {
    id = civil_war.10
    ...
    option = {
        name = civil_war.10.a
        set_stability = 0.40   # 直接设为 40%,而非增减
    }
}

配合关系

  • [add_stability](/wiki/effect/add_stability):当需要先将稳定度归零再精确调整时,set_stability 做基准重置,add_stability 做后续微调,两者组合实现更灵活的稳定度管理。
  • [add_war_support](/wiki/effect/add_war_support):稳定度与战争支持度通常同步变化,执行重大剧情节点时往往需要同时设置两者,保持国家状态的内部一致性。
  • [has_country_flag](/wiki/trigger/has_country_flag):用 flag 做前置条件判断,确保 set_stability 只在特定剧情阶段触发一次,避免重复执行导致数值异常。
  • [add_ideas](/wiki/effect/add_ideas):某些 idea(顾问/国策加成)会持续修正稳定度,因此在 set_stability 之后立即添加或移除相关 idea,确保最终稳定度符合设计预期。

常见坑

  1. 数值范围误解:部分新手沿用旧版认知,以为填写整数(如 80)代表 80%,但实际上该 effect 接受的是 0 到 1 之间的小数0.80 才是 80%),直接填 80 会将稳定度钉满至上限或产生意外结果,务必确认脚本中使用小数形式。
  2. 与 modifier 叠加的误判set_stability 设置的是基础值,而国家身上挂载的各类 modifier(来自 idea、动态 modifier 等)会在此基础上继续叠加,所以实际游戏中显示的稳定度往往与填写的数值不同,调试时不要误以为命令没有生效。

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

set_stability is commonly used in national focuses, decisions, or events to forcefully set stability to a fixed value. For example, resetting stability to a baseline after a civil war concludes, or creating dramatic swings at key story moments for dramatic effect. Unlike add_stability, which performs addition or subtraction, set_stability overwrites the existing value directly—ideal for scenarios requiring "hard-locking" stability.

# Civil war conclusion event: reset stability to 40%
country_event = {
    id = civil_war.10
    ...
    option = {
        name = civil_war.10.a
        set_stability = 0.40   # Set directly to 40%, not incremental change
    }
}

Synergy

  • [add_stability](/wiki/effect/add_stability): When you need to reset stability to zero first and then fine-tune, use set_stability for the baseline reset and add_stability for subsequent micro-adjustments. Together they enable more flexible stability management.
  • [add_war_support](/wiki/effect/add_war_support): Stability and war support typically shift in tandem. Major story events often require setting both simultaneously to maintain internal consistency of national state.
  • [has_country_flag](/wiki/trigger/has_country_flag): Use flags as preconditions to ensure set_stability fires only once at a specific story stage, preventing duplicate executions that cause numerical anomalies.
  • [add_ideas](/wiki/effect/add_ideas): Certain ideas (advisors/national spirit bonuses) continuously modify stability. Add or remove relevant ideas immediately after set_stability to ensure the final stability matches your design intent.

Common Pitfalls

  1. Decimal range misunderstanding: Some newcomers carry over outdated assumptions, thinking integers like 80 represent 80%, but this effect actually expects decimals between 0 and 1 (0.80 is 80%). Writing 80 directly will either cap stability at the upper limit or produce unexpected results. Always confirm you're using decimal notation in your scripts.
  2. Miscalculation of modifier stacking: set_stability sets the base value, but various modifiers applied to the country (from ideas, dynamic modifiers, etc.) stack on top of that base. The actual in-game stability display often differs from the written value. Don't assume the command failed during debugging—verify modifier calculations first.