Hands-On Usage
multiply_variable is commonly used in dynamic value scaling scenarios, such as amplifying accumulated resource variables by a modifier coefficient, or multiplying base output by an efficiency multiplier in research/economy mods. The following example demonstrates multiplying the production_output variable by an efficiency coefficient of 1.5:
# In an option block of an event, scale the production variable to 1.5 times its original value
multiply_variable = {
var = production_output
value = 1.5
}
Synergy
[set_variable](/wiki/effect/set_variable): Typically use set_variable first to initialize the base value of a variable, then apply multiply_variable to adjust it by a multiplier. These two form the standard "initialize → scale" workflow.
[add_to_variable](/wiki/effect/add_to_variable): Combining multiplication and addition enables "multiply then add" composite formulas, simulating linear scaling logic with a fixed increment.
[check_variable](/wiki/trigger/check_variable): After multiplication operations, you typically need to verify whether the result crosses a certain threshold. Using check_variable as a conditional check prevents numerical runaway.
[clamp_variable](/wiki/effect/clamp_variable): Immediately clamp the multiplication result within upper and lower bounds to prevent extreme multipliers from causing variable overflow or unrealistic game states.
Common Pitfalls
- Multiplying without initializing the variable first: If the target variable has never been assigned a value by
set_variable, its default value is 0. Multiplying by any number still yields 0, which won't throw an error but silently produces incorrect results—easily missed by beginners.
- Writing
value as a bare variable name string instead of a numeric literal or var:xxx reference: If the value field needs to reference another variable, write it as value = var:some_var. Using a bare string causes script parsing failure or gets treated as 0.