trigger · is_in_faction_with
Definition
- Supported scope:
COUNTRY - Supported target:
THIS,ROOT,PREV,FROM,OWNER,CONTROLLER,OCCUPIED,CAPITAL
Description
check if member of same faction as specified country
is_in_faction_withCOUNTRYTHIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITALcheck if member of same faction as specified country
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
is_in_faction_with 常用于联盟外交类 mod 中,判断两国是否同属一个阵营,从而决定是否触发特定事件、解锁决议或限制战争目标。例如在设计"只有盟友才能共享情报"的 decision 时,可用此 trigger 作为 available 条件:
# 判断当前国家是否与德国同属一个阵营,才可执行此决议
available = {
is_in_faction_with = GER
}
[any_allied_country](/wiki/trigger/any_allied_country):遍历所有盟国时,可配合 is_in_faction_with 进一步确认某个盟国是否真正在同一阵营内(盟国与同阵营成员在边缘情况下并不完全等价)。[exists](/wiki/trigger/exists):在使用 is_in_faction_with 前先确认目标国家存在,避免因目标国家已亡导致 trigger 报错或静默失败。[add_to_faction](/wiki/effect/add_to_faction):常用于"若尚未同属阵营则强制拉入"的逻辑中,与 is_in_faction_with 做取反判断后执行加入操作。[has_defensive_war_with](/wiki/trigger/has_defensive_war_with):联合判断"同盟友处于防御战"场景,确定是否触发援助或自动参战类事件。exists 和阵营相关 trigger 做好前置过滤。is_in_faction_with 的 scope 是被判断的国家,target 是用来比较的国家,在嵌套 every_faction_member 或 any_allied_country 循环内使用时,容易将 THIS/ROOT/PREV 对应关系搞错,导致实际上在用同一个国家与自己比较,永远返回 true。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.
is_in_faction_with is commonly used in alliance diplomacy mods to determine whether two countries belong to the same faction, thereby deciding whether to trigger specific events, unlock decisions, or restrict war goals. For example, when designing a decision like "only allies can share intelligence," you can use this trigger as an available condition:
# Check if the current country belongs to the same faction as Germany before executing this decision
available = {
is_in_faction_with = GER
}
[any_allied_country](/wiki/trigger/any_allied_country): When iterating through all allies, combine with is_in_faction_with to further confirm whether a specific ally truly belongs to the same faction (allies and faction members are not entirely equivalent in edge cases).[exists](/wiki/trigger/exists): Before using is_in_faction_with, first verify that the target country exists to avoid trigger errors or silent failures caused by a defunct target nation.[add_to_faction](/wiki/effect/add_to_faction): Commonly used in logic like "if not already in the same faction, force them to join." Execute the join operation after negating is_in_faction_with.[has_defensive_war_with](/wiki/trigger/has_defensive_war_with): Combined judgment for "allies in a defensive war" scenarios to determine whether to trigger aid or auto-join war events.exists and faction-related triggers beforehand.is_in_faction_with is the country being judged, and the target is the country for comparison. When used within nested every_faction_member or any_allied_country loops, it's easy to misalign THIS/ROOT/PREV relationships, resulting in comparing the same country with itself, always returning true.