Wiki

trigger · career_profile_set_temp_variable

Definition

  • Supported scope:any
  • Supported target:none

Description

Sets a temporary variable to a value or another variable
Example: career_profile_set_temp_variable = {
var = num_dogs
	value = num_dogs_in_career_profile
}

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

In Career Profile-related mods, when you need to extract a specific statistic (such as kill count, victory count, etc.) stored in the career record into a temporary variable for subsequent conditional chain calculations, you can use this trigger. For example, copy a cumulative value recorded in the career profile to a local temporary variable, then perform mathematical operations on it before applying a threshold check:

trigger = {
    career_profile_set_temp_variable = {
        var = temp_career_wins
        value = career_wins_total
    }
    # Afterwards, you can continue to perform operations or checks on temp_career_wins
    check_variable = {
        var = temp_career_wins
        value = 10
        compare = greater_than_or_equals
    }
}

Synergy

  • [check_variable](/wiki/trigger/check_variable) — Use this command to write career profile values into a temporary variable first, then use check_variable to perform numerical comparison on that temporary variable. This is the most typical pairing workflow.
  • [add_to_temp_variable](/wiki/trigger/add_to_temp_variable) — After reading career values into a temporary variable, you can accumulate values from other sources and then perform unified checks, enabling multi-source data aggregation.
  • [multiply_temp_variable](/wiki/trigger/multiply_temp_variable) — After reading career values, multiply them by a coefficient (such as conversion ratio), then perform threshold comparison. Commonly used for normalization operations.
  • [career_profile_check_value](/wiki/trigger/career_profile_check_value) — Complementary functionality: if you only need simple career value comparison without secondary calculations, use this command directly as a replacement; if you need to transform before comparing, use this command in combination with career_profile_set_temp_variable.

Common Pitfalls

  1. Mistakenly using it as an effect: Although this command's name contains set, it is a trigger (conditional check) that can only be written in conditional blocks like trigger/limit/available. Writing it in an effect block will cause errors or silent failures. To actually write temporary variables on the effect side, use [set_temp_variable](/wiki/effect/set_temp_variable).
  2. Filling the value field with literal numbers instead of variable names: value should contain the name (identifier) of an existing variable in the career profile. If you mistakenly enter a hardcoded number, the assignment result may not match expectations and will not produce obvious error messages, causing all subsequent judgment logic that depends on that temporary variable to silently fail.