effect · set_faction_rule
Definition
- Supported scope:
COUNTRY - Supported target:
none
Description
Set a rule on the country's faction
### Examples
TAG = { set_faction_rule = rule_id }
set_faction_ruleCOUNTRYnoneSet a rule on the country's faction
### Examples
TAG = { set_faction_rule = rule_id }
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.
set_faction_rule is commonly used in mods to implement custom faction mechanics, such as restricting how faction members declare wars, make diplomatic decisions, or share resources, thereby introducing unique organizational constraints to factions. A typical scenario involves applying a special rule to a faction after a nation completes a national focus, fundamentally altering how the faction operates.
focus_complete = {
id = my_focus_restrict_faction_wars
TAG = {
set_faction_rule = faction_cannot_justify_wargoals
}
}
[create_faction](/wiki/effect/create_faction): Set rules immediately after faction creation to ensure the new faction is subject to constraints from its inception; this is the most common pairing sequence.[clear_rule](/wiki/effect/clear_rule): Acts as the inverse operation to set_faction_rule, allowing you to remove previously set faction rules when conditions change, forming a complete rule toggle mechanism.[has_active_rule](/wiki/trigger/has_active_rule): On the trigger side, detect whether a specific rule is currently active to serve as a precondition for decisions or events, working together with set_faction_rule to create a "set–check" loop.[add_faction_goal](/wiki/effect/add_faction_goal): Typically configured alongside faction rules, assigning faction goals while setting rules to keep behavioral constraints and goal orientation consistent.set_faction_rule requires the execution scope to be the nation that owns the faction (typically the faction's creator). If called within the scope of a regular member nation, the rule will not bind correctly to the faction and will silently fail with no error messages, making this mistake particularly insidious.faction_rules definition file: Directly entering an unregistered ID will not automatically create a rule; the game will simply ignore the command. Beginners often mistakenly assume any arbitrary string can be used as a rule ID.