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
- 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.
- 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.