Tes4Mod:Cobl/Modding/Static Alchemy Equipment

The Static Alchemy Equipment resources were updated in version 1.48. If you're creating a new mod or updating, please use the new resources (however, the instructions for the old resources are still available).



Features
Automatically determines, takes, stores, and uses the player's best alchemy equipment.
Automatically updates the model of each piece of equipment as it changes.
You can use your own apparati models with a little nifScope know-how.
With OBSE - will use any apparati from any mod and will use the model of that apparati.
Without OBSE - will use any apparati from vanilla Oblivion and SI and uses the standard models from vanilla Oblivion.
How it plays - When the player activates any of the apparati, the alchemy menu will be opened using the player's best equipment. Generally, the  best equipment will already be on the table, but if they have better equipment in their inventory it will be placed on the table and the old equipment will be returned. If they want all of their equipment back, they can activate the table (the Returner object).

Basic Setup
You'll find all of the necessary pieces under the Activators tab in the Object window. cobStaticAppReturnerObj is the table for the equipment, so place it in your cell first. This table (and any Returner object) will return all of the player's equipment when they activate it. Then place cobStaticAppAlemObj, cobStaticAppCalcObj, cobStaticAppMortPestObj, and cobStaticAppRetortObj onto the table. Any of these pieces can be used to start up the Alchemy menu.

For the apparati - you'll see the empty stands/paper in the CS. The full pieces will be taller, but no bigger around (x/y axis). The easiest way to handle the orientation is to point the Pestle on the piece of paper in the direction you want. Then set the rest of the equipment to the same orientation.

Finally, you'll need to assign the "function" of each piece. In the Render window, edit the Alembic reference (double-click in the Render window or right-click in the Cell window). Go to the Ownership tab (may take some time to load) and set the faction to cobStaticAppIDAlem. Repeat this for each apparati and the table (Returner object).

Starting equipment
By default, the apparati start out empty and without the equipment. If you want specific equipment to start with, you can easily set it up by manually setting the variables. For instance, if you want a set of Novice equipment
Make each apparati piece persistent - In the Render window, edit each apparati (double-click in the Render window or right-click in the Cell window). Check "Persistent Reference" at the bottom and give it a "Reference EditorID" name at top - "MyModAlem", "MyModRet", etc. for this example.
Create a quest that will set the variables - Select Character->Quests. In the left-hand column, right-click and select New. Give it a name you'll remember - "MyModInit" for this example. Exit the Quest window by pressing OK in the bottom-right (may have to move the window to see it).
Other methods can be used, but a quest is the most common and easiest to do.
Create the quest script - Select Gameplay->Edit Scripts. In the Script window, select Script->New. Paste this script in the window (use Ctrl-V; make sure to change the "MyMod" names to your liking):
 
Apply the script to the quest - Open the Quest window again (Character->Quests). In the left-hand column, select your quest (MyModInit). Select your script (MyModInitScript) from the pull-down box in the upper-middle of the window. Exit the Quest window.

Updating from the Pre-v1.48 System
There are several ways to do this, but we're going to go for the short, simple, and easy - dismantle the old system and let the new start from scratch. This method will cover both player's just starting with your mod and those that have already used the old system:
Edit each piece of equipment and set them to "Initially Disabled" and, if checked, uncheck "Set Enable State to Opposite of Parent" under the Parent tab. Make sure to get all of the old static apparati, including the returner.
Make sure the parent container is also set to "Initially Disabled".
If your container is unique to your mod, add this Object script to the container
 scn MyModContainerScript

short Update

begin GameMode
    if Update
        return
    elseif (GetInSameCell player)
        set Update to 1
        RemoveAllItems player
        if (GetDisabled == 0)
            Disable
        endif
    endif
end>/pre>
If your container comes from another mod (e.e., Oblivion.esm, COBL Main.esm) then make a quest as in the "Starting Equipment" section. Apply this Quest script
 
Set up the new system as described in the "Basic Setup" section
If you want to be a bit more adventurous, you can skip the if (GetInSameCell player) check. It's perfectly safe to disable a persistent object while outside the cell, but I'm not sure if the children (the apparati and return object) will correctly Disable. You could also try replacing the old scripts with the new ones, however, in general, replacing scripts leads to CTDs and other oddities and it's highly recommended that you don't do this.

How to create your own Model
Waruddar created the original models, so I need to tug on his sleaves a bit to properly explain this. However, you can look at what he's done (the files are in the "...\Data\Meshes\COBL\Static App" directory). I'd also suggest reading this topic, especially post #4.--Haama 20:00, 7 December 2008 (EST)

Each model actually consists of several models - one for each rank, basically. Each model has a corresponding animation group:

You can also make a model that includes all apparati - the process for making the model itself is the same. When it comes to adding it into the game world in the CS, make sure to give it the Mortar and Pestle faction cobStaticAppIDMortPest.