effect · set_relation_rule
Definition
- Supported scope:
COUNTRY - Supported target:
THIS
Description
DEPRECATED: See add_relation_rule_override
set_relation_ruleCOUNTRYTHISDEPRECATED: See add_relation_rule_override
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
set_relation_rule 是一个已废弃的旧版指令,历史上用于设置国家间的外交关系规则(如是否允许宣战、贸易等),在早期 mod 中常见于阵营关系或傀儡关系的初始化阶段。由于官方已将其标记为 DEPRECATED,任何新 mod 应改用 add_relation_rule_override 替代。若你在维护老旧 mod,见到此指令时请视其为迁移标记。
# ❌ 旧写法(已废弃,不推荐在新 mod 中使用)
GER = {
set_relation_rule = {
# 旧参数写法,行为已不受保证
}
}
# ✅ 新写法(应替换为)
GER = {
add_relation_rule_override = {
# 使用当前支持的参数
}
}
[add_relation_rule_override](/wiki/effect/add_relation_rule_override) — 这是官方指定的替代品,迁移时应直接用此指令重写原有逻辑,功能语义相同但受到持续支持。[diplomatic_relation](/wiki/effect/diplomatic_relation) — 常与关系规则类指令搭配,用于同步设置正式外交关系状态(如保证、不侵犯条约等)。[add_opinion_modifier](/wiki/effect/add_opinion_modifier) — 在调整关系规则的同时修改双边好感度,使外交状态与 AI 行为倾向保持一致。[has_active_rule](/wiki/trigger/has_active_rule) — 用于检测某条关系规则是否已生效,可在条件判断中配合使用以避免重复设置。set_relation_rule 的老 mod 代码而不替换为 add_relation_rule_override,会导致规则根本不生效且难以排查。option 中写在 state scope 内(例如通过 every_owned_state 进入后调用),游戏不会报语法错误但指令会被跳过,造成逻辑静默失败。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_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
}
}
[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.set_relation_rule without replacing it with add_relation_rule_override will result in rules failing to take effect and becoming difficult to debug.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.