Wiki

effect · add_mines

Definition

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

Description

Add mines to a strategic region for scoped country.
 add_mines = { region = 42 amount = 100 }

实战 · 配合 · 坑

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

实战用法

add_mines 常用于海战 mod 中模拟某国在特定战略海域布设水雷封锁线,例如在某事件触发后让玩家或 AI 国家在关键海峡区域增加雷区密度,迫使对手减慢海军推进速度。也适用于剧本式 mod 中,在战争爆发事件里自动为防守方布置初始水雷防线,营造真实的海防态势。

country_event = {
    id = my_mod.42
    # ...
    option = {
        name = my_mod.42.a
        # 本国在战略区域 42 布设 100 枚水雷
        add_mines = {
            region = 42
            amount = 100
        }
    }
}

配合关系

  • [has_country_flag](/wiki/trigger/has_country_flag):先检查国家是否已触发过布雷事件,避免水雷数量被重复叠加,常放在触发条件中做幂等保护。
  • [clr_country_flag](/wiki/effect/clr_country_flag) / [set_country_flag](/wiki/effect/set_country_flag)(此处用 [clr_country_flag](/wiki/effect/clr_country_flag)):布雷后清除或设置标记,配合 flag 机制控制布雷事件只执行一次或记录状态。
  • [create_wargoal](/wiki/effect/create_wargoal):在宣战或布雷封锁的同一事件选项中一并使用,让水雷布设与战争状态同步生效,符合战争开幕的叙事逻辑。
  • [convoy_threat](/wiki/trigger/convoy_threat):布雷后用此触发器持续检测该海域的护航威胁值变化,验证水雷对敌方补给线的实际压制效果,常用于 AI 策略判断。

常见坑

  1. region 填的是战略区域 ID 而非州 ID:新手容易把普通州(state)的编号直接填入 region 字段,导致效果无法生效或指向错误区域;需在 /map/strategicregions/ 目录下确认正确的战略海域 ID,且该区域必须是海洋战略区域,对陆地区域使用无实际意义。
  2. scope 必须是 COUNTRY 而非 STATEadd_mines 挂在国家 scope 下执行,若误写在 every_owned_stateany_controlled_state 等州级 scope 内部,脚本会报错或静默失败,应确保外层 scope 指向具体国家标签或通过 OWNER/ROOT 等合法 target 回溯到国家 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

add_mines is commonly used in naval warfare mods to simulate a nation deploying mine barriers in specific strategic sea regions. For example, after an event triggers, you can have the player or AI nation increase mine density in critical straits, forcing opponents to slow their naval advance. It's also suitable for scenario-based mods, where you automatically place initial mine defenses for the defending side when war breaks out, creating a realistic naval defense posture.

country_event = {
    id = my_mod.42
    # ...
    option = {
        name = my_mod.42.a
        # Deploy 100 mines in strategic region 42
        add_mines = {
            region = 42
            amount = 100
        }
    }
}

Synergy

  • [has_country_flag](/wiki/trigger/has_country_flag): Check first whether the nation has already triggered a mine-laying event to prevent mine counts from stacking repeatedly; commonly placed in trigger conditions as an idempotency guard.
  • [clr_country_flag](/wiki/effect/clr_country_flag) / [set_country_flag](/wiki/effect/set_country_flag) (use [clr_country_flag](/wiki/effect/clr_country_flag) here): Clear or set a flag after laying mines, working with the flag mechanism to ensure a mine-laying event executes only once or tracks state.
  • [create_wargoal](/wiki/effect/create_wargoal): Use together with mine deployment in the same event option as declaring war, so that mine-laying and war status take effect simultaneously, aligning with the narrative logic of war's opening.
  • [convoy_threat](/wiki/trigger/convoy_threat): After laying mines, continuously monitor changes to convoy threat values in that sea region with this trigger to verify the actual suppression effect of mines on enemy supply lines; commonly used in AI decision-making.

Common Pitfalls

  1. region expects a strategic region ID, not a state ID: Beginners often directly fill in the number of a regular state into the region field, causing the effect to fail or target the wrong area. You must verify the correct strategic sea region ID in the /map/strategicregions/ directory, and that region must be a naval strategic region; using it on land regions has no practical effect.
  2. scope must be COUNTRY, not STATE: add_mines executes under country scope. If mistakenly placed inside state-level scopes like every_owned_state or any_controlled_state, the script will error or silently fail. Ensure the outer scope points to a concrete country tag or uses legitimate targets like OWNER/ROOT to trace back to country scope.