Oblivion Mod:Cobl/Modding/Static Alchemy Equipment/Pre-v1.48

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

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.

Update note[edit]

All of the script names have been edited to "...Old".

Basic Setup[edit]

There are three necessary parts:

  1. 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.
  2. 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".
  3. 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]

  1. Set up the 3 objects as above
  2. 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.
  3. Copy the "cobStaticAppOS" script to a new script. Add the following left-aligned lines
  4. ...
    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
    ...
  5. Attach the new script to your Burner object.

Equipment as individual objects[edit]

  1. Set up the Burner and container as above
  2. Create 4 objects, one for each piece of equipment.
  3. 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.
  4. Copy the "cobStaticAppOS" script to a new script. Add the following left-aligned lines
  5. ...
    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
    ...
  6. Attach the new script to your Burner object.
  7. Edit the Burner - make it "Persistent", make the container its Parent Ref, and give it a Reference EditorID.
  8. Create a new Return script for each piece of equipment.
  9. 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
  10. Attach each script to each Equipment piece. Make sure you've attached the correct one.

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!