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
}

实战 · 配合 · 坑

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

实战用法

在生涯模式(Career Profile)相关 mod 中,当需要将生涯档案里存储的某个统计值(如击杀数、胜利场次等)提取到临时变量以供后续条件链计算时,可使用此 trigger。例如,把生涯档案中记录的某项累计数值拷贝到本地临时变量,再对其进行数学运算后做阈值判断:

trigger = {
    career_profile_set_temp_variable = {
        var = temp_career_wins
        value = career_wins_total
    }
    # 此后可对 temp_career_wins 继续做运算或判断
    check_variable = {
        var = temp_career_wins
        value = 10
        compare = greater_than_or_equals
    }
}

配合关系

  • [check_variable](/wiki/trigger/check_variable) — 先用本命令把生涯档案数值写入临时变量,再用 check_variable 对该临时变量做数值比较,是最典型的搭配流程。
  • [add_to_temp_variable](/wiki/trigger/add_to_temp_variable) — 将生涯数值读入临时变量后,可叠加其他来源的数值再做统一判断,实现多数据源聚合。
  • [multiply_temp_variable](/wiki/trigger/multiply_temp_variable) — 读入生涯数值后对其乘以系数(如换算比率),然后再做阈值比较,常用于归一化处理。
  • [career_profile_check_value](/wiki/trigger/career_profile_check_value) — 功能互补:若只需单纯比较生涯数值而不需要二次运算,可直接用此命令代替;若需要先变换再比较,则搭配本命令使用。

常见坑

  1. 误把它当 effect 使用:此命令虽然名称含 set,但它是 trigger(条件判断),只能写在 trigger/limit/available 等条件块中,写入 effect 块会报错或静默失效,真正的 effect 侧写入临时变量请用 [set_temp_variable](/wiki/effect/set_temp_variable)
  2. value 字段填写字面数字而非变量名value 应填写生涯档案中已有的变量名(标识符),若误填硬编码数字,赋值结果可能不符合预期,且不会有明显报错提示,导致后续所有依赖该临时变量的判断逻辑全部静默错误。

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.