Skyrim: Furniture and Idle Markers

This is not supposed to be a "tutorial", which most people seem to think of as a list of things they did that got the right result, regardless of whether they were needed, and without any explanation of why they were done. Rather, I will (hopefully) explain how things works, and why things are done a particular way, so you can make informed decisions when attempting similar mods.

Furniture or Idle Marker

The first decision to make is which type is appropriate. Both of them represent an object that the player, or more often an NPC, will activate to trigger an animation. The main decider is whether the actor needs to align with something when the animation is performed. This may be an actual piece of furniture, which makes the choice obvious, or it may be something like a wall or fence that the actor should lean on. In the latter case, the marker can be an invisible furnishing that just ensures that the actor contacts the wall in the correct manner.

Idles, on the other hand, are more free-form, and get used for things like sweeping, where the actor has some freedom of movement while performing the animation.

Adding the Animations and Furnishings

Furniture models and animations are made outside of the CK using tools like Maya, 3DS MAX, or Blender. This part is out of the scope of this article, so I'm assuming you have already made these (or acquired them from a resource mod). The models will simply be linked in at the appropriate dialogs in the CK, but the animations require an extra step that's also outside the CK. You'll need FNIS (Fore's New Idles for Skyrim) tools to add the animation details to the havok behaviour graphs before they can be used in the CK. Refer the documentation that come with that tool for details, as it may change with new releases. In particular, note the requirement that the animation names and events be unique, so if you're getting things from a resource mod, make sure you rename the animation files, and update the FNIS_modname_list.txt file to match first.

The furniture meshes can be in your mods's own folder, but the animations need to be in the Data\meshes\actors\character\animations folder, where they can be in a sub-folder specific to the mod.

Run the "GenerateFNISforModders" tool to create the behaviour details for your mod, and then add it into the game using "GenerateFNISforUsers" to make the animations available to the CK.

Defining the Pieces in the CK

Keywords

Since the dialogs you'll be using later want you to select keywords from the list of known ones, it's simplest to add them first. Each type of furniture should have its own unique keyword that will be added in the Furniture form, and checked in the animation tree. The convention of "FurnitureXxxx" where the Xxxx part is the formID of the furniture is a simple one to use. Just add one for each type of furnishing. If multiple furnishings use the same animations, they can use the same keyword.

Either the Furniture or the Animations can be defined now, as the keywords are the link between them. The furniture is the simpler of the two.

Furniture

Furniture is under World Objects in the Object Window. Right-click in the list and select "New". Enter a unique FormID and be sure to give the item a name to display, or else it can't be activated. When you select the item's mesh, some of the other entries will get filled in. The furniture mesh will include a furniture marker, which will tell the CK what type it is, so the Active Marker part will get a "Sit" entry added.

You'll need to add the keywords manually. The three shown are the minimum. "Furniture Special" and "RaceToScale" are built-in ones, which you'll select from a list. Right-click and select "Add" to pop up the list. You can only pick one at a time, and the order doesn't matter. They'll show in alphabetical order, not the order they were picked. Having your new keyword pre-added means you do them all the same way, but if you forgot one, the "New" option on right-click lets you create the missing keyword.

The flags are faily self-explanatory. Randon Animation Start means that if several instances of the furniture are in use, the actors won't be all doing their idles in synch with each other. If you'll only have one, it won't matter. Check the "Ignored by Sandbox" option to prevent every passing NPC from using it.

Animations

On the menu of the CK main window, under Gameplay, you'll select Animations...

This brings up a dialog with a tree of all the animations in the game, with the first entry expanded. Go down to the entry for Actors\Character\Behaviors\0_Master.hkx and expand it. The first entry below that is ActionActivate which is the one that applies to activating furniture. The last one, labelled LOOSE is where Idle marker animations will go. You'll expand another level (ActivateRootChar) to see the entry for Chair, which is where you will most likely be adding your new entries.

The labels on the nodes of the tree are not significant, but the conditions to the right are. The node labelled Chair has a condition of "IsFurnitureAnimType(Sit)==1" so when that evalutes to true, all the lower nodes get searched to see which applies. If your furniture animation meets that, and most will, then you'll want to add it to this branch.

LOOSE, at the bottom, catches all the requests for animation that don't match above, which is why the non-furniture animations go down there.

Note that it is possible to add your mod's animations in a new category which is a sibling of Chair. It will have the same condition of "IsFurnitureAnimType(Sit)==1", but could include an addition test, such as a keyword. As long as it is added above LOOSE, the condition will be evaluated as part of the search for the right animation.

A typical entry under Chair will apply to a specific type of furnishing, which the game will recognise by keyword. If you look at any of the existing nodes, you'll Find a condition like this one.

Note that the test is run on the Target. The event is an actor activating a furniture item, so the test is not run on the actor, but the furniture. Since all these tests will be mutually exclusive, it really doesn't matter where you add your new nodes for the new furniture. Adding at the end is least work for the CK, so we'll do it there.

Right-click the entry after which you're going to insert your new node, and select "Insert Sibling". This will give you a new node at the same level as the one you clicked on. It won't have a label yet, until you fill in the dialog that pops up. You need a Unique ID - convention for naming it is "IdleFurnitureName" - and the condition will be HasKeyword, as with the others. I suggest you add each piece of furniture before going to the next level, and attaching the animations.

Furniture Animations

Using a piece of furniture is a sequence of actions, tracked by the GetSitting value, which increments from 0 = not sitting, through 1 = loading idles, 2 = starting to sit, 3 = sitting to 4 = starting to stand up. It has a few other values for mounting a horse, but we can ignore those. Values 2, 3, and 4 are the useful ones for animation control.

For a specific piece of furniture, there are several animations possible. One or more are Enter animations - i.e. the actor starts to use the furniture by, for example, sitting down. There may be more than one of these, if the furnishing can be entered from more than one direction, so each node at this level will have several conditions to distinguish the cases. Similarly, the actor may get out of the furniture in more than one way, and may perform looping idles while using it.

If your furniture is a basic enter/use/exit situation, you'll be able to copy the conditions from existing furniture. I suggest adding all the Entry setup first, for each new furniture piece, so you can copy conditions once, and paste as many times as needed, before moving on to the idle loop, and Exit.

An entry in the FNIS_modname_List.txt file for a furniture idle group may look like this:

'----------Rack Back Face

fu -a SuccRack03_Enter SuccRackBF.hkx
+ SuccRack03_Loop SuccRackBF.hkx
+ -a SuccRack03_Exit SuccFurnitureExit.hkx
where the "fu" says that it's furniture, and the -a option on the Enter and Exit entries indicate they're performed once only. Each line associates an event with an animation file (the .hkx one). The event names used here need to be copy/pasted into the dialog for the animation in the CK, to make the link. I suggest using the same value, prefixed with "Idle" for the name, or else the name on the parent node, suffixed with "Enter", "Loop, or "Exit". These may, of course, be the same, if that convention was used in the text file.

Making an NPC use the furniture

The NPC needs an AI package to use the furniture, not surprisingly a "SitTarget" one. This is a very simple package to set up, as it only needs to know which item of furniture is to be used. You'll normally select the item in the render window, as shown below.

More complex packages are possible. The actor may be scripted to travel to the item, use it, then get up and leave again. For the rack in the example, it is unlikely the actor would be allowed to do so!

The actor will be placed near the furniture, but will not interact with it in the CK.

However, when seen in game, the furniture will be used.

Idle Markers

These are the simplest to do. In the Object Window, under Miscellaneous, there is a category labelled Idle Marker. Right-click in the list and select "New" to be rpresented with this dialog.

Give it a unique formID, and fill in the details. Since a marker can be used to run a single animation, a sequence of them, or a random selection from several, the dialog provides for you to enter more than one animation. The other options work the same way as they do for furniture. There is a generic marker model (a blue square with a pointer) that is used if you don't provide one.

Animation Objects

Both furniture and Idle animations may also involve additional items that are required only during the animation, such as a broom to sweep with, or a mug to drink from. These items are declared in the FNIS setup, with the -o option indicating they're needed, and giving the name(s) of the objects themselves.

'----------Kneeling In Stocks / Furniture

fu -a SuccKneelingInStocksF_Enter SuccKneelingInStocksF.hkx
+ -o SuccKneelingInStocksF_Loop SuccKneelingInStocksF.hkx AOSuccCuffsWristL AOSuccCuffsWristR
+ -a SuccKneelingInStocksF_Exit SuccFurnitureExit.hkx
You can define the animation objects at any point in the process, as the linkage was all set up in advance in the FNIS file, and does not need to be selected in the CK. These names are connected to the right meshes via the AnimObject form, found under Miscellaneous in the object window.

The ID must match the value in the FNIS file, and the model points to the mesh used. The Actor list is not actually used, and if you change the selection, it will get lost again when you save. The same appies to the Unload Event.

An example in the CK of an NPC linked to an Idle Marker. Note the helpful arrow.

In game, the NPC will be performing the idle, in this case, she's hogtied on the ground.

Other Considerations

You can link an NPC to an Idle Marker, or give them a TravelAndUseIdle package to make them perform the animation, but the presence of the marker also means that other NPC's could decide to use use it in their sandbox packages. There's a checkbox to turn this off, but the whole thing soon becomes unreliable. So if you want a specific NPC to perform, the best method appears to be a plain Travel package to a Xmarker (or XmarkergHeading if direction is important), and specify the idle as part of the package.

AI packages are preferred over LinkedObject connections, as they get re-evaluated at various times, unlike the single opportunity at cell load. If the engine is busy, the NPC->marker connections may get missed, but the package can get re-triggered later.