trigger_condition

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

point

Status

supported

 


A, by default, toggleable entity, which, while activated, will compare any value of any entity's key with either a specified value or the keyvalue of another entity, using a specified comparator and fire its target for the according result - true or false - whenever the result of the condition changes (by default) or at the instant the trigger_condition entity is activated manually. While activated, the trigger_condition checks its condition every 0.1 seconds, by default. Supports custom keyvalues.

1 Keyvalues

Monitored entity : target

Name of the entity of which a keyvalue is to be monitored. The target entity may be removed in the process. Only one entity by this name should exist.

Monitored key : m_iszValueName

Name of the key which's value is to be compared to the value of the compare-key.

Compare-entity : m_iszSourceName

Name of the entity of which a keyvalue shall serve as a compare-value. Only one entity by this name should exist.

Compare-key : m_iszSourceKey

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

Compare-value (alternative) : m_iszCheckValue

If you do not want to compare the monitored keyvalue to the keyvalue of another entity, you can directly specify a value here. Leave "Compare-entity" empty in that case.

Comparator; mon. val. -> comp.-val. : m_iCheckType

Set the comparation type between monitored keyvalue and the other compare value.

Target for 'true'-case : netname

Target to trigger in case the condition is true. (Use-type always 'Toggle')

Target for 'false'-case : message

Target to trigger in case the condition is false. (Use-type always 'Toggle')

Constant mode trigger behaviour : m_iCheckBehaviour

If the trigger_condition uses constant/non-cyclic/toggle-mode, this specifies how it will fire its true- and false-target. The default is to wait for the condition to change in order to trigger a target. You can set it to trigger regardless of the previous result on every interval, or only wait for true-case after a false-case, or only wait false-case after a true-case.

Check-interval (seconds) : m_fCheckInterval

If the trigger_condition is toggleable/constant, this specifies the delay between check-intervals, in seconds. Set to 0.0 to check every server-frame. Default is 0.1 seconds.

2 Flags

1 : Start off

The trigger_condition starts off and has to be triggered on manually in order to work; this is automatically the case when it is cyclic.

2 : Don't use X (R)

When using vectors/arrays, this will ignore the first array.

4 : Don't use Y (G)

When using vectors/arrays, this will ignore the second array.

8 : Don't use Z (B)

When using vectors/arrays, this will ignore the third array.

16 : Don't use W (A)

When using vectors/arrays, this will ignore the fourth array.

32 : Cyclic; no toggle

Changes the trigger_condition's behaviour to a single-fire-behaviour. With this flag set, the entity will fire a target according to its condition's result once, and then idle until triggered again.

64 : Keep '!activator'

Because of trigger_condition's default behavior, the reference to the original activator is overwritten with the trigger_condition itself, because of an expected delay between activating the trigger_condition and a change in its condition's result; within this delay the original activator could have been removed already and thus cause unwanted behaviour when used. Because of that, you have to explicitly enable this flag for the activator to be forwarded normally. This is only dangerous to use if an entity triggered by trigger_condition will expect the activator to refer to a valid entity.

128 : Ignore initial result

If this is set and this trigger_condition is not set to be cyclic, every time you activate it, the very first result it produces will be ignored and nothing will be triggered, and it will proceed normal according to the specified trigger-behaviour.

3 Notes

  • Trigger_condition supports the use of "!activator" and "!caller" in the "Monitored entity"- and "Compare-entity"-fields.
  • The type of comparison can depend on the types of the monitored keyvalue and comparison keyvalue. E.g. comparing a string "0 0 0" from monitored keyvalue to a vector { 0.0 0.0 0.0 } will cause the vector to be transformed into the string "0.000000 0.000000 0.000000". The string "0 0 0" is not equal to the string "0.000000 0.000000 0.000000". However, comparing a vector { 0.0 0.0 0.0 } from monitored keyvalue to a string "0 0 0" will cause the string to be parsed into another vector { 0.0 0.0 0.0 } which then is equal to the vector in the monitored keyvalue.
    • Comparing a vector to an integer or float will cause the length of that vector to be compared. (This works either way round) This happens in regards to the vector-dimension-exclusion keyvalues. Exception: If you exclude exactly two of the three vector-dimensions, you will get the extents of the vector in the one non-excluded dimension. That means if that extent is negative, you will also get it as negative.
    • Comparing vectors with each other will cause their lengths to be compared, unless comparison-type is "Equal" or "Unequal". Should that not be what you want, you'd have to parse the single extents into floats and compare them one by one for the time being.