Wiki

effect · set_autonomy

Definition

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

Description

makes autonomy of specified level and country.
Example:
set_autonomy = {
  target=ENG 
  autonomy_state = autonomy_puppet 
  freedom_level=0.5 
  end_wars  = yes # default yes. will not cancel non-civil wars if set to no
  end_civil_wars = yes # default yes. will not cancel civil wars if set to no
}

实战 · 配合 · 坑

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

实战用法

set_autonomy 常用于 mod 中处理宗主-附庸关系的剧本事件,例如战后和约、焦点树触发的独立/吞并流程,或模拟历史上殖民地自治进程。以下示例展示宗主国通过国家焦点将附庸升格为傀儡:

# 在某国焦点完成效果中
set_autonomy = {
    target = PHI
    autonomy_state = autonomy_puppet
    freedom_level = 0.4
    end_wars = yes
    end_civil_wars = yes
}

配合关系

  • [has_autonomy_state](/wiki/trigger/has_autonomy_state) — 在执行 set_autonomy 前用于检测目标当前的自治等级,避免重复触发或逻辑冲突。
  • [compare_autonomy_progress_ratio](/wiki/trigger/compare_autonomy_progress_ratio) — 用于判断自治进度比例是否达到阈值,决定是否该触发等级变更。
  • [add_autonomy_score](/wiki/effect/add_autonomy_score) — 与 set_autonomy 搭配时,可先用其积累自治分数再强制设定最终状态,模拟渐进式独立流程。
  • [end_puppet](/wiki/effect/end_puppet) — 当需要完全解除附庸关系而非仅调整等级时,与 set_autonomy 形成高低两档的处理选项,视剧本分支灵活选用。

常见坑

  1. target 填写错误导致无效target 字段必须填写真实存在的国家标签(如 ENG),不能填 scope 关键字(如 THISROOT)——scope 关键字只在 set_autonomy 所在的上下文 scope 层生效,而 target 要求明确的国家标签或变量引用,混淆两者会导致效果静默失效。
  2. 忽略战争状态导致异常end_warsend_civil_wars 默认均为 yes,若目标国正处于战争中且不希望强制结束战争,必须显式写明 end_wars = no,否则可能意外终止与设计无关的战争,造成难以排查的逻辑 bug。

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_autonomy is commonly used in mod scripting for handling overlord-vassal relationships in event chains, such as post-war treaties, focus tree-triggered independence/annexation sequences, or simulating historical colonial autonomy progressions. The following example shows an overlord nation upgrading a vassal to puppet status through a national focus:

# In the completion effect of a certain nation's focus
set_autonomy = {
    target = PHI
    autonomy_state = autonomy_puppet
    freedom_level = 0.4
    end_wars = yes
    end_civil_wars = yes
}

Synergy

  • [has_autonomy_state](/wiki/trigger/has_autonomy_state) — Use before executing set_autonomy to check the target's current autonomy level, preventing duplicate triggers or logical conflicts.
  • [compare_autonomy_progress_ratio](/wiki/trigger/compare_autonomy_progress_ratio) — Determines whether the autonomy progress ratio meets a threshold to decide whether a tier change should be triggered.
  • [add_autonomy_score](/wiki/effect/add_autonomy_score) — When paired with set_autonomy, you can accumulate autonomy points first using this effect, then enforce the final state with set_autonomy, simulating a gradual independence process.
  • [end_puppet](/wiki/effect/end_puppet) — When you need to fully remove a vassal relationship rather than just adjust the tier, it forms a low/high-tier handling option with set_autonomy, flexibly chosen based on your event branch design.

Common Pitfalls

  1. Incorrect target field causing the effect to fail: The target field must contain a valid country tag (e.g., ENG) and cannot accept scope keywords (such as THIS, ROOT) — scope keywords only work within the context scope where set_autonomy is executed, while target requires an explicit country tag or variable reference. Confusing the two will cause the effect to silently fail.
  2. Overlooking war state leading to unintended behavior: Both end_wars and end_civil_wars default to yes. If the target nation is currently at war and you do not want to forcefully end the war, you must explicitly set end_wars = no. Otherwise, you may unexpectedly terminate wars unrelated to your design, creating hard-to-trace logic bugs.