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 }
war_length_withCOUNTRYnoneCheck number of months the country has been at war with X for Y months.
war_length_with = { tag = X months > Y }
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
war_length_with 常用于在长期战争中触发特殊事件或解锁决议,例如当玩家与某国交战超过一定月数后开放外交谈判选项、激活战争疲惫惩罚或允许媾和决议。该 trigger 也适合用于 AI 策略脚本中,让 AI 在久拖不决的战争中改变行为方针。
# 示例:与德国交战超过 18 个月后可激活某项决议
available = {
war_length_with = {
tag = GER
months > 18
}
}
[has_defensive_war_with](/wiki/trigger/has_defensive_war_with):先确认己方处于对目标国的防御战状态,再用 war_length_with 判断持续时长,逻辑更严谨。[has_war_support](/wiki/trigger/has_war_support)(即 [has_bombing_war_support](/wiki/trigger/has_bombing_war_support) 等同类):长期战争往往伴随战争支持度变化,组合检查可做出更细腻的触发条件。[activate_targeted_decision](/wiki/effect/activate_targeted_decision):满足交战时长条件后,用此 effect 激活针对目标国的特定决议(如媾和、施压等)。[any_war_score](/wiki/trigger/any_war_score):结合战争分数判断,可同时检验"打了多久"与"打得怎么样",避免仅凭时长就触发不合理结果。tag 字段必须填写固定的三字母国家标签(如 GER、SOV),若目标国是通过动态 tag 生成的势力,war_length_with 无法正确匹配,会导致条件永远不满足。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.
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
}
}
[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.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.