Wiki

trigger · career_profile_set_temp_playthrough_variable

Definition

  • Supported scope:any
  • Supported target:none

Description

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

实战 · 配合 · 坑

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

实战用法

在生涯模式相关 mod 中,当需要将生涯档案中某个持久化数值(如历史局数、总分)暂时搬到临时变量以便后续复杂计算时,可使用此 trigger。它本身在条件块中执行"赋值"动作并返回真,因此常嵌套在 ifcustom_trigger_tooltip 里,用于在不污染全局变量的前提下进行中间值处理。

trigger = {
    career_profile_set_temp_playthrough_variable = {
        var = temp_score_snapshot
        value = career_total_score
    }
    check_variable = {
        var = temp_score_snapshot
        value > 500
    }
}

配合关系

  • [check_variable](/wiki/trigger/check_variable) — 赋值之后立刻用 check_variable 对临时变量做数值比较,是最典型的连用模式。
  • [career_profile_check_playthrough_value](/wiki/trigger/career_profile_check_playthrough_value) — 两者配合可先把生涯数据快照到临时变量,再用专属的生涯数值检查进行多步条件判断。
  • [multiply_temp_variable](/wiki/trigger/multiply_temp_variable) — 拿到临时变量后对其做乘法缩放,便于将原始生涯数据换算为百分比或权重值再参与后续判断。
  • [if](/wiki/trigger/if) — 将此 trigger 置于 if 块的 limit 内,可实现"仅在满足某前置条件时才执行快照并继续后续判断"的分支逻辑。

常见坑

  1. 误当 effect 使用:新手有时把此 trigger 写进 immediate 或普通 effect 块,导致解析报错。它只能出现在 trigger / limit / available / allowed 等条件上下文中,若需要在 effect 中赋值临时变量应改用 [set_temp_variable](/wiki/effect/set_temp_variable)
  2. varvalue 字段混淆方向var 是被赋值的目标临时变量名,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 mode–related mods, when you need to temporarily move a persisted value from a career profile (such as match count or total score) into a temporary variable for subsequent complex calculations, this trigger can be used. It performs an "assignment" action within a condition block and returns true, making it commonly nested within if or custom_trigger_tooltip to handle intermediate values without polluting global variables.

trigger = {
    career_profile_set_temp_playthrough_variable = {
        var = temp_score_snapshot
        value = career_total_score
    }
    check_variable = {
        var = temp_score_snapshot
        value > 500
    }
}

Synergy

  • [check_variable](/wiki/trigger/check_variable) — Immediately after assignment, use check_variable to perform numerical comparisons on the temporary variable; this is the most typical usage pattern.
  • [career_profile_check_playthrough_value](/wiki/trigger/career_profile_check_playthrough_value) — Together, these allow you to snapshot career data into a temporary variable first, then use dedicated career value checks for multi-step conditional logic.
  • [multiply_temp_variable](/wiki/trigger/multiply_temp_variable) — After obtaining the temporary variable, apply multiplicative scaling to it, making it convenient to convert raw career data into percentages or weight values for subsequent evaluations.
  • [if](/wiki/trigger/if) — Place this trigger within the limit block of an if statement to implement branching logic: "only execute the snapshot and continue subsequent checks if certain preconditions are met."

Common Pitfalls

  1. Mistakenly using it as an effect: Beginners sometimes write this trigger into immediate or regular effect blocks, causing parse errors. It can only appear within condition contexts such as trigger, limit, available, or allowed. To assign temporary variables within an effect block, use [set_temp_variable](/wiki/effect/set_temp_variable) instead.
  2. Confusing the direction of var and value fields: var is the name of the target temporary variable being assigned, while value is the data source (which can be another variable name or a constant). Reversing them won't trigger an error but will produce completely incorrect data, making it extremely difficult to detect during troubleshooting.