Open main menu

UESPWiki β

Oblivion Mod:Cobl/Modding/Alchemical Sorter

< Mod / Oblivion: Oblivion Mod: Cobl: Mods ! Modding ! Projects

COBL (Common Oblivion) contains an alchemical sorter by PhoenixAmon (nee Daleth) and updated by haama.


FeaturesEdit

  • Store all of your ingredients with the click of a button.
  • Retrieve ingredients by effect - you'll be given a list of effects that you can make with your ingredients, select as many as you want and the ingredients that have that effect (corrected for Alchemy rank) will be moved to the player.
  • With OBSE v12, will work with any ingredient from any mod and an expanded set of effects (v1.16).
    • Also, two buttons have been added to make it easier to create potions on the fly. These allow the player to open the Alchemy menu while the Effects list is still open, create their potions, then reset the list of effects and see what other potions they can make (v1.48).
  • With OBSE v11, will also work with potions and scrolls (v1.48).
  • If the player is using a mod with COBL's dinner plate, this can also open a menu with only food items (v1.26).

Modder BasicsEdit

Simplest usage by modders is to drop one of the existing alchemical sorter containers in their mod. These are single containers that have the appearance of a shelf of containers (i.e., although the mesh looks like several different containers, it's actually just one.) You'll find these under containers -- their editors ids start with cobAlsShelf (LC, MC and UC indicate Lower Class, Middle Class and Upper Class respectively).

If you want to use a different container mesh (standard chest, standard cabinet, etc.) just create the container object as desired, and set its script to cobAlsTriggerOS. (Note: Make sure that the container is not set to respawn.)

Most likely, that's all you'll need to do. However, if you want to do more (create portable sorters, use multiple containers, etc.), then read on...

Tip: If you would like the shelves to look like they're built into the wall, you might use cobAlsShelfMC and push it back into the wall until the backing is hidden. If the backing sticks out slightly to the side of a narrow wall, then try changing the scale of the reference to shrink it.

Remote AccessEdit

The Trigger script has been updated (v1.48) to allow remote access without the need for a new script - meaning your Alchemical Sorter will have all future features and updates. The new system can also work during MenuMode so you can use inventory items as "Alchemy Bags". Details:

  • Create a remote cell.
  • Create a new Activator with an appropriate EditorID (i.e., "ModNameAlsTriggerObj") and attach the trigger script (cobAlsTriggerFAS) to it.
  • Create the Activator reference and give it a Reference Editor ID (i.e., "ModNameAlsTrigger") and check "Persistent Reference" and "Initially Disabled".
  • Create a container reference - if you don't mind the normal chest open/close sound you can use cobGenChest. If you need to use a different opening/closing sound you can use cobGenChest as a base.
  • Create your object or item and apply this script (note this will work for both inventory items in Journal mode and objects in the game mode)
scn MyModObjectScript

begin onActivate
    if (IsActionRef player)
        set MyModAlsTrigger.rUseContainer to MyModRemoteContainer
        MyModAlsTrigger.Activate cobGenActRef, 1
    endif
end

begin onEquip
    if (GetContainer == player)
        set MyModAlsTrigger.rUseContainer to MyModRemoteContainer
        MyModAlsTrigger.Activate cobGenActRef, 1
    endif
end

Pre-v1.48Edit

By default, the sorter stores all ingredients in one container and all 3 of its functions are triggered by that container. If you want to use that default behavior, you only need to add your own storage container using whatever mesh you like, make sure it is not set to respawn, and attach the Trigger script.

You can set this up differently, and the trigger script is commented more heavily than you probably need. :) The main thing you need to know is if you want objects or actors other than the storage bin to trigger the effects, you needs your storage container to be a Persistent Reference with a unique name. You'll then need to clone the parts of the trigger script you want to use and replace "GetSelf" with the name of your container reference. Note that you must create a new script instead of editing COBL's, and that by doing so the script will not be updated when/if there is a COBL update (i.e., won't have v1.48's potion and scroll sorting).

Multiple ContainersEdit

If you want to use multiple containers to store your alchemy ingredients, you need to do a bit more work. I'll do my best to explain that here. First off, you still need a main storage container. This container should be placed in the gameworld somewhere outside of the player's sight (the way merchant containers are). Make sure it is not set to respawn. Once it's placed, make it a Persistent Reference and give it a unique name. In my samples, I'll call it "MyMainContainerRef".

You will need an object or actor to trigger the Storage part of the sorter, with a trimmed-down version of the trigger script mentioned above. If you look at the trigger script, it'll be easy to see what you need.

At this point you can choose to use a separate container for each ingredient name or a separate container for each potion effect.

Separate Containers by IngredientEdit

You need one container for every ingredient name. There are several sets you can download or you can make your own. You do not need to make these containers persistent references. Each container needs to have a script like the following:

scn AlchContAlkanetFlower ;Set the name to fit with your mod (i.e., "ModNameIngJarAlkanetFlowerOS")

short iCount
ref   rIngredient
ref   rMainCont
short ContOpened

Begin OnActivate
  if (IsActionRef player)
    ;Change these two references to suit your script
    set rIngredient to AlkanetFlower ;Set this to the base reference Editor ID of the ingredient
    set rMainCont to MyMainContainerRef ;Set this to the Reference Editor ID of your container

    set iCount to rMainCont.GetItemCount rIngredient
    If iCount > 0
      rMainCont.RemoveItem  rIngredient iCount
      AddItem rIngredient iCount
    EndIf
    set ContOpened to -1
    Activate player ;Be sure that you leave out the 1 or RunOnActivate flag
  Endif
End

Begin MenuMode 1008 ;Container menu - using this to avoid any complications if the container takes a few frames to open
  If ContOpened
    set ContOpened to 1
  EndIf
End

Begin GameMode
  If ContOpened
    If (ContOpened == 1)
      RemoveAllItems rMainCont ;Return all ingredients to the main container
    EndIf
  EndIf
End

Each script only needs 3 things changed: the script name, the ingredient reference and the container reference. Now after your trigger object or actor has put the ingredients away into the main storage container, the player can activate the small containers to take ingredients out by name.

Separate Containers by EffectEdit

You need one container for every potion effect the player can make. I don't know of any downloadable sets for this. You do not need to make these containers persistent. Each container needs to have a script like the following:

scn AlchContBurdenOS

ref   rSelf
short ContOpened

Begin OnActivate
  if (IsActionRef player)
        ;Change these to suit your script
        set cobAlsSorterFAR.inRContainer to MyMainContainerRef ;Set this to the Reference Editor ID of your container
        set cobAlsSorter1.iBurden to 1 ;Set to the effect, see below for the list
        set cobAlsSorterFAR.inItemType to 25 ;For Ingredients, set to 40 for Potions or 21 for Scrolls

        cobAlsSorterFAR.Activate cobGenActRef, 1
        set rSelf to GetSelf
        cobAlsTempRef.RemoveAllItems rSelf
        set ContOpened to -1
        Activate player ;Be sure that you leave out the 1 or RunOnActivate flag
  endif
End

Begin MenuMode 1008 ;Container menu - using this to avoid any complications if the container takes a few frames to open
  If ContOpened
    set ContOpened to 1
  EndIf
End

Begin GameMode
  If ContOpened
    If (ContOpened == 1)
      RemoveAllItems rMainCont ;Return all ingredients to the main container
    EndIf
  EndIf
End

Each script only needs 3 things changed: the script name, the container reference and the effect. If you'd like to use this for potions or scrolls, change the ItemType number and make sure to test for the proper OBSE version with

...
        set cobAlsSorterFAR.inItemType to 25 ;For Ingredients, set to 40 for Potions or 21 for Scrolls
        SetStage cobSigSE 0
        if (cobSigSE.Version < 11)
            messagebox "You need (at least) OBSE v11 to use this sorter."
            return
        endif
...

Also, be sure the player is using at least COBL v1.53 before using this. You can check in an init script or here with

...
        SetStage cobSigSE 0
        if (cobSigSE.VersionCOBL < 1.53)
            messagebox "You need (at least) COBL v1.53 to use this sorter."
            return
        endif
...

Pre-v1.53 and Post-v1.47Edit

scn AlchContBurdenOS

ref   rMainCont
ref   rSelf
short ItemType
short ContOpened

Begin OnActivate
  if (IsActionRef player)
        ;Change these to suit your script
        set rMainCont to MyMainContainerRef ;Set this to the Reference Editor ID of your container
        set cobAlsSorter1.iBurden to 1 ;Set to the effect, see below for the list
        set ItemType to 25 ;For Ingredients, set to 40 for Potions or 21 for Scrolls

        SetStage cobSigSe 0
        if (cobSigSe.version >= 11)
                set cobAlsSorterSeFAR.inRContainer to rMainCont
                set cobAlsSorterSeFAR.ItemType to ItemType
                cobAlsSorterSeFAR.Activate cobGenActRef, 1
        else
                set cobAlsSorter1FAR.inRContainer to rMainCont
                cobAlsSorter1FAR.Activate cobGenActRef, 1
                set cobAlsSorter2FAR.inRContainer to rMainCont
                cobAlsSorter2FAR.Activate cobGenActRef, 1
                set cobAlsSorter3FAR.inRContainer to rMainCont
                cobAlsSorter3FAR.Activate cobGenActRef, 1
                set cobAlsSorter4FAR.inRContainer to rMainCont
                cobAlsSorter4FAR.Activate cobGenActRef, 1
        endif
        set rSelf to GetSelf
        cobAlsTempRef.RemoveAllItems rSelf
        set ContOpened to -1
        Activate player ;Be sure that you leave out the 1 or RunOnActivate flag
  endif
End

Begin MenuMode 1008 ;Container menu - using this to avoid any complications if the container takes a few frames to open
  If ContOpened
    set ContOpened to 1
  EndIf
End

Begin GameMode
  If ContOpened
    If (ContOpened == 1)
      RemoveAllItems rMainCont ;Return all ingredients to the main container
    EndIf
  EndIf
End

Same instructions as with the Post-v1.52 system. The system is fully backwards compatible, and this method continues to work with v1.53.

Pre-v1.48Edit

It's strongly advised to use one of the above systems because v1.48 adds a lot to the Alchemical Sorter. However, if you do decide to use this system - The system is fully backwards compatible, and this method continues to work with v1.48 and all later versions.

scn AlchContBurdenScr

short bActive
short bEmpty
float Timer

Begin OnActivate
  if (IsActionRef player)
        ;Change these to suit your script
        set cobAlsCounter1.rContainer to MyMainContainerRef ;Set this to the Reference Editor ID of your container
        set cobAlsSorter1.iBurden to 1 ;Set to the effect, see below for the list

        set cobAlsCounterVars.bEffectContainers to 1
        set cobAlsCounter1.iAlchSkill to player.GetBaseAV Alchemy
        set cobAlsSorter1.fQuestDelayTime to 0.01
        set bActive to 1
        StartQuest cobAlsSorter1
  endif
End

Begin GameMode
    If bActive
      If Timer < 0.7
        set Timer to Timer + GetSecondsPassed
      Else
        cobAlchTempRef.Activate player ;Be sure that you leave out the 1 or RunOnActivate flag
        set Timer to 0
        set bEmpty to 1
        set bActive to 0
      EndIf
    ElseIf bEmpty
      cobAlchTempRef.RemoveAllItems MyMainContainerRef
      set bEmpty to 0
    EndIf
End

That might look a little horrid, but you only need to change a few things for each effect container. Each needs its own script name. Each needs "MyMainContainerRef" changed to the name of your main container reference.

The only other line to worry about is "set cobAlsSorter1.iBurden to 1". In that line, you need to change "Burden" to the name of the effect for the particular container. Remove any spaces or dashes (-) from the effect name, like the ones listed below.

In that same line, you need to set the right quest name for the effect you're working on. I tried to put all those variables in a single script, but it didn't work as I'd hoped so I had to split them up. The correct quest names are as follows:

EffectsEdit

cobAlsSorter1 --
    iBurden
    iChameleon
    iCureDisease
    iCureParalysis
    iCurePoison
    iDamageAgility
    iDamageEndurance
    iDamageFatigue
    iDamageHealth
    iDamageIntelligence
    iDamageLuck
    iDamageMagicka

cobAlsSorter2 --
    iDamagePersonality
    iDamageSpeed
    iDamageStrength
    iDamageWillpower
    iDetectLife
    iDispel
    iDrainHealth
    iFeather
    iFireDamage
    iFireShield
    iFortifyAgility
    iFortifyEndurance
    iFortifyFatigue
    iFortifyHealth
    iFortifyIntelligence
    iFortifyLuck
    iFortifyMagicka
    iFortifyPersonality
    iFortifySpeed
    iFortifyStrength
    iFortifyWillpower

cobAlsSorter3 --
    iFrostDamage
    iFrostShield
    iInvisibility
    iLight
    iNightEye
    iParalyze
    iReflectDamage
    iReflectSpell
    iResistDisease
    iResistFire
    iResistFrost
    iResistParalysis
    iResistPoison
    iResistShock
    iRestoreAgility
    iRestoreEndurance
    iRestoreFatigue
    iRestoreHealth
    iRestoreIntelligence
    iRestoreLuck
    iRestoreMagicka
    iRestorePersonality
    iRestoreSpeed
    iRestoreStrength
    iRestoreWillpower

cobAlsSorter4 --
    iShield
    iShockDamage
    iShockShield
    iSilence
    iWaterBreathing
    iWaterWalking

cobAlsSorterVars --
;--Vanilla effects that can NOT be made with vanilla ingredients
    iAbsorbAgility
    iAbsorbEndurance
    iAbsorbIntelligence
    iAbsorbLuck
    iAbsorbPersonality
    iAbsorbSpeed
    iAbsorbStrength
    iAbsorbWillpower
    iAbsorbFatigue
    iAbsorbHealth
    iAbsorbMagicka
    iAbsorbArmorer
    iAbsorbAthletics
    iAbsorbBlade
    iAbsorbBlock
    iAbsorbBlunt
    iAbsorbH2H
    iAbsorbHeavyArmor
    iAbsorbAlchemy
    iAbsorbAlteration
    iAbsorbConjuration
    iAbsorbDestruction
    iAbsorbIllusion
    iAbsorbMysticism
    iAbsorbRestoration
    iAbsorbAcrobatics
    iAbsorbLightArmor
    iAbsorbMarksman
    iAbsorbMercantile
    iAbsorbSecurity
    iAbsorbSpeechcraft
    iAbsorbSneak
    iBoundAxe
    iBoundBoots
    iBoundBow
    iBoundCuirass
    iBoundDagger
    iBoundGauntlets
    iBoundGreaves
    iBoundHelmet
    iBoundMace
    iBoundShield
    iBoundSword
    iCalm
    iCharm
    iCommandCreature
    iCommandHumanoid
    iDemoralize
    iDisintegrateArmor
    iDisintegrateWeapon
    iDrainAgility
    iDrainEndurance
    iDrainIntelligence
    iDrainLuck
    iDrainPersonality
    iDrainSpeed
    iDrainStrength
    iDrainWillpower
    iDrainFatigue
    iDrainMagicka
    iDrainArmorer
    iDrainAthletics
    iDrainBlade
    iDrainBlock
    iDrainBlunt
    iDrainH2H
    iDrainHeavyArmor
    iDrainAlchemy
    iDrainAlteration
    iDrainConjuration
    iDrainDestruction
    iDrainIllusion
    iDrainMysticism
    iDrainRestoration
    iDrainAcrobatics
    iDrainLightArmor
    iDrainMarksman
    iDrainMercantile
    iDrainSecurity
    iDrainSpeechcraft
    iDrainSneak
    iFortifyArmorer
    iFortifyAthletics
    iFortifyBlade
    iFortifyBlock
    iFortifyBlunt
    iFortifyH2H
    iFortifyHeavyArmor
    iFortifyAlchemy
    iFortifyAlteration
    iFortifyConjuration
    iFortifyDestruction
    iFortifyIllusion
    iFortifyMysticism
    iFortifyRestoration
    iFortifyAcrobatics
    iFortifyLightArmor
    iFortifyMarksman
    iFortifyMercantile
    iFortifySecurity
    iFortifySpeechcraft
    iFortifySneak
    iFrenzy
    iOpen
    iRally
    iResistMagic
    iResistNormalWeapons
    iScriptedEffect
    iSoulTrap
    iSpellAbsorption
    iStuntedMagicka
    iSummonClannfear
    iSummonDaedroth
    iSummonDremora
    iSummonDremoraLord
    iSummonFadedWraith
    iSummonMDArmor
    iSummonMDHelm
    iSummonFlameAtronach
    iSummonFrostAtronach
    iSummonGhost
    iSummonGloomWraith
    iSummonHeadlessZombie
    iSummonLich
    iSummonScamp
    iSummonSkeleton
    iSummonSkeletonChamp
    iSummonSkeletonHero
    iSummonSkeletonGuardian
    iSummonSpiderDaedra
    iSummonStormAtronach
    iSummonXivilai
    iSummonSpiderling
    iSummonBear
    iSummonZombie
    iTelekinesis
    iTurnUndead
    iVampirism
    iWeaknessToDisease
    iWeaknessToFire
    iWeaknessToFrost
    iWeaknessToMagic
    iWeaknessToNormalWeapons
    iWeaknessToPoison
    iWeaknessToShock
;--Shivering Isles Effects
    iSummonFleshMangled
    iSummonFleshSewn
    iSummonFleshStitched
    iSummonFleshTorn
    iSummonHunger
    iSummonHungerGluttonous
    iSummonHungerRavenous
    iSummonHungerVoracious
    iSummonSaint
    iSummonSeducer
    iSummonShambles
    iSummonShamblesDecrepit
    iSummonShamblesReplete