How to set up custom recipes and crafting stations

Custom Recipes

OCRAFT Ini files are located in "Data/Ini/OCRAFT" folder.
They must have the same name as one of loaded plugin files + .ini extension, for example: Oblivion.esm.ini
If named like that, they are automatically recognized and loaded by the mod.

Recipe is defined by several lines in INI file. Here is a generic example:

set OCRAFT.StationRef to (GetFormFromMod "ModName.esp" XXXXXX)
set OCRAFT.ResultingItem to (GetFormFromMod "ModName.esp" XXXXXX)
set OCRAFT.ResultingItemN to 1
set OCRAFT.C01 to (GetFormFromMod "ModName.esp" XXXXXX)
set OCRAFT.C01N to 1

set OCRAFT.C02 to (GetFormFromMod "ModName.esp" XXXXXX)
set OCRAFT.C02N to 1
set OCRAFT.C03 to (GetFormFromMod "ModName.esp" XXXXXX)
set OCRAFT.C03N to 1
set OCRAFT.C04 to (GetFormFromMod "ModName.esp" XXXXXX)
set OCRAFT.C04N to 1
set OCRAFT.C05 to (GetFormFromMod "ModName.esp" XXXXXX)
set OCRAFT.C05N to 1
set OCRAFT.C06 to (GetFormFromMod "ModName.esp" XXXXXX)
set OCRAFT.C06N to 1
set OCRAFT.C07 to (GetFormFromMod "ModName.esp" XXXXXX)
set OCRAFT.C07N to 1
set OCRAFT.iSkillCode to 12
set OCRAFT.iSkillLevel to 50
set OCRAFT.Breakdown to 0

SetStage OCRAFT 1

Lines marked in yellow are required for recipe to function, while green ones are optional and can be omitted.

Required parameters:
set OCRAFT.StationRef to (GetFormFromMod "ModName.esp" XXXXXX) - this is the crafting station. OCRAFT comes with a number of crafting stations already pre-defined:
  • (GetFormFromMod "OCRAFT.esp" 000819) - Smithing (Forge, Anvil, etc.)
  • (GetFormFromMod "OCRAFT.esp" 00080C) - Cooking (Cooking Pot/Campfire)
  • (GetFormFromMod "OCRAFT.esp" 00081E) - Workbench
  • (GetFormFromMod "OCRAFT.esp" 000827) - Baking Oven
  • (GetFormFromMod "OCRAFT.esp" 00082D) - Smelting
  • (GetFormFromMod "OCRAFT.esp" 00082F) - Tanning
  • (GetFormFromMod "OCRAFT.esp" 00082B) - Fletching
Custom crafting stations can also be defined by other mods, more on that in the separate section.

set OCRAFT.ResultingItem to (GetFormFromMod "ModName.esp" XXXXXX) - base form of a crafted item. XXXXXX is replaced by FormID without mod index and ModName.esp is replaced by esp/m file from which the item comes from
set OCRAFT.ResultingItemN to 1 - quantity of crafted item. Obviously this can only be a whole positive number.

set OCRAFT.C01 to (GetFormFromMod "ModName.esp" XXXXXX) - first component of the recipe. Syntax is the same as described above for crafted item. A recipe needs at least one valid component to function.
set OCRAFT.C01N to 1 - required quantity for first component

SetStage OCRAFT 1 - this line finishes recipe registration and resets all variables, so you can start the next recipe.

Optional parameters:
set OCRAFT.C02 to (GetFormFromMod "ModName.esp" XXXXXX)
set OCRAFT.C02N to 1

I hope these are self-explanatory. Recipes can have up to 7 components.

set OCRAFT.iSkillCode to 12 - defines what skill is required to craft the recipe. The number is a skill code, which are:

set OCRAFT.iSkillLevel to 50
- defines the level of required skill.

set OCRAFT.Breakdown to 1 - this is a unique parameter, setting which to 1 will mark recipe as "breakdown" - this means that crafted item and components are flipped. In normal recipes, components are combined to produce an item, while in "breakdown" recipe up to 7 components are produced from an original item.

The one important limitation of the system is that there can only be one recipe for particular item per crafting station.
This means that you cannot create different "versions" of the recipe for the same item, but with different components.

Crafting Stations

Any number of custom crafting stations can be created in mods and work with the system.
The steps to setting up a crafting station:
1.) Create a new container record. This is the base of your crafting station.
2.) Create a persistent reference with that container and give it an EditorID, like MyCraftingStationREF. It's recommended to place this reference in an inaccessible cell somewhere.
3.) Create a new activator and a new script for it. These activators can then be placed in game world and interacted with to bring up crafting menu. The script on an activator can be of 2 types:

Version A, using OCRAFT.esp as a master:
begin OnActivate
 Call OCRAFTFnActivateCraftingStation MyCraftingStationREF

Version B, without using OCRAFT.esp as a master:
ref rTemp
begin OnActivate
 if IsModLoaded "OCRAFT.esp"
 Let rTemp := GetFormFromMod "OCRAFT.esp" 00080F
 Call rTemp MyCraftingStationREF

Article information

Added on

Edited on

Written by