Wiki

trigger · get_highest_scored_country_temp

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

calculates the highest scored country that is defined in a country scorer and sets it to a variable. Example: 
get_highest_scored_country_temp = { 
  scorer = scorer_id 
  var = var_name # variable name that the result will be stored. default is highest_scored_country 
}

实战 · 配合 · 坑

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

实战用法

get_highest_scored_country_temp 常用于动态外交或事件脚本中,在不修改游戏状态的情况下查询某个评分器(scorer)当前得分最高的国家,并将结果临时存入变量以供后续条件判断使用。例如,在一个决策的 available 块中,先用本 trigger 将得分最高的国家存入变量,再检查该变量是否符合特定条件:

available = {
    get_highest_scored_country_temp = {
        scorer = my_alliance_scorer
        var = top_alliance_candidate
    }
    # 之后可以通过 var:top_alliance_candidate 引用该国家
    var:top_alliance_candidate = { exists = yes }
}

配合关系

  • [get_highest_scored_country](/wiki/effect/get_highest_scored_country):effect 版本的同名命令,会实际将结果写入持久变量;当需要在 trigger 块中仅做判断时用 _temp 版,需要持久保存结果时改用 effect 版,两者配合可区分「只读查询」与「写入状态」的场景。
  • [get_sorted_scored_countries_temp](/wiki/effect/get_sorted_scored_countries_temp):同为基于 scorer 的查询系列,当需要获取前 N 名排列而非单一最高分国家时配合使用,逻辑上高度相关。
  • [get_sorted_scored_countries_temp](/wiki/trigger/get_sorted_scored_countries_temp):在同一条件块中,可先用 get_highest_scored_country_temp 确认最高分国家,再用此 trigger 获取完整排名列表做进一步筛选,两者共用同一套 scorer 体系。

常见坑

  1. 误将其当作 effect 使用:新手容易把此 trigger 写进 immediateeffect 块中期望它持久保存变量,但 _temp 版本存储的变量仅在当前 trigger 链求值期间有效,跨事件或跨 tick 后会失效,需要持久化时必须改用 effect 版的 get_highest_scored_country
  2. 忘记声明 scorerscorer 字段对应的 scorer 定义必须事先在 common/country_scorers/ 下注册,若拼写错误或文件未加载,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

get_highest_scored_country_temp is commonly used in dynamic diplomacy or event scripts to query the country with the highest score from a given scorer without modifying game state, then temporarily store the result in a variable for subsequent conditional checks. For example, in a decision's available block, you can first use this trigger to store the top-scoring country in a variable, then check if that variable meets specific conditions:

available = {
    get_highest_scored_country_temp = {
        scorer = my_alliance_scorer
        var = top_alliance_candidate
    }
    # The country can then be referenced via var:top_alliance_candidate
    var:top_alliance_candidate = { exists = yes }
}

Synergy

  • [get_highest_scored_country](/wiki/effect/get_highest_scored_country): The effect version of the same command, which actually writes results to a persistent variable. Use the _temp version when you only need to check within a trigger block, and switch to the effect version when you need to persist the result. Together, they distinguish between "read-only query" and "state mutation" scenarios.
  • [get_sorted_scored_countries_temp](/wiki/effect/get_sorted_scored_countries_temp): Also part of the scorer-based query family. Use this in conjunction when you need to retrieve the top N ranked countries rather than a single highest-scoring country. Logically highly related.
  • [get_sorted_scored_countries_temp](/wiki/trigger/get_sorted_scored_countries_temp): Within the same condition block, you can first use get_highest_scored_country_temp to confirm the highest-scoring country, then use this trigger to fetch the complete ranking list for further filtering. Both share the same scorer system.

Common Pitfalls

  1. Mistaking it for an effect: Beginners often write this trigger in immediate or effect blocks expecting it to persist variables, but the _temp version only keeps variables valid during the current trigger evaluation chain. After crossing event or tick boundaries, the variables become invalid. For persistence, you must use the effect version get_highest_scored_country.
  2. Forgetting to declare the scorer: The scorer field must reference a scorer definition previously registered in common/country_scorers/. If there's a typo or the file isn't loaded, the trigger fails silently (no error, but the result variable becomes empty), causing unexpected behavior in subsequent conditional checks that depend on that variable.