Jump to content

[LE] [Scripting] Get a list of all recipes


Recommended Posts

Is there any way to have a script grab a list of every recipe that's currently loaded into the game?

I was looking at making an inventory management/storage mod (I know there are several out there), but it would be nice if you could have it identify what items are used at what crafting stations without having to manually tell it. (Obviously you wouldn't do this all the time, and you'd store the results)*. But I can't figure out how to do something like this and I'm not sure if it's just because I'm new to modding or not.

Similarly curious about quests.

*Judging from an existing mod that I'm looking it, looks like this is best handled by having dedicated chests to hold a copy of items that have been filtered into various categories.

Edited by moosers
Link to comment
Share on other sites

You cannot do this easily in-game. There is no way to obtain the results or ingredients of a recipe without first knowing the recipe object. Thus your mod would need to have a formlist of every COBJ (recipe) record in the game. For each mod that adds said records, a patch to update the formlist would be required or additional scripting to check for the presence of said plugin and obtain the recipes by means of GetFormFromFile. The of course said formlist of recipes would have to be cycled with each recipe's ingredients being further cycled in order to be added to different formlists depending upon what workstation the recipe worked with. That is a lot of processing to take place in-game...

 

The easiest route is to use a script for TES5Edit that the end user can run with their entire load order active. The script would go through the plugins, look at the COBJ records and assign the ingredient items to the appropriate formlists. My mod Inventory Management System utilizes this method (both the LE and SSE versions). You are welcome to take a look at how it was done. The TES5Edit script does populate additional formlists but its main priority is to populate formlists with recipe ingredients based upon a pre-defined text list pairing of workstation keywords and target formlist Editor ID.

Link to comment
Share on other sites

You cannot do this easily in-game. There is no way to obtain the results or ingredients of a recipe without first knowing the recipe object. Thus your mod would need to have a formlist of every COBJ (recipe) record in the game. For each mod that adds said records, a patch to update the formlist would be required or additional scripting to check for the presence of said plugin and obtain the recipes by means of GetFormFromFile. The of course said formlist of recipes would have to be cycled with each recipe's ingredients being further cycled in order to be added to different formlists depending upon what workstation the recipe worked with. That is a lot of processing to take place in-game...

 

The easiest route is to use a script for TES5Edit that the end user can run with their entire load order active. The script would go through the plugins, look at the COBJ records and assign the ingredient items to the appropriate formlists. My mod Inventory Management System utilizes this method (both the LE and SSE versions). You are welcome to take a look at how it was done. The TES5Edit script does populate additional formlists but its main priority is to populate formlists with recipe ingredients based upon a pre-defined text list pairing of workstation keywords and target formlist Editor ID.

Hmm, I wonder how Legacy of the Dragonborn auto-sorts new items then. It seems to do a pretty good job of figuring it out in-game. But they don't include most of their script source files so I couldn't get any idea what they were doing. Maybe it just has a lot of mods to look for built in. I'll take a closer look at the formlists it has since it should at least have one for each mod. Though at the point where you have a formlist of every recipe for mods, you really just need formlist of what ingredients are used at what stations.

 

I'll take a look at your mod though. Thanks.

Link to comment
Share on other sites

LotD has a crap ton of Game.GetFormFromFile calls for all the third party mod items. You can use Champollion (works with both LE and SSE) to decompile the PEX files into human readable and re-usable PSC files. Just note that it cannot distinguish between Function and Event so everything will appear as a function.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...