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
- 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.
- 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.