Wiki

trigger · war_length_with

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Check number of months the country has been at war with X for Y months.
 war_length_with = { tag = X months > Y }

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

war_length_with is commonly used to trigger special events or unlock decisions during prolonged conflicts. For example, you can use it to unlock diplomatic negotiation options after fighting a specific nation for a certain number of months, activate war fatigue penalties, or enable peace settlement decisions. This trigger is also well-suited for AI behavior scripts, allowing the AI to shift strategy when a war drags on without resolution.

# Example: Enable a specific decision after fighting Germany for more than 18 months
available = {
    war_length_with = {
        tag = GER
        months > 18
    }
}

Synergy

  • [has_defensive_war_with](/wiki/trigger/has_defensive_war_with): First confirm that your country is in a defensive war with the target, then use war_length_with to check duration for more rigorous logic.
  • [has_war_support](/wiki/trigger/has_war_support) (equivalent to [has_bombing_war_support](/wiki/trigger/has_bombing_war_support) and similar): Prolonged wars often correlate with fluctuations in war support, combining checks allows for more nuanced trigger conditions.
  • [activate_targeted_decision](/wiki/effect/activate_targeted_decision): After meeting the war duration condition, use this effect to activate a specific decision targeting the enemy nation (such as peace negotiations or coercion).
  • [any_war_score](/wiki/trigger/any_war_score): By combining with war score checks, you can verify both "how long we've fought" and "how well we're doing," avoiding unreasonable triggers based solely on duration.

Common Pitfalls

  1. Incorrect case in tag field or using dynamic tags: The tag field must contain a fixed three-letter country code (like GER or SOV). If the target nation is generated through dynamic tag assignment, war_length_with cannot match correctly and the condition will never be satisfied.
  2. Assuming the month counter is "bidirectional": This trigger counts the continuous months of war between your current scope nation and the target. If the war ends due to a ceasefire agreement or annexation and then restarts, the counter resets. New modders often forget this and become confused when the condition suddenly stops working.