trigger_copyvalue

From Sven Co-op
Jump to navigation Jump to search
trigger_copyvalue
Type

point

Status

supported

 


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.

1 Keyvalues

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.

Operation : m_iszValueType

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 operation : message

Specify an entity or entities to be triggered 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.

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.

2 Flags

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

Does not work. Supposed to cause this entity to be enabled from level load onward, this only makes sense in combination with "Constant". Use delayed trigger_auto instead.

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.

3 Notes

  • 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 orignal 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. You must use trigger_changemodel by copying the model value to the trigger_changemodel itself, and then trigger it.

4 Issues

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.