Wiki

trigger · has_mines

Definition

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

Description

Checks if a region has amount of mines.
has_mines = {
    region = region_id
    amount = amount_of_mines
}

实战 · 配合 · 坑

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

实战用法

has_mines 常用于涉及海上封锁、港口防御或战略资源争夺的 mod 场景,例如在某个决策或任务中检测指定海域是否已布设足够数量的水雷,以决定是否解锁后续选项或给予奖励。典型场景是在海军战略 mod 里,要求玩家在特定海峡布雷达到阈值后才能触发封锁事件链。

# 在决策的 available 块中,检查波罗的海区域是否布雷足够
available = {
    has_mines = {
        region = 12   # 对应目标海区 region_id
        amount = 50
    }
}

配合关系

  • [add_mines](/wiki/effect/add_mines):最直接的搭档——先用 add_mines 向某海区布雷,再用 has_mines 检查是否达到触发阈值,形成"布雷→验证→奖励"的完整逻辑闭环。
  • [controls_state](/wiki/trigger/controls_state):常同时检测玩家是否控制该海区附近的关键沿岸州,确保只有真正掌控制海权的国家才能触发相关条件。
  • [has_navy_size](/wiki/trigger/has_navy_size)(注:此处仅举配合思路,以白名单为准)——实际可替换为 [any_controlled_state](/wiki/trigger/any_controlled_state):配合地域控制类 trigger,将布雷量检查与领土控制条件叠加,避免敌方也能意外触发己方专属决策。
  • [building_count_trigger](/wiki/trigger/building_count_trigger):在要求同时建有港口或海军基地的场景下,与 has_mines 共同构成"基础设施 + 水雷部署"的双重前提条件,提升 mod 的军事逻辑真实感。

常见坑

  1. region 填成 state_id 而非 region_idhas_mines 要求的是海区(strategic region)的数字 ID,而非陆地州 ID;两者数值范围有重叠,填错后脚本不会报错但条件永远无法正确求值,需在 map/strategicregions/ 文件夹中核对对应的 .txt 文件 ID。
  2. 在陆地战略区上使用:水雷机制仅作用于海洋/沿海战略区,若将 region 指向一个纯陆地区域,amount 始终为 0,条件恒假,导致依赖该 trigger 的决策或任务永远无法满足 available,新手往往误以为是脚本语法错误而反复排查。

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_mines is commonly used in mod scenarios involving naval blockades, port defense, or strategic resource competition. For example, it can be used in a decision or mission to detect whether a specified sea region has sufficient mine deployments, thereby determining whether to unlock subsequent options or grant rewards. A typical scenario is in a naval strategy mod where players must lay mines in a specific strait to reach a threshold before triggering a blockade event chain.

# In the available block of a decision, check if the Baltic region has sufficient mine deployments
available = {
    has_mines = {
        region = 12   # Corresponds to the target sea region region_id
        amount = 50
    }
}

Synergy

  • [add_mines](/wiki/effect/add_mines): The most direct companion—first use add_mines to lay mines in a sea region, then use has_mines to check if the trigger threshold is reached, forming a complete "lay mines → verify → reward" logic loop.
  • [controls_state](/wiki/trigger/controls_state): Often checked simultaneously to ensure the player controls key coastal states near the sea region, guaranteeing that only nations with true naval supremacy can trigger the related condition.
  • [has_navy_size](/wiki/trigger/has_navy_size) (note: synergy concept only; refer to whitelist for accuracy)—can be replaced with [any_controlled_state](/wiki/trigger/any_controlled_state): Combine with territorial control triggers to stack mine deployment checks with territory control conditions, preventing enemies from accidentally triggering faction-exclusive decisions.
  • [building_count_trigger](/wiki/trigger/building_count_trigger): When requiring simultaneously built ports or naval bases, work together with has_mines to form a "infrastructure + mine deployment" dual prerequisite, enhancing the military realism of the mod.

Common Pitfalls

  1. Filling region with state_id instead of region_id: has_mines requires the numeric ID of a strategic region (sea area), not a land state ID; the two ID ranges overlap, and filling in the wrong value won't trigger a script error but the condition will never evaluate correctly. You must cross-reference the corresponding .txt file ID in the map/strategicregions/ folder.
  2. Using on land strategic regions: The mine mechanism only applies to ocean/coastal strategic regions. If region points to a purely land-based area, amount will always be 0, making the condition permanently false, preventing any decision or mission relying on this trigger from satisfying available. Beginners often mistakenly believe this is a script syntax error and repeatedly debug the wrong area.