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 }
has_active_ruleCOUNTRYanyChecks if the country's faction has a specific active rule
### Examples
TAG = { has_active_rule = rule_key }
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
has_active_rule 常见于派系/阵营 mod 中,用于根据当前派系规则动态开放或锁闭决议、国策以及科技奖励。例如,当派系激活了某条禁止单独媾和的规则时,可以用它来屏蔽相关外交选项或触发事件警告。
# 若派系当前激活了"no_separate_peace"规则,则禁止该决议
GER = {
available = {
NOT = { has_active_rule = no_separate_peace }
}
}
[compare_ideology_with_faction](/wiki/trigger/compare_ideology_with_faction):检查国家与派系的意识形态关系,配合 has_active_rule 可同时约束"派系规则是否激活"与"意识形态是否匹配",实现更精细的条件门槛。[has_completed_faction_goal](/wiki/trigger/has_completed_faction_goal):先判断派系目标是否完成,再检查对应规则是否激活,常用于规则由目标完成后触发的链式逻辑。[faction_goal_fulfillment](/wiki/trigger/faction_goal_fulfillment):评估派系目标的完成度,与 has_active_rule 组合可判断"规则激活是否与目标进度相符",避免规则状态与目标状态脱节。[clear_rule](/wiki/effect/clear_rule):当条件不再满足时调用来清除规则,与 has_active_rule 配对使用,构成"检测→清除"的完整生命周期管理。has_active_rule 的参数是精确字符串匹配,如果 rule_key 与派系模板中定义的键名拼写不同(包括下划线、大小写),条件将永远返回假且不会报错,极难排查。[any_allied_country](/wiki/trigger/any_allied_country) 等方式确认国家已加入派系再进行判断。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.
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 }
}
}
[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".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.[any_allied_country](/wiki/trigger/any_allied_country) before making the judgment.