Difference between revisions of "Making Ridable Creatures"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Yarharhar
imported>GhanBuriGhan
(added to Modeling tutorial cat.)
Line 187: Line 187:


[[Category:Tutorials]]
[[Category:Tutorials]]
[[Category:Modeling_and_Texturing_Tutorials]]

Revision as of 12:53, 2 August 2006

This tutorial will walk you through the steps of creating a new ridable creature. In this case, we are going to make the mountainlion creature ridable, but you should be able to use this process on most of the other animals.

Note: This is an advanced level tutorial. If you are not comfortable with the BSA unpacker, a hex editor, and nifskope, then this is not for you. If you would just like access to new ridable creatures, there is already a project for that.


Just getting it to work

Step 1: Choosing a Creature

What you'll need for this step

  • Oblivion
  • BSA Unpacker
  • Oblivion creature meshes/animations


What to do

If you have not extracted the Oblivion mesh files, do so now. For an explanation on how to do this, check out the BSA_Unpacker_Tutorial.

First decide what animal you want to make ridable. This tutorial is going to use the cat, so for best results, use that. After extracting the mesh files, navigate to meshes/creatures/mountainlion.

Next, we are going to copy this directory and all its file and move it to the oblivion data folder. We also need to rename this folder as the changes we make to the mountain lion will be quite significant and we don't want to overwrite the stock oblivion one. For this tutorial we are going to use the folder name “lionRide”. So copy/rename the mountainlion folder to your Oblivion/data/meshes/creatures/lionRide folder.


Step 2: Preparing the Skeleton

What you'll need for this step

  • The lionRide folder you've made
  • The horse skeleton file
  • The Construction Set
  • Nifskope
  • A hex editor. If you need one, XVI32 is free, small download.

Bip02'ing the bones

If you tried to go into the construction set right now, took the stock mountainlion, and changed its creature type to horse, you would be greeted with a multitude of error messages about unreferenced nodes and such. This is because for animation reasons, horses in Oblivion use a differently named skeleton than other animals/players. When switching the creature type to horse, Oblivion expects this alternate skeleton naming convention.

There is good news, however! The only difference between regular and horse skeletons is that regular creatures' skeletons use bones named Bip01 <bone name>, while horses use Bip02 <bone name>. Just a single number difference. It's also quite easy to convert to the horse naming format with a hex editor.

So, what we need to do now is open up every one of the lionRide files(.nif AND .kf) in the hex editor of your choice (Note to visual studio users: Visual studio can't find/replace text strings in the hex editor, sorry). In the hex editor, go to the find/replace feature and set it to text string mode. Set the editor to search for any instance of the text "Bip01" and have it replace it with the text "Bip02" (without the quotes). Then just have it run the replace-all option. There should be around 40-50 replacements per file.

Copying Horse Nodes

The lion skeleton is almost ready now. There are three nodes we need to add the lion skeleton; I will first describe their purposes. Mountable creatures have two special nodes named "ActorParent" and "EntryPoint".

"EntryPoint" determines from where a player approaches a mountable creature (usually the left side). This node is also necessary for dismounting as it determines where the player ends up after getting off the horse.

"ActorParent" determines where a player attaches to the mountable creature. By making it a child of different bones, you determine where they ride on the animal (For example, making it a child of spine2 results in the player riding on the creature's back, which is desired). This however, brings up an interesting problem. Bone positions/scales/rotations are determined in part by their placement in a creature's skeleton, but can be changed and overwritten by animations. We can't actually change ActorParent's scale/rotation/position to fine tune where the player is positioned on the animal, as the values will get overwritten by animations that get played. This is where the third node comes in.

The last node we add is a new, unique node that won't be referenced in any animation or model files. It's only purpose in the skeleton is to have translations/scales/rotations and have the ActorParent as its child. It then passes any transformations it has down the line to ActorParent and then the actor mounted on the creature!

So let's start by adding our custom transformation node. Open the skeleton.nif file in your lionRide folder, with nifskope. We need to insert a blank node. To do this, right click on the block list window and in the block menu that pops up, choose insert. The node type you want to insert is 'ninode' located under the 'n' section. After inserting it, move it to the bottom of the tree (just highlight the node, hold control+down arrow). Change the value, not the name to something unique, I'm going with 'xform'. You don't need to make any other changes at this point, just save the skeleton.

Now, navigate to the meshes/creatures/horse folder and open up the skeleton.nif inside, with nifskope.

In nifskope, find the node named "ActorParent" (Should be node 195), right click it, and select "copy branch". Now, using this same instance of nifskope, navigate and open up the skeleton.nif in your lionRide folder once more.

Back in the lionRide skeleton, right click the block list window and choose 'paste branch'. This will put the ActorParent node into the lion skeleton with all the data it needs. Now we just need to link it all up. In the 'xform' node, double click on its 'num children' attribute, and increment it by 1. Then refresh its list of children, and make the new child link point to the ID of the ActorParent node in the skeleton (This number is probably 266).

Now, find the bone in the skeleton you want the player to be riding off of, let’s try Bip02 Spine2. Navigate to said node (36), and give it a new child link, pointing to the xform node. Now save your changes.

The last step is similar. Go back into the horse skeleton, and copy the node “EntryPoint” (Should be ID 291). Go back into the lion skeleton and paste this branch as well. Then make this node a child of the 'Scene Root' ninode.

At this point, your skeleton is usable!

Step 3: Mounting/Dismounting - Part 1

What you'll need for this step

  • The lionRide folder you've made
  • The horse mounting/dismounting animations
  • The Construction Set

Get the animations

Now we need to add the mounting and dismounting animations to the creature. Navigate to your meshes/creatures/horse/idleanims folder, and copy the horsemount.kf and horsedismount.kf files. Paste them into the meshes/creatures/lionRide/idleanims folder, and rename the files catmount.kf and catdismount.kf, respectively.

Setting up the Creature

Now open up the construction set and load the Oblivion master file. In the object window, navigate through the creatures list until you find the stock mountain lion (CreatureMountainLion). Duplicate it with the ID of your choice (I used RidableMountainLion) and name it "Riding Lion" or something to that effect.

The other changes you'll need to make to it: Change the creature type from "Creature" to "Horse". Change the skeleton file to point to the lionRide/skeleton.nif you've been editing. Under AI, turn down its aggressiveness so it doesn't attack everyone, and remove it from the creature faction. At this point, place the creature somewhere in the world, for testing purposes. I normally just stick them in the market district somewhere. One thing to note: You should NOT be getting any error messages at this point, if you are, then you've done something wrong.

Once you've placed the creature, save this mod as an esp, and then reload it. We need to edit the creature's idle animations (and they won't show up until a save/reload of the mod file).

After reloading the mod in the construction set, navigate to the gameplay->idle animations folder. On the left side, find the idle animation corresponding to your creature's folder (It should be lionRide). We need to add the idle animations that correspond to mounting and dismounting the animal. So right click on your lionRide entry, and choose "Insert Child". Give the child ID "lionMountDismount", require it to return a file, and give it condition "Getsitting > 0".

Now give lionMountDismount two children. One named lionMount, the other lionDismount. For the lionMount animation, select the catMount.kf file, and for the dismount animation, give it catDismount.kf. lionMount needs to have condition "Getsitting == 12", while lionDismount needs condition "Getsitting == 14".

Once you've set up these values, save your mod, load it into Oblivion, and try it out!

...and now you've probably noticed that the lion looks absolutely ridiculous while mounting and the player looks just as silly while riding. Don't worry! We'll deal with that in the next section!

Making it look good

Now we are going to go through some advanced topics polishing up the ridable creature we've made so we actually appear to properly mount/ride it.

Correcting the Mount/Dismount Animations

What you'll need for this step

  • The lionRide mounting and dismounting animations (catMount.kf and catDismount.kf)
  • The horse mounting and dismounting animations (horse/idleanims/horsemount.kf and horse/idleanims/horsedismount.kf)
  • The Oblivion Mount Project Animation Warper

What to do

Fixing the mounting/dismounting animations is actually pretty easy. You see, all we need is the action of the player getting onto the horse. So if we can strip out any references to the horse while leaving the player animation in place, we'll have an animation that will be perfect for our ridable cat! So to start, download the Oblivion Mount Project Animation Warper. This will allow you to strip the horse parts from the animation from the mounting/dismounting animation files.

After downloading and unzipping the program, you should have a directory structure consisting of three folders: master, merge and output. Move the horsemount.kf and horsedismount.kf files into the master folder, and then run kfmerge.exe

Because we want to just strip out the horse movement from our animation, from the first menu we'll choose option '2' to filter an animation. Since we want to remove horse bone references we know about, at the next menu we'll choose 'E' for the exclusion filter. We also know that horses use a skeleton with bone names of either "Bip02 something" or "horse" something. So we'll choose 'P' for partial matching at the next menu, to reduce the amount of typing we need to do.

The bone names we want to filter are Bip02, bip02, Horse, and horse so we enter each of those names followed by 'F' to finish.

Lastly, the program will ask for a filename or directory. Since our horse animations are in the master folder, we'll enter 'master' at this point so it runs the filter on all files in the directory. The program should then filter all the bone references out and write these new files to the output directory. Now go into the output directory, take the horsemount.kf and horsedismount.kf files from there and put them in your lionRide/idleanims folder. Delete your old catMount.kf and catDismount.kf and rename your new horse files to these names.

Test these new files in-game by mounting the cat. You should notice the cat no longer stretches in an unusual manner!

For reference, here is the command list entered into the animation program.

2
E
P
Bip02
bip02
Horse
horse
f
master

Adding proper riding animations

What you'll need for this step

What to do

This is the real fun part. After this step we'll have a creature that looks and rides like the horse! To start, go to the animation program folder, and empty out the master, merge, and output folders.

First copy all the animations from the base lionRide folder into the 'master' folder. Then copy all the animations from the base horse folder into the 'merge' folder. At this point, we're nearly ready for merging. First, we have to make sure the horse and lion use the same file names, however (they do not).

You'll notice the horse has more animations than the lion. The ones the lion does not have, just ignore. Now, we need to rename any of the horse animations in the merge folder that seem to have the same purpose as a lion animation. For example, the lion has runforward.kf, the horse has fastforward.kf, so rename the horse's fastforward to runforward so it matches. You don't need to do this with all the files as long as idle, walking/running/turning are good. After that, copy the horse's idle.kf as default.kf (this will act as the default rider position the player should use in animations that don't match).

Now run the animation program! We choose option 1 to merge animations, then option 2 to apply the already-made horse animation filter. We choose to use the source creature timings (option 1) and then option 2 to do a batch merge. After this, the merged lion/horse animations should be in the output folder.

Copy them to your lionRide folder (overwriting files as neccessary). You can repeat this step with the animations in the lion's idleanims folder(EXCEPT the mounting/dismounting) animations, if you want.

Try mounting and riding the cat in game. You should have a respectable mount now!

For reference, here is the command list entered into the animation program.

1
2
1
2

Adding proper 'mount' A.I.

What you'll need for this step

  • The construction set
  • Your ridable creature

What to do

This step is easy. Yay! Enter the construction set and open your ridable creature.esp.

Enter the creature's edit window. First remove any factions the creature has so people don't randomly attack it. Next, click on the creature's AI button. Turn the creature's aggression WAY down(I normally go to 0) and remove any AI packages it currently has. Then add these:

  • aaaDefaultStayAtCurrentLocation
  • HorsePCStay
  • HorsePCStandStill
  • HorsePCGoHome

Now your new ridable mount should behave like your regular animals for fast travel, leaving it outside and such.


Changing the cat's size (Making it BIGGER)

What you'll need for this step

  • The construction set
  • Nifskope

What to do

Enter the construction set and load your ridable creature.esp. Go your ridable lion's edit window, and in the stat tab, set the base scale to 1.75. Save the mod and try it out in game.

Yay! The lion is big now! But when you mount it-ack! You are also huge! Exit oblivion and open the lion's skeleton in nifskope. It's time to use our 'xform' node we added way back in the beginning of this tutorial. Browse to this node in nifskope.

The problem right now is that the player inherits the scale of the lion when he mounts it. So he is growing 1.75 times bigger. We can counter this however. The player will also inherit any transformations put on the xform node. So we if apply a scale of 1/1.75 = .5714 to the xform node, the player will have his correct size! Go to the scale property of the xform node and set it now (to .5714). Save the skeleton and try mounting the lion again in-game. Yay! The lion is big and you're the right size!

Reducing the crazy bobbing movements

What you'll need for this step

  • Nifskope

What to do

You probably notice now in game that when riding the lion, the player isn't positioned quite right and bounces around quite crazy while riding. The problem is that xform is a child of spine2, a node which moves around waaay to much. The solution to this problem is move xform to another nearby node and then translate it, so the player sits right but doesn't move like a madman.

So go into nifskope, and browse to the xform node once more. Change it from being a child of spine2 to a child of spine1. Then, add a translation of (x:8 y:-4, z:0) to the node (I took the guesswork out for you). Save the skeleton and try it out in game. You're done! Congratulations!