trigger_changevalue

A trigger_changevalue changes a key of other entities while the map runs. It replaces the value, or it combines the
current value with a new one, for example by adding, multiplying or appending text. See Changing
keys for every rule, and the Changing values guide for
small setups.
Attributes
The entity also has these common keys:
- Naming and triggering: Name
targetNames the entities to change: every entity with this name, or !activator or !caller.
m_iszValueNameNames the key to change by its key name, such as health, rendercolor or target, or a custom key such as $i_count.
m_iszNewValueSets the new value, as a number, three numbers x y z or text. A single value can also be a named constant, in capitals or not, such as FL_ONGROUND, SOLID_NOT, EF_NODRAW, MOVETYPE_FLY, kRenderTransAdd or CLASS_PLAYER. A ~ in front of a constant flips all its bits.
m_iszValueTypeSets the operation.The 31 choices
Replace (= new value) (0)m_trigonometricBehaviourSets the unit of the angle operations.
- Degrees (0) - Sin, Cos, Tan and Cot take the value in degrees, and Arcsin, Arccos, Arctan and Arccot give degrees, so the sine of 30 is 0.5
- Radians (1) - Both are in radians
Degrees (0)m_iAppendSpacesFor text, adds this many spaces after the result, up to 255.
0messageFires this target after the change. It can be a name, !activator or !caller.
value_typeSets whether the entity uses New value as you wrote it or as a locus key. A locus key is worked out for the activator each time the entity fires.
- Literal value (0)
- Locus Ratio (1)
- Locus Position (2)
- Locus Velocity (3)
Literal value (0)Flags
1Don't use XThe X of a vector stays as it is
2Don't use YThe Y of a vector stays as it is
4Don't use ZThe Z of a vector stays as it is
32Invert target valueThe current value becomes negative before the operation
64Invert source valueThe new value becomes negative before the operation
Notes
- Any use type triggers the change. The entity writes the new value the way the map loader writes a key, so it works on every key that the entity reads from the map
- If you put three numbers such as
0 0 50into a key that holds a single number, the key gets the vector's length, here 50. If the second and the third number are 0, as in-30 0 0, the key gets the first number, here -30 - Three numbers go into a vector key part by part, so
64 0 0with Add moves anorigin64 units along X only. A single number such as2goes into every part - A division or a modulo by zero leaves the value as it was
- You can only replace a key that the game can't read back. Any other operation leaves it as it is, and with
developer 1set in the console, the console says so - The entity refuses keys that name a model or a sound, because nothing can be precached while the map runs. It also
refuses
classnameandheadscale. Withdeveloper 1set in the console, the console shows each refused key - Setups from Sven Co-op carry over, because the class names, key names, flags and operation numbers are the same
See also
trigger_copyvalue- copies a key of one entity into otherstrigger_condition- compares a key with a value- Changing keys - every operation and what can change
Changes since 1.38
trigger_changevalueis new

