Wiki

trigger · province_vp

Definition

  • Supported scope:COMBATANT
  • Supported target:none

Description

Check if the victory points of the combatants province is larger or less than the provinded amount.
For example:
province_vp > 2
province_vp < 3

实战 · 配合 · 坑

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

实战用法

province_vp 常用于战斗事件或特殊 AI 决策 mod 中,让触发条件与战场所在省份的战略价值挂钩——例如只在高胜利点省份的交战中触发援军或特殊战斗修正。它在 COMBATANT scope(即交战方视角)内生效,典型场景是为争夺关键战略要地的战斗赋予额外叙事或机制。

# 示例:仅当交战省份胜利点较高时触发战斗事件
combat_event = {
    id = my_mod.1
    trigger = {
        is_attacker = yes
        province_vp > 3
    }
    ...
}

配合关系

  • is_attacker / is_defender:区分进攻/防守方后再判断胜利点高低,避免事件对双方重复触发造成逻辑混乱。
  • is_fighting_in_terrain:结合地形判断,可实现"在山地高价值省份作战"这类复合条件,增强战役的战略感。
  • is_winning:与胜负态势联动,当一方正在取得优势且省份价值高时触发特殊奖励或剧情,塑造"决战要地"感。
  • tag:限定特定国家才能触发该条件,防止 mod 事件被所有参战国滥触发。

常见坑

  1. Scope 混用province_vp 必须在 COMBATANT scope 下使用,新手容易将其写在 COUNTRY 或 STATE scope 的 trigger 块中,导致脚本报错或静默失效,需确认外层已进入战斗方 scope。
  2. 比较符号写法:官方语法要求使用 > / < 直接跟数值(如 province_vp > 2),新手有时错误地尝试写成 province_vp = { value > 2 } 等花括号形式,这在该 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

province_vp is commonly used in battle events or specialized AI decision mods to tie trigger conditions to the strategic value of the combat province—for example, triggering reinforcements or special combat modifiers only in high-victory-point provinces. It operates within COMBATANT scope (from the combatant's perspective), with typical use cases being adding narrative or mechanical weight to battles over key strategic locations.

# Example: Trigger a battle event only when the combat province has high victory points
combat_event = {
    id = my_mod.1
    trigger = {
        is_attacker = yes
        province_vp > 3
    }
    ...
}

Synergy

  • is_attacker / is_defender: Distinguish between attacking and defending sides before evaluating victory point thresholds, preventing event logic conflicts from double-triggering on both sides.
  • is_fighting_in_terrain: Combined with terrain checks, enables complex conditions like "fighting in mountainous high-value provinces," enhancing strategic depth in campaigns.
  • is_winning: Coordinate with battle momentum; trigger special rewards or narrative events when one side is gaining advantage and the province has high value, creating a sense of "decisive battle for key territory."
  • tag: Restrict triggers to specific nations, preventing mod events from being indiscriminately triggered by all combatants.

Common Pitfalls

  1. Scope Confusion: province_vp must be used within COMBATANT scope. Newcomers often mistakenly place it in trigger blocks within COUNTRY or STATE scope, causing script errors or silent failures. Always verify the outer scope has entered a combatant context.
  2. Comparison Operator Syntax: Official syntax requires using > / < directly with a numeric value (e.g., province_vp > 2). Beginners sometimes incorrectly attempt syntax like province_vp = { value > 2 } with curly braces, which is not valid for this trigger.