12-Jul-2023
Provides options for performing operations on an entity's keyvalue in relation to another keyvalue of another entity. This is a beefier version of trigger_changevalue. Supports custom keyvalues.
Keyvalues |
OnDestroy Function ondestroyfn : Name of the function to use from already parsed .as script files when entity is destroyed (killed) in any way. If the function belongs to namespace, you must use prefix with the namespace name (e.g. mynamespace::MyFunction) for the keyvalue.
Name targetname : Set name of trigger_copyvalue so other entities can trigger it to apply value change (or enable constant copier when "Constant" flag is checked). With "Constant" flag enabled the behaviour is based on trigger use-type: 'On'- turn constant copier on, 'Off'- turn constant copier off, 'Toggle'- toggle constant copier. With "Constant" flag disabled all use-types are accepted to copy once. Can be kill-targeted.
Source entity netname : Name of an entity to provide a source keyvalue for the operation.
Source key m_iszSrcValueName : Name of the source entity's keyvalue - the keyvalue which shall play the later part in the operation.
Destination entity target : Name of the one entity to have a keyvalue altered.
Destination key m_iszDstValueName : Name of the keyvalue to be written on the destination entity.
Action m_iszValueType : This specifies how destination keyvalue and static source-value correlate. What exactly happens also depends on the types of the two.
Float-to-string/-int conversion m_iFloatConversion : Specify how floats should be written to strings or converted into integers.
Trigonometric funcs. I/O m_trigonometricBehaviour : When using trigonometric or arc-functions, use this to specify what measure you are using as input, or which measure you expect as output (when using arc-functions).
Append spaces (for strings) m_iAppendSpaces : When the destination keyvalue is a string and you are setting it or appending to it, this specifies how many spaces to append to the end of the new string. This was implemented because Valve Hammer Editor cuts trailing spaces in keyvalues.
Trigger after action message : Entity to trigger after the operation. This is very useful when you require a logic chain of operations to achieve a specific effect, e.g. assemble a message for a game_text entity to print. This will also be triggered for every interval in constant mode, when set. Trigger use-type is 'Toggle'.
Copy-interval (seconds) dmg : When using constant mode, use this to specify the delay between intervals where the trigger_copyvalue performs its operation, in seconds. This defaults to 0.0 seconds, meaning once every server frame.
1 : Don't use X : When using vectors/arrays, this will ignore the first array. E.g., when setting render-color, specifying this flag would ignore the 'Red'-value.
2 : Don't use Y : When using vectors/arrays, this will ignore the second array. E.g., when setting angles, specifying this flag would ignore the 'Yaw'-value.
4 : Don't use Z : When using vectors/arrays, this will ignore the third array. E.g., when setting velocity, specifying this flag would ignore the vertical velocity.
8 : Constant : Makes trigger_copyvalue toggleable, and perform the specified operation on the destination keyvalue on every update interval (See "Copy-interval (seconds)" below) while it is activated.
16 : Start On : Causes this entity to be enabled from level load onward, this only makes sense in combination with "Constant".
32 : Invert target value : The destination keyvalue will be multiplied with minus one before proceeding.
64 : Invert source value : The source-value will be multiplied with minus one before proceeding; this change is only temporary and this keyvalue is rather useless, as you can always prepend a minus-sign to the static source-value.
128 : Multiple destinations : Causes trigger_copyvalue to affect all destination entities instead of only the first one found.
When source keyvalue type is a vector and destination keyvalue type is a float or integer, the length of the vector will be used for operation. Any vector-extents excluded with spawnflags will not contribute to the length. If only one vector-extent is used, it will be transmitted directly, meaning the original value, not the length/absolute value of it.
The spawnflags to exclude vector-dimensions affect source and destination keyvalue. When you set the value of a float or integer to a vector, only those vector-extents not excluded will be set to the value of the float/integer.
"Direction to Angles" and "Angles to Direction" are useful if you want to move something in the direction it's facing or force players to look in the direction of a train they are on. It's also very useful when you want to glue one entity to another and have it rotate around it. Direction vector is outputted normalized, meaning with a total length of exactly 1 unit.
You cannot copy the model from one brush entity to another brush entity, because additional actions are required for that to work. Use trigger_changemodel for that instead.
Writing to strings currently does continuously eat away at server memory because of how Valve did string-"management" in the Goldsource-engine; that means strings you have set remain in server memory unless it restarts, eventually causing memory to be full and the server to shut down. While this is rather obsolete (strings don't need much memory), try not to write them THAT often, e.g. not every server frame when in constant mode, but only every 0.3 seconds, at least when you assemble larger strings.
Constant mode with "Start On" doesn't work. Use delayed trigger_auto instead to activate this entity on map start.