Oblivion Mod:Cobl/Modding/Static Alchemy Equipment/Pre-v1.48
The resources for Static Alchemy Equipment are a bit unusual as they are (as of now) just a pair of scripts. To make the resource easier to describe, I'm going to pretend that you've made the necessary models and objects for the scripts.
Most static equipment mods magically upgrade as the player's alchemy skill increases. This one has been designed for realism, so if the player wants better equipment they'll need to have it first. Every time the player uses the static set it will search through their inventory. If the player has better equipment, the old equipment will be returned to the player and the new equipment will be used instead.
Contents
Update note[edit]
All of the script names have been edited to "...Old".
Basic Setup[edit]
There are three necessary parts:
- A container to store the equipment
- This container should be made "Persistent", "Initially Disabled", owned by the player, given a Reference EditorID you'll remember, and placed in the same cell as the Static Alchemy Equipment (I know it's suggested to place it in a remote cell in the script. Sorry about that - ignore it). It will be disabled, so you can place anywhere in the cell you want - it will never show up, the player can't run into it, activate it or even see the Activate icon. If you want to, you can place it outside the cell-proper (like the Merchant containers).
- It might be a good idea to include some Novice equipment in the container. This will be the equipment that the player first sees before they have a chance to use it.
- A burner that will start up the Alchemy menu
- When the player activates this, it will look through their inventory for better equipment, store the best equipment in the container, return the rest to the player, and start the Alchemy menu.
- Attach the script "cobStaticAppOS" to this object, make the container its Parent Reference, and mark "Set Enable State to Opposite of Parent".
- A set of alchemy equipment that are really activators
- When the player activates this, their equipment will be returned to them, just as if it was an item (well... set of items).
- Attach the script "cobStaticAppReturnOS" to this object make the container its Parent Reference, and mark "Set Enable State to Opposite of Parent".
Advanced[edit]
With the above, the equipment will always be visible, even if the player's taken all of it. You can make the equipment disappear when the player takes it, and even make each piece disappear and reappear as necessary, but you will have to copy the script and make a few alterations.
All of the Equipment as one piece[edit]
- Set up the 3 objects as above
- Edit the Equipment - make it "Persistent", make the container its Parent Ref, and give it a Reference EditorID. If you leave the container empty, make it "Initially Disabled" also.
- Copy the "cobStaticAppOS" script to a new script. Add the following left-aligned lines
- Attach the new script to your Burner object.
... begin onActivate if (IsActionref player) set rCont to GetParentRef ;Find new apparatuses ;snip ;Test for OBSE SetStage cobSigSe 0 if (cobSigSe.Version >= 10) ... endif ;snipend if EquipmentRefEdID.GetDisabled ;Equipment is currently invisible/disabled if rMortPest ;Only checking Mortar and Pestle because it is absolutely necessary, you can check the other equipment as well EquipmentRefEdID.Enable endif else ;Equipment is currently visible/enabled if (rMortPest == 0) && (rAlem == 0) && (rCalc == 0) && (rRet == 0) EquipmentRefEdID.Disable endif endif ;Add and equip apparatuses ;The apparati aren't removed immediately to give other mods time to scan the inventory for them ;snip if MortPestQual ...
Equipment as individual objects[edit]
- Set up the Burner and container as above
- Create 4 objects, one for each piece of equipment.
- Edit each piece of Equipment - make each "Persistent" and give each a unique Reference EditorID. If the container doesn't contain the piece of equipment, make that piece "Initially Disabled" also.
- Copy the "cobStaticAppOS" script to a new script. Add the following left-aligned lines
- Attach the new script to your Burner object.
- Edit the Burner - make it "Persistent", make the container its Parent Ref, and give it a Reference EditorID.
- Create a new Return script for each piece of equipment.
- Attach each script to each Equipment piece. Make sure you've attached the correct one.
... begin onActivate if (IsActionref player) set rCont to GetParentRef ;Find new apparatuses ;snip ;Test for OBSE SetStage cobSigSe 0 if (cobSigSe.Version >= 10) ... endif ;snipend ;Mortar and Pestle object if MortPestEquipmentRefEdID.GetDisabled ;Equipment is currently invisible/disabled if rMortPest MortPestEquipmentRefEdID.Enable endif else ;Equipment is currently visible/enabled if (rMortPest == 0) MortPestEquipmentRefEdID.Disable endif endif ;Alembic object if AlemEquipmentRefEdID.GetDisabled ;Equipment is currently invisible/disabled if rAlem AlemEquipmentRefEdID.Enable endif else ;Equipment is currently visible/enabled if (rAlem == 0) AlemEquipmentRefEdID.Disable endif endif ;Calcinator object if CalcEquipmentRefEdID.GetDisabled ;Equipment is currently invisible/disabled if rCalc CalcEquipmentRefEdID.Enable endif else ;Equipment is currently visible/enabled if (rCalc == 0) CalcEquipmentRefEdID.Disable endif endif ;Retort object if RetEquipmentRefEdID.GetDisabled ;Equipment is currently invisible/disabled if rRet RetEquipmentRefEdID.Enable endif else ;Equipment is currently visible/enabled if (rRet == 0) RetEquipmentRefEdID.Disable endif endif ;Add and equip apparatuses ;The apparati aren't removed immediately to give other mods time to scan the inventory for them ;snip if MortPestQual ...
scn YourScriptName ref rCont ref rItem begin onActivate if (IsActionRef player) set rCont to BurnerRefEdID.GetParentRef set rItem to BurnerRefEdID.rMortPest ;rMortPest for the Mortar & Pestle, rAlem for the Alembic, rCalc for the Calcinator, rRet for the Retort if (rCont.GetItemCount rItem) ;Just to check, as a removing an item that isn't in a container can cause a CTD player.AddItem rItem 1 rCont.RemoveItem rItem 1 set BurnerRefEdID.rMortPest to 0 set BurnerRefEdID.MortPestQual to 0 Disable endif endif end
Changing the Model too[edit]
You can also change the model of each Equipment piece to match the one in the container. I don't have any experience in this area, so you'll have to play with it. If you do, please post a short guide here!