[Script][Learning]Recipes & Blacksmith Integration

Format: Numeric list
Font: Font Face
Colors: limegreen, teal, orange, red, blue
Language: AE

Index

1.0 Recipes
1.1 Setup
1.2 Formula Config
1.3 Item Parameters
2.0 Blacksmith Integration
2.1 Setup
2.2 Adding the recipe

1.0 Recipes

This part of the tutorial will scope with how to set up a new recipe for the blacksmith. To do this, we will first look at the formular config which contains the most important part of recipes and afterwards the Item Parameters which determine some more important properties.

1.1 Setup

First, we need to make either a new recipe record or copy an existing one. For now, we’ll copy an existing one as that’s way less work to do.

For instance, I’ll use this record:

records\items\crafting\blueprints\other\craft_elixir_aether.dbr

First you need to either load your mod or create a new one (Mod -> New…)

Then go to Database -> Import Record in the menu bar and select the recipe you want to copy (or simple copy paste the path above) and press ok.


You should have imported your database record now.
Navigate to it and right click it -> Rename

and give it a different name. For me that’ll be sample_recipe.

Now doubleclick the .dbr file (or right click -> edit)

This window should open:

Now you’re ready to begin working on your new recipe.

1.2 Formula Config

Now that you opened your recipe record, we first want to have a look at the “Formula Config”. To do this, select it in the treeview on the left of the DBR Editor:

You’ll notice that there are quiet a lot entries. I’ll explain these now:

artifactFormulaBitmapName is an entry of the type “tex” which means that it’s value is usually a path that leads to a texture file from the game’s resources. In this case, it is a bitmap as it’s the icon that will be shown in the inventory of the player when picking it up from the ground. We will let it as it is for now.

artifactName is the entry that determines which item (or items) will be crafted. This can either be an item or an itemtable. In our case it’s an item as this is the blueprint for the aether elixir. We will change it to something else to see it’s effect ingame later. For now, I’ll change it to an enchantment:

records/items/enchants/a01a_enchant.dbr

To do this, double click the value. A button should appear on the right of the value:

if you now click this button, the same window as from Import Record will open. Now navigate to the item you want to craft (or use copy & paste if you want to use the same enchantment as me) and click ok.

It should look like this now:

forcedRandomArtifactName is the entry that determines which item will be shown in the blacksmith’s item preview which is pretty usefull if you’re using an item table as the game otherwise wouldn’t know which of the items in the item table to show. If you let this blank, it will be the item you put for artifactName. To show you the effect of this, we will now change this, too, but to a different item. I’ll change it to the fabric quest item to make the effect significant:

records/items/questitems/quest_fabric.dbr

forcedRelicCompletion determines whether a component will be entirely crafted or only one part of it if the crafted item is a component.
artifactCreateQuantity is the amount of items you craft in one turn.
ArtifactCreationCost is the amount of iron you need to spent to craft this item
reagentBaseBaseName is a .dbr path to the “great” item that is required to craft this item, for example scrap, blood etc. This entry must have an item assigned in order to make the recipe work.
reagentBaseQuantity is the amount of items from reagentBaseBaseName that is required to craft this item. It has to at least be 1 in order to make the recipe work.
reagent#BaseName is a .dbr path to the #. component that is required to craft this item. Optional.
reagent#Quantity is the amount of items from reagent#Basename that is required to craft this item. Optional.

If you feel like changing anything here, do as you wish but keep in mind that a recipe without reagentBaseBaseName and quantity will not show up in the blacksmith even if you learned it. I’ve removed the reagent1BaseName and quantity so that my recipe only requires a tainted brain matter to be crafted. Also I’ve set the creation cost to 0 to be able to test the recipe without needing to spent iron on it. Nevertheless it will always cost at least 1 iron, even if you put 0 as cost.

Why are all these named something with artifact?

Since Grim Dawn uses the engine of tq, these are entries related to it. In tq, relics used to be artifacts and artifacts were the only type of item that could be crafted, so this is why the entries are named artifact. If the devs would have renamed everything from tq fitting for Grim Dawn it would have taken even longer until we get the tools, not to speak of having to change half the engine.

1.3 Item Parameters

If you now select “Item Parameters” on the right side of the record editor, the entries on the right will change to look like this:

itemText is a tagbased string that will display as the item’s name ingame.

Tagbased strings

Tagbased strings are strings that are sort of a placeholder as they’ll be replaced by a preset text. I’ll make another tutorial for that later on.

itemClassification this is a picklist of strings which indicates the classification of the item resulting in the color of the item name getting changed to the one from this type of item. For example legendary means a purple name, epic will be blue etc.
dropSound this is the sound the item will cause when dropping from your inventory or an enemy or whatever else.
dropSound3D is the sound that will be played when the item is dropped somewhere where it would cause a sound related to the physics engine.
dropSoundWater is the sound the item will cause when it falls into water.
itemCost is the amount of iron this item will cost when you buy / sell it to the vendor.
itemCostScalePercent is a percentage based value that will influence the itemCost value ingame.
itemLevel is the item’s virtual level used to calculate things like level requirement and attribute requirement. In case of recipes this is not used.
cannotPickUpMultiple prevents the player from picking up multiple items of this type, this recipe in our case if set to true.
cannotPickUp disallows picking up this item when set to true.
itemHooks not exactly sure what this is about. Couldn’t test it yet, sorry.
soulbound determines whether this item is soulbound
untradeable determines whether this item is tradeable
maxStackSize determines how many times this item can be stacked. Only works for oneshot / scroll items. Does not work for recipes.
preventEasyDrops probably determines whether the player recives a warning when attempting to drop an item. Not tested though.

If you did all changes you wanted to do, select File -> save in the menu bar of the records editor to save your changes.

2.0 Blacksmith Integration

This part will deal with how to make a recipe become given by default, without having to find and learn it.

2.1 Setup

For this, we need the following database record file:

records\ui\inventor\craftingpanel\crafting_table.dbr

You should import it now, just as shown in 1.1 and open it.

Now we need to make the Asset Manager recognize the new item. To do this, hit f7 to build your mod or click Build -> Build.

2.2 Adding the recipe

After opening the record, go to “Artifact Tab”. It should look like this there:

Now double click the value of “craftingDefaultRecipes”. This window should open:

Click on “New” to add a new item to the list on the bottom. Than scroll down until you can see it and double click it:

Now click the […] button and navigate to your recipe, select it and press ok. If you did everything right, it should look like this (just with your recipe):

Now click “Apply” and afterwards “OK”. This should bring you back to the records editor.*

Now click File -> Save in the menu bar of the records editor to save your changes.

If you did all the above, hit f7 (or Build -> build) to build your mod. Congrats, you just created a new recipe and added it as default recipe to the blacksmith!

If you still got any questions, don’t hesitate to ask, I’ll try to answer as good as I can.

For these who are wondering what the script and learning means, see here. The post is a bit outdated and since the tools are released now, it is thought for actual modding not learning anymore but the idea is still the same.

Take it as a present. I’ll be away from later this evening for 7 days until next saturday. While I’m away, I’ll probably not be able to check the forums.

Edit: Note @Crate: 10 pics per post? Really? Is there any way we can get a highter amount please?

Thanks for the present, Elfe :slight_smile:

I love you you know? Don’t die yet pretty please <3

Thanks for the tutorial, and have a nice week!

Nice tutorial thank you, it helped me. I don’t know if it’s possible but could you make a tutorial about importing titan quest elements to Grim Dawn like a monster I know you are getting harassed by a lot of people for different tutorials so I will have to wait.

I wrote a tutorial on how to export the .tex file and then import it back in using command line tools. http://www.grimdawn.com/forums/showthread.php?t=37869 I haven’t been able to get the asset manager to import .psd or .max files yet, have you had any luck? I posted it as a bug.

For effects the correct ending is .pfx :wink: no idea about max files though.

Writing from buss now, will start soon.

I have a question. It is possible to customise game UI? Like add extra stash tab, add a new equipment slot.

I was thinking about looking at a script linked to an NPC known as the “Warehouse master” or something and would have 10 named stashes, which you pick between via dialog. The backend would involve swapping files on your hard drive, so there is a fair amount of programming involved and I don’t know if the LUA sandbox permits that in this case. (LUA is a C++ helper language, with limited hooks on what it can call, and can be further restricted.)

That’s more than a little of a derailing though - I’m giving bro love to Elfe here for figuring stuff out so fast.

Equipment slot would also require ALL of the game DBR files that are equipment aware to know about it, and that means every skill too, loot table, etc. Even if it is possible, I personally wouldn’t want to try.

OMG, it’s already painful to figure out how template works with records…

Really hope Lua can make life easier.

Interesting idea. It could indeed work from theory since we have io access with the lua system the game offers but I’m not sure whether it’s that easy to get the correct path for the stash to work since the base path is the path of the game’s install directory and the stash file is located in documents folder.

But could be worth a try.

Nope. These are entries bound to the engine, you can add new entries to the templates but the game will ignore them since it doesn’t know what to do with them so unless the devs add more tabs to the engine or somebody else does, no way throught the toolset.

Can we use PrefixName and suffixname for defining a reagent.
For exampel if I want to make a recipe using only double rare affixed MI ?

Don’t think so since you’d have to use item tables for that and there is no special type of item table that is restrained to two or one certain affix.

Not to speak of the different chances…

Thanks for the guide!

I’m not having any luck with this, trying to create craftable staves/spears but they aren’t showing up at the blacksmith. The last step in your tutorial, the purpose is to make it a default recipe right? Something you don’t have to find and the BS starts with it already, correct?

I’m not seeing it. I’m expecting the category to be the same as the “weapon type” but there’s nothing. PM me or IM me if you have any ideas, Elfe.

Uhm does the category “staff” / “spear” appear as a knot in the blacksmith at all?

Because if not, I guess this is hardcoded and needs a knot for these weapon types first.

We are looking into adding the categories to the blacksmith for mod purposes.

While you’re there, consider adding an unarmed weapon template in the future, so I can import fist-based fighting weapons (already have the models ready and waiting), as well as a way to tag the weapon class of spears/staves as such instead of having them share the tag of “Exotic Weapon”. (Like how weapons are labeled, 2 Handed Melee, and armor as Light Armor, etc)

I had another suggestion but it fluttered away. :frowning: