Skip to content

Triggers

fenix31415 edited this page Jan 23, 2024 · 33 revisions

Every time a new projectile appears in the game, it is checked against the triggers conditions. If the trigger passed the test, it modifies the projectile parameters, changes the projectile type, call function according to the data in TriggerFunctions.

If several triggers pass the test, then their functions are all applys, but the result depends on the feature used. For example, if two triggers use the Homing feature, then the result of the latter is applies. If both triggers use the Multicast feature, then both MultiCasts happens.

Triggers

The Triggers section is an array of objects with the following fields:

  • The event field shows when the trigger is triggered. Can be one of the following:
    • ProjAppeared: Appearance of a projectile (from cast or from ranged weapon)
    • Swing: Melee weapon swing.
    • HitMelee: Actor hits someone.
    • HitByMelee: Actor was hit.
    • HitProjectile: Actor hits someone with projectile.
    • HitByProjectile: Actor was hit with projectile.
    • Cast: Actor casts a spell.
    • EffectStart: Actor get applied an effect. Called frequently for concentration spells.
    • EffectEnd: Actor get dispelled an effect. Called frequently for concentration spells.
    • ProjDestroyed: A projectile is destroyed. Usually after hit/end of lifetime/end of range.
    • ProjImpact: A projectile hits someone or something.
      The event emitted even when hitting REFRs, not actors, so be careful in conditions/functions.
      To get only actor hits, use HitProjectile/HitByProjectile.
  • The conditions field is an object of conditions that the trigger must satisfy.
  • The TriggerFunctions field is an object that describes functions that are called if checks passed.

conditions

Every key-value pair represents a condition. Key is a name of the condition, value -- the value that is needed to the condition. The condition functions can be one of the following:

  • Hand: compare value with the casting source. One of the following: Both, Left, Right.
  • ProjBaseIsFormID: compare value with the projectile's base FormID.
  • EffectHasKwd: check if the projectile's spell has an effect with keyword with FormID = value.
  • EffectIsFormID: compare value with the effect FormID.
  • SpellHasKwd: check if the projectile's spell has keyword with FormID = value.
  • SpellIsFormID: compare value with the spell FormID.
  • CasterIsFormID: compare value with the projectile caster FormID.
  • CasterBaseIsFormID: compare value with the projectile caster's base FormID.
  • CasterHasKwd: check if the caster has keyword (either on base or in active effects) with FormID = value.
  • WeaponBaseIsFormID: compare value with the bow's FormID.
  • WeaponHasKwd: check if the bow has keyword with FormID = value.

TriggerFunctions

In the TriggerFunctions section, specify the functions that are called in this trigger. This is a json-object. In the disableOrigin field, specify whether to cancel the launch of the projectile (for ProjAppeared condition) (default: false). The functions field is an array of objects, each of which describes a trigger function.

functions

In the type field, specify the type of function to be called. It can be one of:

  • SetRotationHoming: Aim the projectile at the target.
    In the id field, specify HomingData instance key.
  • SetRotationToSight: Aim the projectile at the caster's point of view.
  • SetHoming: Make the projectile homing.
    In the id field, specify HomingData instance key.
  • SetEmitter: Make a projectile Emitter.
    In the id field, specify EmitterData instance key.
  • SetFollower: Make a projectile Follower.
    In the id field, specify FollowerData instance key.
  • DisableHoming: disable (Homing)[Homing] feature on the projectile.
  • DisableFollower: disable (Followers)[Followers] feature on the projectile.
    In the restore_speed field, specify whether to set the default speed or not.
  • DisableEmitter: disable (Emitters)[Emitters] feature on the projectile.
  • ApplyMultiCast: Perform MultiCast.
    In the id field, specify MulticastData instance key.
  • ChangeSpeed: Change the projectile speed.
    The function allows you to change the speed value. In the type field, specify the type of change (Set, Add, Mul), in the value field, specify the value to change.
  • ChangeRange: Change the Range of the projectile. Same as for ChangeSpeed.
  • Placeatme: Spawns an object at the event position. In the form field set the formid of the object to spawn.
  • SendAnimEvent: Sends animation event. In the event field set the name (tag) of the event.
  • Explode: Explodes at the event position. In the explosion field set the formid of the explosion. Spell/effect of explosion is default, not the one from the projectile.
  • SetColLayer: Change collision layer. In the layer field set one of Actor, Spell, None. First collides only with actors, second is default projectile collision, third do not collides.

Example

"Triggers": [
  {
    "event": "ProjAppeared",
    "conditions": {
      "CasterIsFormID": "0x14"
    },
    "TriggerFunctions": {
      "functions": [
        {
          "type": "SetHoming",
          "id": "key_H_1"
        }
      ]
    }
  }
]
Clone this wiki locally