Wiki

trigger · has_active_rule

Definition

  • Supported scope:COUNTRY
  • Supported target:any

Description

Checks if the country's faction has a specific active rule

### Examples

TAG = { has_active_rule = rule_key }

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

has_active_rule is commonly used in faction/alliance mods to dynamically enable or restrict decisions, national focuses, and technology rewards based on the current faction rules. For example, when a faction activates a rule prohibiting separate peace, it can be used to hide related diplomatic options or trigger warning events.

# If the faction currently has the "no_separate_peace" rule active, disable this decision
GER = {
    available = {
        NOT = { has_active_rule = no_separate_peace }
    }
}

Synergy

  • [compare_ideology_with_faction](/wiki/trigger/compare_ideology_with_faction): Checks the country's ideological alignment with its faction. Combined with has_active_rule, it can simultaneously constrain both "whether the faction rule is active" and "whether ideology matches", implementing more granular conditional thresholds.
  • [has_completed_faction_goal](/wiki/trigger/has_completed_faction_goal): First determines if a faction goal is completed, then checks if the corresponding rule is active. Commonly used for chained logic where rules are triggered after goal completion.
  • [faction_goal_fulfillment](/wiki/trigger/faction_goal_fulfillment): Evaluates the completion progress of a faction goal. Combined with has_active_rule, it can determine "whether rule activation aligns with goal progress", preventing desynchronization between rule state and goal state.
  • [clear_rule](/wiki/effect/clear_rule): Called to remove rules when conditions no longer apply. Used in tandem with has_active_rule to create a complete lifecycle management pattern of "check → clear".

Common Pitfalls

  1. Misspelled rule_key or inconsistent capitalization: The parameter for has_active_rule uses exact string matching. If the rule_key differs in spelling from the key name defined in the faction template (including underscores and capitalization), the condition will silently return false without error, making it extremely difficult to debug.
  2. Using it on countries without a faction: This trigger checks rules for "the country's current faction". If the target country doesn't belong to any faction, the condition silently returns false rather than throwing an error — newcomers often mistake this for a rule key naming issue, when they actually need to first confirm the country has joined a faction using methods like [any_allied_country](/wiki/trigger/any_allied_country) before making the judgment.