Oblivion Mod:Cobl/Modding/Recipe Updater Engine

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

You can see what RUE is all about in the Projects section. So, here's what you can do so far:

Initialize RUE[edit]

Before you do anything, you need to make sure RUE has been initialized. I suggest using a quest and result script for this. It may seem weird, but it's necessary - if the player doesn't have at least COBL v1.35 installed the script won't run. This way the result script won't run, but the quest script will.

scn YourQuestScript
long  Warning
...
begin GameMode
        SetStage YourQuest 0
        if (Warning == 0)
                set Warning to 1
                messagebox "You need COBL v1.35 or later in order to use this mod. Please visit http://planetelderscrolls.gamespy.com/View.php?view=OblivionMods.Detail&id=3508 for more information and the download."
                return
        endif
        if (Warning == -1)
                ;Add items, enable objects, etc. to get the player started with your mod
                StopQuest YourQuest
        endif
end

and on the Stage 0 result script

cobRUEInitFAR.Activate player, 1
if (cobRUEInit > 0)
        set Warning to -1
endif

Alchemical Recipes[edit]

You can create recipes that work the same way as the vanilla Alchemy system. That is, they will require a Mortar and Pestle, will take 2-4 ingredients (no Master/Single-Ingredient Potions), and will produce a potion with strength based on the player's Alchemy skill and other factors. The strength of the potion should match those produced through the Alchemy menu, with the exception of >100 skill levels when the player is using Elys' Uncapper plugin (it will remove the cap and allow player's to create more powerful potions).

Initializing Alchemy-type recipes[edit]

A simple line that can be placed on any script (make sure to initialize RUE first)

cobRUEInitAlchemyFAR.Activate player, 1

Creating the recipe[edit]

This basically consists of passing some information to the RUE functional activator "SetupRecipe" using arrays. If you haven't used Pluggy arrays yet, you should check out the CS wiki for more information and keep it handy for any unfamiliar functions.

We need to pass four types of information to SetupRecipe: the ingredients used by the recipe, the potion it creates, a special global designating what type of recipe it is, and a new Recipe object.

  1. Ingredients
    • Create an array (if you haven't already)
    long aIng
    set aIng to CreateArray
    • Fill the array with the necessary ingredients. For this example, we'll use an Apple and an Orange.
    SetRefInArray aIng 0 Apple 1
    SetRefInArray aIng 1 Orange 1
    ArraySize aIng 2
    • The ArraySize function is important, as it cuts off any extra information that may have been attached to the array (i.e., if you had used it before to make a 3-ingredient recipe, the 3rd one would still be there until ArraySize cuts it off).
    • Send the info to the Setup Recipe function
    set cobRUESetupRecipeFAR.aMaterialsList to aIng
  2. Potion
    • Create a second array (if you haven't already)
    long aPot
    set aPot to CreateArray
    • Create a clone of the generic potion "cobRUEDefAlchProduct" and add it to the array (if you haven't already).
    ref rTempPot
    set rTempPot to (CloneForm cobRUEDefAlchProduct)
    SetRefInArray aPot 0 rTempPot 1
    • Set the name of the new potion
    SetName "Potion Name" rTempPot
    • Send the info to the Setup Recipe function
    set cobRUESetupRecipeFAR.aProductsList to aPot
  3. Recipe-type designation
    • Create a third array (if you haven't already)
    long aDefault
    set aDefault to CreateArray
    • Add the special global "cobDefAlchemy" to the array (if you haven't already)
    SetInArray aDefault 0 cobDefAlchemy
    • Pass the info to the Setup Recipe function
    set cobRUESetupRecipeFAR.aProductsDefaults to aDefaults
  4. New Recipe object
    • Create the new Recipe by cloning "cobRUERecipeEnchScroll"
    ref rNewRecipe
    set rNewRecipe to (CloneForm cobRUERecipeEnchScroll)
    • Set the name of the new recipe (add a space before the name to keep all of the recipes in the same place on the inventory screen)
    CopyName cobRUEDefAlchProduct rNewRecipe
    ModName "| " rNewRecipe
    • You don't need to worry about the recipe's enchantment. The first time the player uses the recipe, its enchantment will be updated to the effects of the current potion (including the proper strength). If you want to add the effects anyway, wait until after the recipe has been set up, and make sure you're working with the enchanment of the scroll instead of the scroll itself (ask me how I know that :P)
    ref rEnch
    set rEnch to (GetEnchantment rNewRecipe)
    • Pass the info to the Setup Recipe function
    set cobRUESetupRecipeFAR.rRecipe to rNewRecipe
  5. Set up the new recipe
    • Activate the Setup Recipe function
    cobRUESetupRecipeFAR.Activate player, 1
  6. Give the new recipe to the player, and you're done
    player.AddItem rNewRecipe 1