Wiki

effect · set_relation_rule

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS

Description

DEPRECATED: See add_relation_rule_override

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_relation_rule is a deprecated legacy command that was historically used to configure diplomatic relationship rules between nations (such as whether war declarations or trade are permitted). It was commonly seen in early mods during the initialization phase of faction or puppet relationships. Since the official codebase has marked it as DEPRECATED, any new mod should use add_relation_rule_override instead. If you are maintaining older mods and encounter this command, treat it as a migration marker.

# ❌ Old syntax (deprecated, not recommended for new mods)
GER = {
    set_relation_rule = {
        # Legacy parameter syntax, behavior no longer guaranteed
    }
}

# ✅ New syntax (should be replaced with)
GER = {
    add_relation_rule_override = {
        # Uses currently supported parameters
    }
}

Synergy

  • [add_relation_rule_override](/wiki/effect/add_relation_rule_override) — This is the official replacement. When migrating, you should directly rewrite the original logic using this command. The functional semantics remain the same but it receives continuous support.
  • [diplomatic_relation](/wiki/effect/diplomatic_relation) — Commonly paired with relation rule commands to simultaneously configure formal diplomatic status (such as guarantees, non-aggression pacts, etc.).
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — While adjusting relation rules, modify bilateral opinion ratings to keep diplomatic state and AI behavior alignment consistent.
  • [has_active_rule](/wiki/trigger/has_active_rule) — Used to check whether a specific relation rule is already active. Can be paired in conditional checks to avoid duplicate configurations.

Common Pitfalls

  1. Continuing to use this command in new mods: Due to game version iterations, DEPRECATED commands may be silently ignored by the engine or cause errors at any time. Directly copying old mod code containing set_relation_rule without replacing it with add_relation_rule_override will result in rules failing to take effect and becoming difficult to debug.
  2. Incorrectly assuming the scope can be STATE or CHARACTER: This command is only valid within a COUNTRY scope. If you place it within a state scope in an event's option block (for example, by entering through every_owned_state), the game will not report a syntax error but the command will be skipped, causing silent logic failure.