Wiki

trigger · longest_war_length

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Check number of months the country has been at war

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

longest_war_length is commonly used to determine whether a country is caught in prolonged conflict, thereby triggering "war fatigue" events, unlocking specific decisions, or altering AI behavioral tendencies. For example, when a nation has been continuously at war for more than a certain number of months, you can make a specific peace negotiation option available:

# Use within the available block of a decision
available = {
    longest_war_length > 24   # This country has been at war continuously for more than 24 months
    has_war_support < 0.4
}

Synergy

  • [has_defensive_war](/wiki/trigger/has_defensive_war) — Frequently paired with longest_war_length to distinguish between "passive defensive prolonged warfare" and active offensive warfare, making trigger conditions more precise.
  • [has_war_support](/wiki/trigger/has_war_support) (Note: has_war_support is not whitelisted; use the alternative below) [has_bombing_war_support](/wiki/trigger/has_bombing_war_support) — Extended warfare typically coincides with declining war support; combining these two captures realistic war fatigue mechanics.
  • [casualties_k](/wiki/trigger/casualties_k) — Casualty count and war duration together measure conflict intensity; dual thresholds allow more accurate identification of "attrition warfare" scenarios.
  • [add_war_support](/wiki/effect/add_war_support) — Once conditions are confirmed, apply this effect to penalize or compensate war support, creating a complete logical loop of "longer duration → war support change."

Common Pitfalls

  1. Mistaking it for cumulative duration across all wars: This trigger measures the duration of the "longest individual war" in months. If a nation participates in multiple simultaneous conflicts, shorter wars' durations are not counted. Beginners often incorrectly design conditions as "total war participation time," resulting in trigger timing deviating from expectations.
  2. Using days instead of months in comparison values: Official documentation explicitly specifies "months" as the unit, but beginners sometimes carry over habits from other day-based triggers (such as days_since_capitulated), erroneously inputting day values, causing conditions to never trigger or trigger prematurely.