SetAnim( <animation>, <weight>, <time>, <rate> )


Module: Animation
SP Only

Summary:

SetAnim and all of its variants set the weight of an animation (or a node in the animtree) to a given value over a given time. They also set the speed at which the animation plays. All of the ancestors of the animation will also have their weight set to 1 over the given time so that the animation is visible. Each variant of this function has different behavior depending on the words in the function name:

"Flagged": These functions take an additional argument <notifyname> (first in the argument list) which is a string that is notified for every notetrack in the animation. For instance, if the string "runanim" is used, it would be typical to waittill("runanim", "end") to wait for the end of the animation. <animation> must be an actual animation and not a non-leaf node of the animtree.

"Knob": These functions turn the weight of any siblings of the animation to zero as the animation's weight is turned up. The effect is that after the given time, the animation is the only one out of its siblings that is playing. Note that the descendents of the siblings of the animation will not be turned off directly. (For this, use ClearAnim.)

"All": Works only with "Knob." Not available with both "Limited" and "Flagged" at the same time. These functions take an additional argument <root> (after the animation argument). <root> must be an ancestor of <animation> in the tree. This has the additional effect that "Knob" has on all nodes from the animation up to (but not including) <root>, so that this animation is the only one in its area of the tree which is playing.

"Limited": These functions do not change the goal weight of the ancestors of <animation> (If "KnobAll" is used, this means the ancestors of <root>). This means that the animation might not be visible if any of its ancestors currently have a weight of 0. However, when its ancestors' weight is changed, it will become visible.

"Restart": These functions cause the animation to restart. If they had been previously playing, without this they would continue from their current time.



Call this on:

<entity>



Example:

self SetAnim( %precombatrun1, 1, 0.1, 1 );



Required Args:

  • 1 : <animation> The animation or animtree node to change.


Optional Args

  • 1 : <weight> Goal weight of this animation. Defaults to 1.0.
  • 2 : <time> Time to transition to this weight in seconds. Defaults to 0.2.
  • 3 : <rate> Playback rate of the animation. Defaults to 1.0.