Wiki

trigger · convoy_threat

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

A trigger to check convoy threat for a country. Controlled by NAVAL_CONVOY_DANGER defines. Returns a value between 0 and 1. Example convoy_threat > 0.5

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

convoy_threat 常用于判断某国的护航船队受到的威胁程度,适合在海战相关的决策或事件中动态触发海军增援、改变战略方针等逻辑。例如,当威胁超过阈值时,自动激活某个应急海军决策或给予相关 idea。

# 当某国护航威胁超过 50% 时触发事件
country_event = {
    id = naval_crisis.1
    trigger = {
        convoy_threat > 0.5
        has_war = yes
    }
    ...
}

配合关系

  • [fuel_ratio](/wiki/trigger/fuel_ratio):燃料补给依赖护航线安全,两者配合可构建"护航受威胁且燃料不足"的复合危机判断。
  • [has_convoys_war_support](/wiki/trigger/has_convoys_war_support):护航损失直接影响国内战争支持度,组合使用可判断国内是否因护航危机引发士气动摇。
  • [add_war_support](/wiki/effect/add_war_support):当护航威胁达到阈值后,通过 effect 扣减战争支持度,模拟护航损失对民心的负面影响。
  • [add_ideas](/wiki/effect/add_ideas):护航形势恶化时赋予负面 idea(如封锁惩罚),恢复正常后再通过相反逻辑移除,实现动态状态机制。

常见坑

  1. 误将返回值当布尔值直接使用convoy_threat 返回 0~1 的浮点数,必须配合比较运算符(><)使用,直接写 convoy_threat = yes 是无效写法,不会报错但判断结果不可预期。
  2. 忽略 scope 限制:该 trigger 仅在 COUNTRY scope 下有效,若在 STATE 或 UNIT_LEADER 等 scope 中调用不会生效,新手容易在 any_owned_state 等子 scope 内错误地引用它而得不到预期结果。

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

convoy_threat is commonly used to assess the threat level faced by a nation's convoy routes, making it ideal for dynamically triggering naval reinforcements, adjusting strategic doctrines, and similar logic in naval combat decisions or events. For example, when the threat exceeds a threshold, you can automatically activate emergency naval decisions or grant related ideas.

# Trigger event when a nation's convoy threat exceeds 50%
country_event = {
    id = naval_crisis.1
    trigger = {
        convoy_threat > 0.5
        has_war = yes
    }
    ...
}

Synergy

  • [fuel_ratio](/wiki/trigger/fuel_ratio): Fuel supply depends on safe convoy routes; combining these two creates a composite crisis check for "convoys under threat AND fuel shortage".
  • [has_convoys_war_support](/wiki/trigger/has_convoys_war_support): Convoy losses directly impact domestic war support; using them together lets you detect if domestic morale is shaken by convoy crises.
  • [add_war_support](/wiki/effect/add_war_support): Once convoy threat reaches a threshold, use effects to reduce war support, simulating the negative impact of convoy losses on public morale.
  • [add_ideas](/wiki/effect/add_ideas): When convoy situations deteriorate, assign negative ideas (such as blockade penalties); remove them via inverse logic once conditions normalize, implementing a dynamic state machine.

Common Pitfalls

  1. Treating the return value as a boolean directly: convoy_threat returns a float between 0 and 1, so it must be used with comparison operators (>, <). Writing convoy_threat = yes is invalid syntax that won't cause an error but will produce unpredictable results.
  2. Ignoring scope restrictions: This trigger only works in COUNTRY scope. Calling it in STATE or UNIT_LEADER scopes will have no effect. Beginners often mistakenly reference it inside subscopes like any_owned_state and fail to get expected results.