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.
"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 :
This specifies how destination keyvalue and static source-value correlate. What exactly happens also depends on the types
of the two. There are some academic things in here, so I shall explain some of them:
- Pow: Source value to the power of destination value. To keep things simple, zero to the power of zero magically equals one and taking a negative value to the power of a non-integer will cause the base to be treated as positive.
- Mod: Short for "Modulo", this calculates the rest of a division. For example, 63 % 13 equals 11, because 63 - 13 = 50,
50 - 13 = 37, 37 - 13 = 24 and 24 - 13 = 11. Substracting a fifth time would deliver a negative result and is henceforth omitted. The actual computation of this value uses a smarter, fast method; this is just for presentiveness. Usage example: You have a value in seconds, e.g. 285, and want to know how many minutes and seconds that are, so you divide by 60 and get 4.75. Omitting the 0.75 you're left with 4. For the remaining seconds, you'd calculate 285 % 60 = 45, which
is the same as 60 * 0.75. Then you'd know that 285 seconds equals 4 minutes plus 45 seconds. Real numbers and negative values are supported.
- AND, OR, XOR, NAND, NOR, NXOR: These are logic operands which operate bitwise; the leading 'N' indicates bitwise negation after the operation. Example: An entity's spawnflags are stored in an integer which consists of 32 bits. Say you want to set the 7th checkbox of an entity's spawnflags, you need to make sure the 7th bit is set to 1. You hence need the integer number where only the 7th bit is set, which is 2 ^ (7 - 1) = 2 ^ 6 = 64. However, you cannot simply add this
to the existing spawnflags, because if the 7th bit was already set to 1, you'd cause it to be set to 0 and generate a borrow which is sent to the 8th bit; the magic of positional notation systems - just as 500 + 500 equals 1000 in decimal,
100 + 100 equals 1000 in binary. You'd need to perform a bitwise OR. If you'd want only the 7th checkbox to be checked, you'd use replace-operation as usual. XOR means "Exclusive OR", as in "Either that or the other, but not both". AND means that both bits need to be 1 for the resulting bit to remain 1. You can imagine the logic operators perform
32 simultaneous operations on the combined 64 bits of two integers.
- Append (String concatenation): Appends your source value to the destination keyvalue. The later must be a string; otherwise this cannot work.
"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 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.
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.
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. 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.
|