trigger · dig_in
Definition
- Supported scope:
COMBATANT - Supported target:
none
Description
check if we have digin level (lowest)
dig_inCOMBATANTnonecheck if we have digin level (lowest)
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
dig_in 常用于判断战斗中某一方是否已构筑工事阵地,适合在自定义战斗事件或特殊战术 modifier 触发条件中使用——例如当防守方已挖壕时为其额外加成,或触发特定剧本事件。典型场景是防线坚守类 mod,需要区分"仓皇应战"与"预设阵地防御"两种状态。
# 在战斗事件的 trigger 块中判断防守方是否已挖掘阵地
trigger = {
is_defender = yes
dig_in = yes
}
[is_defender](/wiki/trigger/is_defender) — 挖掘阵地通常只对防守方有意义,两者配合可精确筛选"防守且已挖壕"的战斗状态,避免误触发。[has_combat_modifier](/wiki/trigger/has_combat_modifier) — 可在确认 dig_in 后进一步检查是否叠加了特定战斗修正,用于判断强化防御的复合条件。[min_planning](/wiki/trigger/min_planning) — 挖壕与规划度密切相关,组合使用可区分"有计划地固守"与"临时挖壕"两种情形。[is_fighting_in_terrain](/wiki/trigger/is_fighting_in_terrain) — 不同地形下壕沟效果差异显著,联合地形判断可为山地、要塞地形设计专属触发逻辑。dig_in 用在非 COMBATANT scope 下:此 trigger 仅在战斗内部 scope(COMBATANT)生效,若误写在国家或将领 scope 下脚本会静默失败或报错,新手容易因复制粘贴而忽略 scope 切换。dig_in 只返回布尔值(是否有最低挖壕),无法用于比较具体的挖壕层级数字,若需要更细粒度的判断应查找其他相关字段,切勿自行传入数值参数。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.
dig_in is commonly used to determine whether one side in a battle has constructed entrenchments, making it suitable for use in custom battle events or special tactical modifier trigger conditions—for example, granting additional bonuses to the defending side when entrenchments are in place, or triggering specific scripted events. A typical scenario is defensive line holding mods that need to distinguish between "hasty engagement" and "prepared position defense" states.
# Check within a battle event's trigger block whether the defender has dug in
trigger = {
is_defender = yes
dig_in = yes
}
[is_defender](/wiki/trigger/is_defender) — Entrenchment typically only has meaning for the defending side; combining the two allows precise filtering of "defending and dug in" battle states, avoiding unintended triggers.[has_combat_modifier](/wiki/trigger/has_combat_modifier) — After confirming dig_in, you can further check whether specific combat modifiers have been stacked, useful for evaluating compound conditions of reinforced defense.[min_planning](/wiki/trigger/min_planning) — Entrenchment is closely tied to planning percentage; combined use allows distinguishing between "planned entrenchment" and "improvised digging in" scenarios.[is_fighting_in_terrain](/wiki/trigger/is_fighting_in_terrain) — Entrenchment effectiveness varies significantly across different terrains; combined terrain checks allow designing dedicated trigger logic for mountainous or fortress terrain.dig_in outside COMBATANT scope: This trigger only functions within battle-internal scope (COMBATANT); if mistakenly written under country or leader scope, the script will fail silently or error out. Newcomers often overlook scope switching due to copy-pasting.dig_in only returns a boolean (whether minimum entrenchment exists), not specific entrenchment tier numbers. For finer-grained checks, consult other related fields instead; do not attempt to pass numeric parameters to it.