Wiki

trigger · mine_threat

Definition

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

Description

A trigger to check how dangerous enemy mines are for a country. Controlled by NAVAL_MINE_DANGER defines. Returns a value between 0 and 1. Example mine_threat > 0.5

实战 · 配合 · 坑

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

实战用法

mine_threat 常用于海军相关的决策或事件中,判断某国当前受到的敌方水雷威胁程度,从而触发扫雷动员、港口封锁应对等逻辑。例如当威胁超过阈值时自动给予相应的 idea 或触发警告事件:

# 在一个决策的 available 块中,仅当水雷威胁严重时才可激活紧急扫雷令
available = {
    mine_threat > 0.5
    has_war = yes
}

配合关系

  • [convoy_threat](/wiki/trigger/convoy_threat):水雷威胁与护航线威胁往往同步上升,二者联合判断可更精确地描述制海权恶化程度。
  • [fuel_ratio](/wiki/trigger/fuel_ratio):燃油比例偏低时往往意味着海上补给线受阻,与高水雷威胁组合可刻画严峻的海上态势。
  • [add_ideas](/wiki/effect/add_ideas):当 mine_threat 超过某阈值后,通过该 effect 给予扫雷动员或航运危机类 idea,形成"威胁→响应"的完整逻辑链。
  • [add_mines](/wiki/effect/add_mines):在敌方视角,可在 mine_threat 判断之后决定是否继续布雷,制造持续压制效果。

常见坑

  1. 忘记它只在 COUNTRY scope 下生效:将其写在 state 或 unit_leader scope 的 limit 块中会导致脚本静默失效甚至报错,务必确认外层 scope 是国家。
  2. 误以为返回值可以直接赋变量mine_threat 是一个数值比较型 trigger,必须配合比较运算符(><=)使用,写成 mine_threat = 1 表示"等于 1"而非"设置为 1",初学者常将其与 effect 混淆,或漏写比较符号导致语法错误。

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

mine_threat is commonly used in naval-related decisions or events to assess the degree of enemy mine threat a country is currently facing, thereby triggering mine-sweeping mobilization, port blockade countermeasures, and similar logic. For example, when the threat exceeds a threshold, it can automatically grant relevant ideas or trigger warning events:

# In the available block of a decision, emergency mine-sweeping orders can only be activated when mine threat is severe
available = {
    mine_threat > 0.5
    has_war = yes
}

Synergy

  • [convoy_threat](/wiki/trigger/convoy_threat): Mine threat and convoy threat typically rise in tandem; evaluating both together allows for more precise description of the degree of sea control deterioration.
  • [fuel_ratio](/wiki/trigger/fuel_ratio): Low fuel ratio often indicates disrupted maritime supply lines; combined with high mine threat, it portrays a severe maritime situation.
  • [add_ideas](/wiki/effect/add_ideas): When mine_threat exceeds a certain threshold, use this effect to grant mine-sweeping mobilization or shipping crisis ideas, forming a complete "threat → response" logic chain.
  • [add_mines](/wiki/effect/add_mines): From the enemy's perspective, after evaluating mine_threat, you can decide whether to continue laying mines to create sustained pressure.

Common Pitfalls

  1. Forgetting it only works in COUNTRY scope: Placing it in a limit block within state or unit_leader scope will cause the script to silently fail or error out; always ensure the outer scope is a country.
  2. Mistaking the return value as directly assignable to a variable: mine_threat is a numerical comparison trigger that must be used with comparison operators (>, <, =). Writing mine_threat = 1 means "equals 1" rather than "set to 1"; beginners often confuse it with effects or omit the comparison operator, causing syntax errors.