trigger_changevalue

From Sven Co-op
Revision as of 20:35, 28 May 2023 by Outerbeast (talk | contribs) (→‎Notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
trigger_changevalue
Type

point

Status

supported

 


Trigger_changevalue can perform arithmetic and logic operations on base-keyvalues of entities, as well as replace their private keyvalues. See trigger_copyvalue for a variant of this with more options. Supports custom keyvalues.

1 Keyvalues

Destination Entity : target

Name of the entity which's keyvalue is to changed. This can refer to more than one.

Destination Keyvalue : m_iszValueName

Name of the key which's value is to be changed.

Static source-value : m_iszNewValue

Value to be applied to the destination keyvalue.

Operation : m_iszValueType

Trigonometric funcs. I/O : m_trigonometricBehaviour

When using trigonometric or arc-functions as per the "Operation"-keyvalue, this is used to determine what your input/desired output measure is. You'll usually want to stick to degrees.

Append spaces (for strings) : m_iAppendSpaces

When the destination keyvalue is a string, this specifies how many spaces to append after the operations. You'll usually want to use this with either the "Replace"- or "Append"-operation. This was implemented because Valve Hammer Editor omits any trailing spaces in keyvalues (but not leading ones).

Trigger after operation : message

Set entity/entities to be triggered after the trigger_changevalue has set the new keyvalue, by targetname as usual. This is very useful when you need a chain of operations to happen in a specific order and without any delay in between.

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.

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.

3 Notes

  • Trigger_changevalue supports the use of "!activator" and "!caller" in the "Destination Entity" field.
  • Trying to write a vector to a float or integer will cause the vector's length to be written. This is in respect to any ignored dimensions as per spawnflags.

4 Issues

trigger_changetarget only changes the target of one entity, the first one it can find, if there are several entities of the same name that the changetarget targets - trigger_changevalue can update multiple entities at the same time if they share the same name, so this can be used instead.
This is fixed in 5.26.