Wiki

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

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

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
}

Synergy

  • [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.

Common Pitfalls

  1. Target country not in any faction returns false rather than error: Beginners often mistakenly assume that any diplomatic relationship between the two parties (such as being mutual guarantors) will return true. In reality, both countries must simultaneously be formal members of the same faction; otherwise it always returns false. Perform pre-filtering using exists and faction-related triggers beforehand.
  2. Scope confusion causing incorrect judgment target: The scope of 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.