Notes on Keyframes


In this text, the term keyframe or key will be used to refer to the .key file or the variable that is assigned to it. An animation refers to the keyframe when it is being played on a thing.

How Animations Work

A keyframe is a collection of frames that mark the position of each part of a 3do. When a keyframe is played, the parts of a 3do are moved to their respective positions in first frame, then the second, and so on.

Animations can be combined. The engine looks at the animation's priority and combines the animations giving the higher-priority animations more control over the parts of the model that they use. Puppet files use a low to high priority that ranges from 0 to 5, but using a priority as high as three will block out other animations and any higher will not normally be noticed.

JK will not let you play more than four animations simultaneously, and it reserves at least one of them for animations such as walking, running, standing, etc.

Puppet Major Modes

Puppet files (.pup) contain a listing of keyframes that are played when certain events happen to a thing. A puppet has six (0-5) modes - also called major modes. This table explains their use:

ModePurpose
0Default. Used for fists, detonators, and other modes are usually based on it.
1Aimed Weapon. This mode is used for guns.
2Saber. This mode is used when the creature is armed with a saber.
3Swimming. This mode is used when the creature has fists or detonators and is in water.
4Gun Swimming. This mode is used when the creature is swimming with a gun.
5Saber Swimming. This mode is used when the creature is swimming with a saber.

A Major Mode redefines the keyframes of the thing for certain actions that need to be changed. Puppets also define the flags and priority of the animation. PlayMode() and FireProjectile() both play a keyframe that is already listed in the puppet.

Each keyframe in the .pup has a number. This is called the submode number. Keyframes are not listed in order of their submode number, but in ky.pup, a comment beside each key lists its number. Refer to the Submode Listing.

Keyframe Symbols

You cannot directly reference a keyframe file when you need to play it. Keyframes, like ai and model files, must be loaded and assigned to a variable first. Then use the variable where you need a reference to the file. So have something like this in the symbols section:
keyframe     yourName=yourKey.key     local
And then in the code section, use your variable:
PlayKey(player, yourName, 1, 0x38);
You can also use LoadKeyframe() to return a keyframe reference.