trigger · is_fighting_in_terrain
Definition
- Supported scope:
COMBATANT - Supported target:
none
Description
check what terrain is in combat
is_fighting_in_terrainCOMBATANTnonecheck what terrain is in combat
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
is_fighting_in_terrain 常用于为特定地形中的战斗单位附加 modifier 或触发特殊事件,例如在沙漠、山地、丛林等地形赋予某些兵种专属加成。典型场景包括:制作地形专精特性 mod 时,限定只有在特定地形交战中才能触发某个决策或 on_action 事件。
# 在战斗事件中判断地形,给予沙漠作战加成
on_combat_phase = {
limit = {
is_attacker = yes
is_fighting_in_terrain = desert
}
add_temporary_combat_modifier = {
modifier = desert_warfare_bonus
}
}
is_fighting_in_terrain 只在 COMBATANT scope 下有效,若写在 country 或 state scope 的条件块中,游戏不会报错但永远返回 false,新手容易误以为是地形值写错而反复调试地形名称。00_terrain.txt 中定义的内部键名(如 desert、forest、mountain),而非本地化显示文本,两者不一致时条件同样静默失败。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.
is_fighting_in_terrain is commonly used to apply modifiers to units engaged in combat within specific terrain types or trigger special events, such as granting exclusive bonuses to certain unit types in deserts, mountains, jungles, and other environments. Typical scenarios include creating terrain-specialization mods where specific decisions or on_action events are only triggered when combat occurs in designated terrain.
# Check terrain during combat event and apply desert warfare bonus
on_combat_phase = {
limit = {
is_attacker = yes
is_fighting_in_terrain = desert
}
add_temporary_combat_modifier = {
modifier = desert_warfare_bonus
}
}
is_fighting_in_terrain is only valid in COMBATANT scope. If placed within a condition block in country or state scope, the game will not report an error but will always return false, leading inexperienced modders to repeatedly debug terrain names thinking they wrote the wrong terrain value.00_terrain.txt (such as desert, forest, mountain), not localized display text. When the two don't match, the condition likewise fails silently.