Skyrim Creation Kit Tutorial - Binary-State Animators

NOTICE

There is a bug that makes attach reference animation unstable and unpredictable: if you load a save in which there is a static with an attach reference, its position may be offset and the animations will be broken. This only happens sometimes, but testing is highly recommended. A preferable method can be found here: Papyrus - Moving Statics with TranslateTo.

It's important to note that the NIF object that is being modified must have the BSBehaviorGraphExtraData node added to it with a proper reference to an animation behavior graph in order to use the animation group Forward / Backward. If this is not the case, you will have to defer to legacy Gamebryo animation. In that case directly referencing the animation sequences via PlayGamebryoAnimation in Papyrus script will animate the object. However, this approach will usually not work for multi-state sequences or multi-pass animations.

Once the basic two-key movement is working, more keyframes can be added. You are free to do that as far as the applicability of the functionality. Keyframe addition, however, is not the same thing as state addition; there are still two sequence pairs (forward and backward states).

Event Execution

Within NiKeyExtraData, between the "start" and "end" keys, you can add an intermediate key that executes a particular script event. For example, you can play a sound with the animation given this structure within the NiKeyExtraData node:

  1. TextKeys.Value = "start", TextKeys.Time = 0.0
  2. TextKeys.Value = "Sound: OBJSound", TextKeys.Time = 0.0
  3. TextKeys.Value = "end", TextKeys.Time = 3.0

In this case, OBJSound would be the name of the SoundMarker object

Troubleshooting

If you encounter strange collision behavior, you may want to modify the collision mesh inside the attached mesh from motion system MO_SYS_BOX_STABILIZED to MO_SYS_BOX and the layers to ANIM_STATIC, but this is just a band-aid fix. Bodies in motion by proxy are not handled well with Creation Engine's physics for the most part.