Wiki

trigger · has_rule

Definition

  • Supported scope:any
  • Supported target:none

Description

Checks if a rule set for a country.
Example: has_rule = can_puppet

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_rule is commonly used in mods to dynamically adjust AI behavior or event availability based on game rules, such as only displaying relevant decisions or event options when rules permit puppeting. It also works well within allowed / available blocks to ensure certain features are correctly enabled or hidden under different game rule configurations.

# This decision is only available when rules allow puppeting
available = {
    has_rule = can_puppet
    is_subject = no
}

Synergy

  • [has_game_rule](/wiki/trigger/has_game_rule): has_rule checks rules that apply to a specific nation, whereas has_game_rule checks global game rule options. They are often used together to cover different levels of rule verification.
  • [custom_trigger_tooltip](/wiki/trigger/custom_trigger_tooltip): When the native tooltip text for has_rule is not sufficiently intuitive, wrapping it in this allows you to customize the condition description displayed to players, improving UI readability.
  • [not](/wiki/trigger/not): Frequently paired with has_rule to negate the condition, expressing logic like "when a certain rule is disabled." For example, restricting nations that cannot be puppeted from following specific tech paths.
  • [or](/wiki/trigger/or): When multiple rule conditions only need to satisfy one of them, nest multiple has_rule statements within an or block to avoid writing redundant parallel condition blocks.

Common Pitfalls

  1. Misusing rule identifiers: The value of has_rule must be a rule identifier defined in-game (such as can_puppet). Beginners often confuse it with option values from has_game_rule or fill in non-existent strings, causing the condition to always evaluate to false without error, making debugging difficult.
  2. Ignoring scope context: Although this trigger supports any scope, it actually checks the rule state of the nation that the current scope points to. When called within every_state or province scopes, if you don't first switch back to nation scope via OWNER or similar methods, you may get unexpected evaluation results.