Originally Posted by Abraxas*
Quote
How do you craft from scripts at all ? Is there an API to the crafting system ?
And how do you get access to the Stats which are what the crafting system uses to select ingredients and output ? And how do you put boosts on items ?

Is there some kind of #include in dialogs?

Ah, would be nice if such functions existed (but they don't as far as I see). What I do is transcripting crafting recipes to Osiris scripts, so I don't/can't use stats but templates and can't support all kinds of recipes. So: boosts, recipes with autolevel (all weapon and armor recipes) and crafted items without own template can't be supported by my mod. But that's okay: I like the crafting system of D:OS, my only intention is to compensate missing functions of inventory management to facilitate crafting. I'll support about 200 recipes (also recipes that require an anvil or other external objects), so that's quite a lot (all Potions, Arrows, Arrowheads, Grenades, ingredients like ore bars, dust, etc.).

I store different types of recipes in databases and use the information later. To give some examples:

Code
DB_CraftingFlags("POT_HealSmall","CON_Potion_Empty_A_cd6e86ca-e9be-444e-a7df-d295ec6bb578","CON_Herb_Mushroom_A_0106e3c1-bd81-4118-8a28-59c6dc941feb","CON_Potion_Health_A_944e4b8c-1736-4ff6-8fa6-d7ceda9941da","Crafting",1)
DB_CraftingFlagsDouble("POT_HealMedium","CON_Potion_Health_A_944e4b8c-1736-4ff6-8fa6-d7ceda9941da","CON_Potion_Health_A_944e4b8c-1736-4ff6-8fa6-d7ceda9941da","CON_Potion_A_Health_Medium_d2781168-5862-4e6d-95a3-47d9bd9e8dba","Crafting",2)
DB_CraftingFlagsWithTool("ARWI_ShaftBranch","WPN_Branch_A_568ab219-039b-4200-a24b-d29c9500fe4f","WPN_ArrowShaft_A_3ba1a061-0fe3-4c8e-a34a-940aecee16c9",3,"Crafting",0)
DB_ExternalCraftingFlags("UTI_IronBar","LOOT_Ore_A_Iron_A_053e23db-a144-4619-bb96-3208aecc77d5","Oven","LOOT_OreBar_A_Iron_A_1eabd114-a6c5-4e24-b61f-0932c65b8ef3",1,"Repair",1)


It's too much to explain how the whole script works and communicates with the dialog and - in the case of crafting with anvil etc. - with the character script. But I will comment and post the script when the mod is finished (about 1-2 weeks).

Looked at your database again. Amazing stuff.

You probably 'simulate' crafting with ItemTemplateAddToCharacter() and play some animation where necessary.

I hope you know how 'dangerous' ItemHandleRemove() is, already stumbled into that 'trap' myself ;-)