View Single Post
Old 27-11-06, 20:48   #5
Titak's Avatar
Join Date: Jul 2003
Location: Drenthe, The Netherlands
Posts: 32,230

Step by Step: Creating a sprint jump for Lara
By SSJ6Wolf

This tutorial is intended to increase understanding of the animation editor as you create a sprint jump for Lara. Please PM me if you have any questions!

WADMerger (preferably 1.96 or later so you can calculate collision)
A WAD you're ready to experiment with.
Read the "creating custom animations" thread to understand these terms, that will be used in this tutorial:
-Speed and acceleration
-Grab position
-StateID change
-stateID change editor and how it works

1. Enable the player to cross a gap of four squares when they press "jump" while sprinting - a sprint jump.
2. Enable the player to grab ledges during this sprint jump.
3. Reassign the diving roll move to be used when "shift" and "jump" are used together while sprinting.

Part 1 - Gathering information
Open WADMerger, and load a WAD. I found it fitting to use tut1.was but you can choose any WAD with Lara in it. Select Lara and click the "animation editor" button.

There are 444 animations for Lara in Tomb Raider 4 - that's a lot! But the more time you spend here, the easier it will be to find a specific animation.

When you want to make a custom animation you need to make sure you know how it will be used in-game. In this case you most likely know beforehand that the jump button may be used while sprinting to perform a diving roll, so it is therefore possible to use this button for a new animation.

What you need to do is find reference animations so you know what kinds of commands to use for our dash jump. Wouldn't it make sense to find the running jump animations? On your own you would have to keep scrolling until you spotted your reference animations, but this time it wouldn't have taken long - Lara's running jump is found in animations 16, 17, 18, and 19.

Looking at the "next animation" field, notice that these animations come in pairs. Animation 16 goes to animation 17 and animation 18 goes to animation 19. Both 17 and 19 lead to animation 77 (a continuation of the jump). Also notice that animations 16 and 17 jump off of the right foot, and animations 18 and 19 jump off the left foot. Making a flow chart will be helpful here. Like this:

This tells you that you will actually need 5 animations for the sprint jump. Now let's gather information about the individual animations. The most important things to find for each animation are:

1. StateID (the number that tells the game engine what Lara's doing)
2. Speed and Acceleration, if any (moves Lara back and forth)
3. Animation commands (click the button with all the 0's and 1's, this is for playing sounds and other special commands, more on this later)
4. StateID changes (click the button that looks like 1->2, this is for changing what Lara is doing)

On your own you should write this stuff down. All of the animations have stateID 3. Animations 16 and 18 have a speed of 47, Lara's running pace. In the animcommands window, animations 16 and 18 both have a GRAB POSITION command (-100,75). Don't worry about the sound commands, they're not fundamental right now and you will insert them of your own accord later on in the tutorial. In the stateID change editor, animations 16 and 18 go to animation 133 for stateID 8. If you find animation 133 you'll see this is for if Lara dies before she can take off.

Animations 17 and 19 do not have any speed settings or animation commands, but they do have a lot of stateID changes. If you track down all of the animations these lead to, you should form a list like this:

StateID 1 (animation 92) = Lara lands and continues running
StateID 2 (animation 82) = Lara lands and stops moving
StateID 11 (animation 251) = Lara does a mid-air grab
StateID 52 (animation 157) = Lara goes into a swan dive
StateID 68 (animation 207) = Lara turns to face the opposite direction

Animation 77 is essentially the same as 17 and 19, except it has another stateID, stateID 9. Tracking it down to animation 45 you see it is for when Lara starts to fall straight downwards. Animation 77 also has a bunch of different animations stemming off of stateID 11. This is because Lara needs to be able to grab when her arms are at different angles, as the animation progresses. Don't worry about copying all the grabbing animations' numbers down, we'll be making our own anyway.

Part 2 - Letting Lara Launch
You might think it would make sense to replace the diving roll animations with your new ones, but it is wise to keep them for later. (You will use them for the third objective). Instead we will add new slots.

Click the "add" button under the animation drop-down menu. You have just created a new slot, numbered 445. Click the add button 4 more times. Now we have slots 445-449 to work with for our 5 animations. You want to follow the existing running jump animations as closely as possible, so write down a list matching your new animations to the running jump animations (or just keep it in your memory).

Animation 445 -> Animation 16
Animation 446 -> Animation 17
Animation 447 -> Animation 18
Animation 448 -> Animation 19
Animation 449 -> Animation 77

The flow chart for your new animations then looks like this:

To make a good animation, you need a good starting frame. Animations 445 and 447 will stem off of the sprinting animation, so let's copy over your starting frames from there. The sprinting animation is 223. Animations 16 and 18 start just before the foot hits the ground, so you will start there as well. Go to animation 223 and select frame 12, when the right foot is about to hit the ground. Under the frame menu at the top, choose "copy". Now go to animation 445 and under the frame menu choose "paste (replace)" to replace the only frame there. Go back to animation 223 and copy frame 2, and paste (replace) 447's only frame.

Let's save here. Select file menu -> save wad.
NOTE: This OVERWRITES your current Wad. If you want to save it under a different name or in a different place, close the animation editor (say 'yes' to the save changes dialog) and use the "save WAD" button instead.

Start with animation 445. The animation it is based off of, animation 16, has Lara push off of her right foot to jump, so animation 445 will do the same. Press the button with the blue plus sign near the top of the editor to duplicate the frame. (Don't worry about the collision box yet.) In this frame, have Lara push on her foot.

Press the move button and change the Y value to -0.314 to lower her. Select mesh 4 and press the rotate button. Change the X value to 90 to raise the leg. Select mesh 5 and press the rotate button. Change the X value to 270 to bend the knee. Select mesh 7 and change its x value to 320 to make Lara bend over more. Select mesh 1 and change its x value to 20 to pull that leg in more. Now compare this frame to the first frame and yeah, it looks like she's ready to leap!

Go back to frame 1 (frame 1 is the second frame, frame 0 is the first frame. Confusing, I know) and duplicate it. In this new frame, move Lara up to -0.414 again. Move Mesh 1's x value to 40 and Mesh 4's value to 45. Move mesh 5's x value to 310. Move mesh 7's x value to 310 so she bends even further down.

Duplicate frame 2 and in the new frame. change mesh 4's x value to 320 and mesh 5's x value to 0. Change mesh 7's x value to 0. Change Mesh 1's x value to 90.

Select collision -> calculate collision (animation) to fix the collision box. This helps generate Lara's shadow accurately and it tells the camera where to look.

To smooth this animation out, highlight the number 1 and press "2" to change the framerate to 2. You CANNOT delete this number or the editor crashes. You have to replace it like I instructed. Now press the auto animate object button to play your new animation. It is hard to see since it goes by fast, but you made your first animation!

NOTE: Notice how the frame numbers change when you change the framerate. This is because frames are actually CALCULATED by the game engine in between the frames you made. Now frame 1 is frame 2, frame 2 is frame 4, etc.

Now create animation 447 the exact same way, except the legs are switched. So do with Mesh 1 what you did with mesh 4 last time, and do with mesh 2 what you did with mesh 5 last time, and vice versa.

Now that you've made two animations, here is how rotating meshes works for when you do it by yourself:

The x value moves the mesh up and down
The y value twists the mesh in place
The z value moves the mesh side-to-side

The values are in degrees, from 0 to 360. So 180 is halfway...etc.

It takes LOTS of experimentation when you rotate meshes, so don't get discouraged! Just keep trying until you get the meshes facing the way you want.

Oh yeah, you might have noticed that when moving Lara with the y value, the smaller the number, the higher Lara goes. This is because y-axis is upside down.

Now, remember those four important things we found earlier about animations 16 and 18? Animations 16 and 18 have the same things: StateID 3. A stateID change for stateID 8, low frame 0 high frame 7 next animation 133. Speed 47. Grab position command (-100,75).

Let's put these same things into animations 445 and 447 - however we should change two of these things. The speed should be 87, because Lara is dashing. And grab position command should be (-100,100) because the sprint jump will cover another square (when you do the math, 25 is the equivalent of a square).

Set animation 445's "next animation" field to 446 (remember the flow chart!) and 447's "next animation" field to 448.

Last but certainly not least, we need to enable these animations. First take a look at animation 0, Lara's running animation. The stateID change editor has these lines:

3, 0, 11, 18, 0
3, 11, 22, 16, 0

Essentially, the guys at Core Design split this animation in half, one half when Lara steps on the left foot, another half for when she steps on her right foot.

Let's apply this same principle to the sprinting animation. So go to animation 223 and open the stateID change editor. On your own you would track all of these animations down to find out what they do, but I can just tell you that stateID 74 is for when the jump button is pressed. Delete the current lines with stateID 74 and add these instead:

74, 0, 9, 447, 0
74, 9, 18, 445, 0

Now you have split up the sprinting animation so Lara can get to the sprint jump animations.

Part 3 - Continuing the jump
Now on to animations 446 and 448. These are the equivalents of animations 17 and 19. Animations 17 and 19 are 5 frames, but have a framerate of 2 so they really have 10 frames each.

Copy the last frame of animation 445, then paste (replace) it over 446's single frame. Then copy the last frame of 447 and paste (replace) it over 448's single frame. I am leaving these animations up to you. Make five frames like before and then make the framerate 2. These animations are when Lara has jumped forward. Be creative! Will Lara fling her arms upward and then drop them to her sides? Or will she fold them across her chest and then fling them outward like an eagle? It's up to you! Make sure animations 446 and 448 end with the same frame, because these animations will both lead to a common, looping animation. Don't forget to calculate the collision!

When you're done, put the four important things in for animations 446 and 448. In this case it's simply stateID 3 and the stateID changes. But the stateID changes will be different. The change for stateID 1 and stateID 2 should both go to animation 82, where Lara lands and stops, because I feel it is too extravagant that Lara could continue running after jumping with such momentum. For the same reason I did not include the StateID 68 change. And the stateID 52 change will be used for objective #3, so don't include that either. The changes need low frame 0 and high frame 8, except for stateID 11 which has low frame 5. In the end your stateID change editor should look like this for animations 446 and 448:

1, 0, 8, 82, 0
2, 0, 8, 82, 0
11, 5, 8, 251, 0

Then complete your animation flow chart by setting both of their "next animation" fields to animation 449.

On to animation 449. Copy the last frame from either 446 or 448 and paste it over 449's single frame. Again I encourage creativity here. This is a looping animation so I have Lara flailing her arms about like she does in TR6. Make the animation 11 frames long and then give it framerate 2. Don't forget it's looping so have the last frame match the first frame.

NOTE: If you don't want the animation to loop, set the "next frame" field to the number of the last frame (22) so that the last frame keeps playing until a stateID change kicks in.

Now to add the four important things. StateID 3. The same stateID changes will get deleted, except now you have stateID 9, so the stateID change editor should look like this (each number indicates a new column)

1, 0, 22, 82, 0
2, 0, 22, 82, 0
9, 0, 22, 45, 0

Notice I left out stateID 11, because now you're going to make some grabbing animations with the Animation Wizard.

Objective 1 complete.

Part 4 - Letting Lara Grab
Since animation 449 is long, you should use 3 different grabbing animations to cover it.

Click the add button, and now you're at animation 450. Copy frame 0 from 449 and paste (replace) it over 450's single frame. Duplicate it. Now go to animation 95 - this is where Lara is going. So copy 95's frame and paste it over 450's second frame. Now you should have the beginning and end of the animation. That's just what you need for the animation wizard. Copy the last frame again (you'll need it in a second). Go to the first frame, then click the animation wizard button.

The first step of the animation wizard is just introduction. Read it then press next. The second step asks you to make the first frame. It is already there, so press next. The third step asks for the last frame. Click on the animation editor and press ctrl+v to paste the last frame there. Then click next in the animation wizard. The fourth step asks for the length (the number of frames) and the start (the starting frame) Let's make the length 6, and the start should be 0.

Now look at your animation. Lara goes smoothly from the first to frame 5. However the wizard made an extra frame - frame 6. And what is now frame 7 is what I asked you to paste in to see that it would be the end frame. These frames are no longer needed, so delete them. Now you should have frames 0-5 that make a smooth grabbing animation. It's kind of short so make the framerate 2. Set the stateID to 11 and next animation to 95. Calculate the collision for the animation and you're done!

Isn't that easy? Now, make 2 more grabbing animations just like 450, except for animation 451 use animation 449's frame 8 as the first frame, and for animation 452 use animation 449's frame 16 as the first frame.

Now to enable these animations. Go back to animation 449 and open the stateID change editor. Add these three lines:

11, 0, 7, 450, 0
11, 8, 15, 451, 0
11, 16, 22, 452, 0

Now Lara will use three animations for grabbing depending on when you press action. More animations = Lara flows better.

Objective 2 complete.

Part 5 - Enabling the Diving Roll
What if Lara still wants to do the diving roll? You know that the shift key can be used during a forward jump, so the diving roll can be used for shift + jump while sprinting.

Go to animation 445 and add this line in the stateID change editor:
52, 0, 7, 308, 0
Go to animation 447 and add this line in the stateID change editor:
52, 0, 7, 230, 0

Objective 3 complete.

Now we should add some sounds. Go to animation 445 and open the animcommands window. To add a sound, select the "play sound" command in the dropdown menu. The next box sets the frame at which the sound plays, then the next dropdown menu lets you choose the sound. The last dropdown menu lets you choose "land" "water" or "always".

Land = sounds for when moving on dry land only.
Water = sounds for when moving in water only.
Always = Always!

You'll probably want to add a Lara_jump in animation 445. Make it "always" since whether it's dry land or not doesn't matter with that sound. Then do the same with animation 447. Add any other sounds you wish.

Now, save, convert the level and test the sprint jump and diving roll in-game. Congratulations, your tutorial is complete!

I followed along with the tutorial and this is how my sprint jump turned out (yep, that's my tutorial level):

If it walks like a duck and if it quacks like a duck, it is a duck.

Last edited by Titak; 10-08-15 at 16:11.
Titak is offline