Wiki

effect · set_party_rule

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Adds rule to the country's party.
set_party_rule = { 
 ideologly = communism # [Required] selection criteria for the party desc = desc_key # a description can be given to rule (you can get original tooltip using DESC key) 
 can_not_declare_war = yes 
}

实战 · 配合 · 坑

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

实战用法

set_party_rule 常用于意识形态相关的剧情 mod 中,为特定执政党附加行为限制或特殊规则,例如在共产主义政党上台后禁止其主动宣战,或为法西斯党设置专属的外交约束描述。配合国策树或事件触发,可以精细控制某一意识形态政党在特定历史节点的行为边界。

# 在某国完成特定国策后,限制共产党宣战权
country_event = {
    id = my_mod.1
    immediate = {
        set_party_rule = {
            ideology = communism
            desc = party_rule_no_war_desc
            can_not_declare_war = yes
        }
    }
}

配合关系

  • [has_active_rule](/wiki/trigger/has_active_rule):在设置规则之前或之后,用来检测某条规则是否已经生效,避免重复设置或实现条件分支逻辑。
  • [clear_rule](/wiki/effect/clear_rule):与 set_party_rule 是一对互逆操作,当玩家完成特定条件后可用 clear_rule 移除之前设置的党派规则。
  • [add_popularity](/wiki/effect/add_popularity):通常在调整党派规则的同时修改该意识形态的支持率,二者共同塑造政治局势的变化。
  • [add_ideas](/wiki/effect/add_ideas):党派规则变更往往伴随国家思潮的增减,用 add_ideas 在同一执行块内同步附加对应的国家精神,保证叙事连贯。

常见坑

  1. ideology 字段拼写错误:官方定义示例中原文将该字段写作 ideologly(含笔误),实际脚本中请核对游戏版本所接受的正确字段名,并注意意识形态值必须是游戏内已定义的有效 ideology key(如 communismfascismdemocraticneutrality),填入自定义或不存在的值会导致规则静默失效。
  2. 忘记用 clear_rule 清理残留规则set_party_rule 设置的规则不会随政府更迭自动消失,若 mod 中存在意识形态切换逻辑,必须在适当时机主动调用 clear_rule 清除旧规则,否则规则会持续叠加并产生意外的行为限制。

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_party_rule is commonly used in ideology-related scripted event mods to attach behavioral restrictions or special rules to specific ruling parties. For example, it can be used to prohibit a communist party from declaring war after taking power, or to establish exclusive diplomatic constraints for a fascist party. Combined with focus trees or event triggers, it enables fine-grained control over the behavioral boundaries of an ideological party at specific historical moments.

# After a specific country completes a focus, restrict the communist party's war declaration rights
country_event = {
    id = my_mod.1
    immediate = {
        set_party_rule = {
            ideology = communism
            desc = party_rule_no_war_desc
            can_not_declare_war = yes
        }
    }
}

Synergy

  • [has_active_rule](/wiki/trigger/has_active_rule): Before or after setting a rule, use this to check whether a specific rule is already active, avoiding duplicate settings or enabling conditional branch logic.
  • [clear_rule](/wiki/effect/clear_rule): Functions as the inverse operation paired with set_party_rule. When players meet specific conditions, clear_rule can be used to remove previously set party rules.
  • [add_popularity](/wiki/effect/add_popularity): Typically used alongside adjusting party rules to modify the support level of that ideology, with both effects together shaping shifts in the political situation.
  • [add_ideas](/wiki/effect/add_ideas): Changes to party rules are often accompanied by additions or removals of national spirits. Use add_ideas within the same execution block to simultaneously attach corresponding national ideas, ensuring narrative consistency.

Common Pitfalls

  1. Typos in the ideology field: The official definition example contains a typo where this field is written as ideologly. In actual scripts, verify the correct field name accepted by your game version and ensure the ideology value is a valid ideology key already defined in the game (such as communism, fascism, democratic, or neutrality). Entering custom or non-existent values will cause the rule to silently fail to apply.
  2. Forgetting to clean up residual rules with clear_rule: Rules set by set_party_rule do not automatically disappear when the government changes. If your mod contains ideology-switching logic, you must actively call clear_rule at the appropriate moment to remove old rules. Otherwise, rules will accumulate and produce unexpected behavioral restrictions.