Wiki

effect · set_victory_points

Definition

  • Supported scope:any
  • Supported target:any

Description

sets victory points for a province
set_victory_points = {
  province = 42
  value = 5
}

实战 · 配合 · 坑

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

实战用法

set_victory_points 常用于 mod 中动态调整战略要地的重要性,例如在某国完成特定国策或事件后将关键省份的胜利点数重置为期望值,以改变 AI 的进攻优先级或影响胜利条件判定。注意它会覆盖该省份现有的胜利点数,而非叠加。

# 某国完成"强化首都防御"国策后,将首都省份胜利点提升
complete_national_focus = {
    focus = strengthen_capital
    immediate = {
        set_victory_points = {
            province = 3600   # 省份 ID
            value = 10
        }
    }
}

配合关系

  • [add_victory_points](/wiki/effect/add_victory_points):当需要在现有基础上增量调整而非硬性覆盖时,与 set_victory_points 配合使用,两者互补形成完整的胜利点管理方案。
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip)set_victory_points 本身在 UI 中不会自动显示说明文字,配合此命令可向玩家展示可读的提示,改善体验。
  • [check_variable](/wiki/trigger/check_variable):在 if 块中用该触发器判断变量条件,决定是否执行 set_victory_points,实现按条件动态分配胜利点的逻辑。
  • [if](/wiki/effect/if):包裹 set_victory_points 实现条件分支,避免无条件地覆盖所有情况下的胜利点数值。

常见坑

  1. province 填的是州 ID 而非省份 IDprovince 字段需要填写地图上具体的省份(province)数字 ID,而非州(state)ID,两者极易混淆。可在游戏中开启调试模式,鼠标悬停省份查看正确 ID。
  2. 误以为会叠加而非覆盖set_victory_points 是硬性设置操作,会直接替换该省份当前的胜利点数。若想在原有基础上增加点数,应改用 add_victory_points,否则可能意外将精心配置的点数清零。

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

set_victory_points is commonly used in mods to dynamically adjust the importance of strategic locations. For example, after a nation completes a specific national focus or event, you can reset a key province's victory points to a desired value to alter AI attack priorities or influence victory condition checks. Note that it overwrites the province's existing victory points rather than adding to them.

# After a nation completes the "Strengthen Capital Defense" national focus, 
# increase the victory points of the capital province
complete_national_focus = {
    focus = strengthen_capital
    immediate = {
        set_victory_points = {
            province = 3600   # Province ID
            value = 10
        }
    }
}

Synergy

  • [add_victory_points](/wiki/effect/add_victory_points): When you need incremental adjustments based on existing values rather than hard overwrites, use this alongside set_victory_points to form a complete victory points management solution.
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip): set_victory_points does not automatically display explanatory text in the UI, so pair it with this command to show players readable tooltips and improve user experience.
  • [check_variable](/wiki/trigger/check_variable): Use this trigger within if blocks to check variable conditions and determine whether to execute set_victory_points, enabling conditional logic for dynamic victory point allocation.
  • [if](/wiki/effect/if): Wrap set_victory_points to implement conditional branches, preventing unconditional victory point overwrites across all scenarios.

Common Pitfalls

  1. Using state ID instead of province ID for province field: The province field requires the specific province numeric ID on the map, not the state (state) ID—the two are easily confused. You can enable debug mode in-game and hover over a province to view the correct ID.
  2. Assuming it adds instead of overwrites: set_victory_points is a hard set operation that directly replaces the current victory points of that province. If you want to add points to the existing value, use add_victory_points instead, otherwise you may accidentally zero out carefully configured point values.