Wiki

trigger · has_mined

Definition

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

Description

Checks the mines planted by the country of the parent scope on the coastline of the target countryE.g. true if Germany has more than 1000 mines around Poland coast:
GER = {
  has_mined = {
    target = POL
    value > 1000
  }
}

实战 · 配合 · 坑

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

实战用法

has_mined 常用于海战相关 mod 中,判断某国是否已在目标国海岸线布设足够数量的水雷,从而触发特定事件或解锁决策——例如封锁胜利条件、潜艇战奖励等。以下示例检测德国是否在英国海岸布设了超过 500 枚水雷,以激活封锁相关事件:

# 在某个 country_event 的 trigger 块中
GER = {
    has_mined = {
        target = ENG
        value > 500
    }
}

配合关系

  • [add_mines](/wiki/effect/add_mines):最直接的配合——先用 add_mines 向目标国海岸播雷,再用 has_mined 检测积累量是否达到阈值,形成"布雷→判断→奖励"的完整链条。
  • [convoy_threat](/wiki/trigger/convoy_threat):两者常同时出现在海上封锁判断逻辑中,水雷数量与护航威胁度共同衡量对敌方海上交通线的压制程度。
  • [controls_state](/wiki/trigger/controls_state):封锁 mod 里常与 has_mined 联用,确认己方同时控制了相邻沿海州,确保封锁在陆海两个维度同时成立。
  • [any_owned_state](/wiki/trigger/any_owned_state):可在 any_owned_state 遍历己方沿海州时配合使用,筛选出哪些沿岸确实已经布雷完毕。

常见坑

  1. scope 写反has_mined 的外层 scope 必须是布雷国(即实施布雷的一方),target 才是被布雷的目标国;新手容易把两者对调,写成在目标国 scope 下检测,导致条件永远不成立。
  2. value 比较符遗漏value 字段需要带比较运算符(如 value > 1000),直接写 value = 1000 属于语法错误,游戏日志会静默报错或忽略该 trigger。

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

has_mined is commonly used in naval warfare-related mods to detect whether a country has laid a sufficient number of mines along a target nation's coastline, thereby triggering specific events or unlocking decisions—such as blockade victory conditions, submarine warfare bonuses, and so forth. The following example checks whether Germany has laid more than 500 mines along the British coast to activate a blockade-related event:

# Within the trigger block of a country_event
GER = {
    has_mined = {
        target = ENG
        value > 500
    }
}

Synergy

  • [add_mines](/wiki/effect/add_mines): The most direct pairing—first use add_mines to lay mines along the target nation's coast, then use has_mined to detect whether the accumulated quantity has reached the threshold, forming a complete chain of "mine-laying → detection → reward".
  • [convoy_threat](/wiki/trigger/convoy_threat): The two often appear together in naval blockade logic, with mine quantity and convoy threat level jointly measuring the degree of pressure on the enemy's sea lines of communication.
  • [controls_state](/wiki/trigger/controls_state): In blockade mods, frequently used alongside has_mined to confirm that your side simultaneously controls adjacent coastal states, ensuring the blockade is established in both land and sea dimensions.
  • [any_owned_state](/wiki/trigger/any_owned_state): Can be used in conjunction when iterating through your own coastal states with any_owned_state, filtering which coastlines have actually completed mine-laying.

Common Pitfalls

  1. Reversed scope: The outer scope of has_mined must be the mining nation (the side executing the mine-laying), and target is the nation being mined; newcomers often swap the two, writing the check under the target nation's scope, causing the condition to never evaluate as true.
  2. Missing value comparison operator: The value field requires a comparison operator (such as value > 1000); writing value = 1000 directly is a syntax error that will cause the game log to silently fail or ignore the trigger.