Wiki

effect · set_political_power

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

set political power for country

实战 · 配合 · 坑

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

实战用法

set_political_power 常用于国家事件或焦点完成后,将政治权力重置到一个精确值,而非简单地增减——例如在某个剧情节点强制将玩家的政治权力归零以模拟政治危机,或在某国成立后将其初始政治权力设定为特定数值。

# 国家焦点完成后,将政治权力强制设为固定值
focus = {
    id = political_crisis
    ...
    completion_reward = {
        set_political_power = 0
    }
}

# 事件中将某国政治权力重置为标准起始值
country_event = {
    id = my_mod.1
    option = {
        name = my_mod.1.a
        set_political_power = 100
    }
}

配合关系

  • [add_political_power](/wiki/effect/add_political_power) — 两者互补:set_political_power 负责锚定绝对值,add_political_power 负责后续的相对增减,常在同一事件链中先定后加。
  • [add_stability](/wiki/effect/add_stability) — 政治权力的大幅重设往往伴随稳定度的调整,二者共同塑造国家政治状态的骤变感。
  • [has_country_flag](/wiki/trigger/has_country_flag) — 用标志位判断是否已经触发过重置,避免同一逻辑多次执行导致政治权力被反复归零。
  • [add_ideas](/wiki/effect/add_ideas) — 政治权力被清零或大幅设定后,通常需要同时赋予一个 idea 来反映新的政治格局,两者常在同一 option 块中配合。

常见坑

  1. add_political_power 混淆:新手常错误地在想要"直接设定某个数值"时使用 add_political_power,结果变成叠加而非覆盖。set_political_power 是赋值(覆盖),add_political_power 是累加,二者语义完全不同,混用会导致难以察觉的数值偏差。
  2. 忽略小数与上限机制:HOI4 的政治权力本身有内部上限,set_political_power 直接写入的值若超出游戏允许的范围,实际生效值会被截断,脚本不会报错但结果与预期不符,调试时需要在游戏内实际观察数值而非只看代码。

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_political_power is commonly used in national events or focus completion rewards to reset political power to a precise value rather than simply incrementing or decrementing it—for example, forcing the player's political power to zero at a critical story point to simulate a political crisis, or setting a newly-formed nation's initial political power to a specific amount.

# After national focus completion, force political power to a fixed value
focus = {
    id = political_crisis
    ...
    completion_reward = {
        set_political_power = 0
    }
}

# In an event, reset a nation's political power to standard starting value
country_event = {
    id = my_mod.1
    option = {
        name = my_mod.1.a
        set_political_power = 100
    }
}

Synergy

  • [add_political_power](/wiki/effect/add_political_power) — The two effects complement each other: set_political_power handles anchoring to an absolute value, while add_political_power handles subsequent relative adjustments. They are often used sequentially within the same event chain, setting first then adding.
  • [add_stability](/wiki/effect/add_stability) — Significant political power resets typically coincide with stability adjustments, and together they create a sense of dramatic shift in the nation's political state.
  • [has_country_flag](/wiki/trigger/has_country_flag) — Use flags to track whether a reset has already been triggered, preventing the same logic from executing multiple times and repeatedly zeroing political power.
  • [add_ideas](/wiki/effect/add_ideas) — After political power is zeroed or heavily adjusted, it usually requires simultaneously granting an idea to reflect the new political landscape. The two effects are commonly paired within the same option block.

Common Pitfalls

  1. Confusing with add_political_power: Beginners often mistakenly use add_political_power when they intend to "directly set a specific value," resulting in accumulation rather than overwriting. set_political_power is assignment (overwrite), while add_political_power is cumulative addition—the semantics are entirely different, and mixing them causes subtle numerical discrepancies that are hard to detect.
  2. Overlooking decimal handling and hard limits: HOI4's political power has an internal maximum cap. If the value written by set_political_power exceeds the game's permitted range, the actual in-game value will be truncated. The script will not report an error, but the result will differ from expectations. When debugging, observe the actual values in-game rather than relying solely on code inspection.