Confirmedusers
575
edits
m (Minor formatting) |
(2nd recipe and conclusion finished - Still in progress.) |
||
Line 48: | Line 48: | ||
* ''alloy'' - Allows creation of different alloyed metals in a crucible. | * ''alloy'' - Allows creation of different alloyed metals in a crucible. | ||
* ''barrel'' - Allows creation of objects within a barrel. | * ''barrel'' - Allows creation of objects within a barrel. | ||
* ''clayforming'' - Allows creation of objects | * ''clayforming'' - Allows creation of clay objects using the clayforming system. | ||
* ''cooking'' - Allows creation of food | * ''cooking'' - Allows creation of food in a cooking pot. | ||
* ''grid -'' Allows creation of objects by using the crafting grid. | * ''grid -'' Allows creation of objects by using the crafting grid. | ||
* ''knapping'' - Allows creation of stone objects using the knapping system. | * ''knapping'' - Allows creation of stone objects using the knapping system. | ||
Line 68: | Line 68: | ||
To create a new grid recipe, the game needs the following information: | To create a new grid recipe, the game needs the following information: | ||
* '''Ingredients''' - This defines what objects are used in the grid to create the output. | |||
* '''Pattern''' - This defines how the ingredients are arranged in the grid, as well as the width and height of the recipe. | |||
* '''Output''' - This defines what object will be given to the player when the recipe is complete. | |||
You will notice that this information can be listed in any order in the json file. | You will notice that this information can be listed in any order in the json file. | ||
Line 145: | Line 145: | ||
|} | |} | ||
== | == Creating the Block Recipe == | ||
[[File:SimpleRecipeTutorialSimpleGoldBlock.png|frameless]] | This is the recipe you will be creating for this section: | ||
[[File:SimpleRecipeTutorialSimpleGoldBlock.png|frameless]] | |||
The recipe should be able to use ''any'' hammer, on top of 6 gold ingots to make the gold brick block. | |||
=== Recipe File === | |||
Open the '<nowiki/>''simpleblockrecipe.json'<nowiki/>'' file inside '''recipes/grid''<nowiki/>'. | |||
Same as before, this grid recipe needs to define its ''ingredients, pattern,'' and ''output.'' | |||
=== Recipe Pattern === | |||
Firstly, define the recipe pattern inside your json file.<syntaxhighlight lang="json"> | |||
{ | |||
"ingredientPattern": "_H_,GGG,GGG", | |||
"width": 3, | |||
"height": 3, | |||
</syntaxhighlight>The properties here are the same as the previous recipe, however you are now using the grid to its maximum capacity. | |||
==== Understanding the IngredientPattern Property ==== | |||
The '<nowiki/>''ingredientPattern''' property is a lot easier to explain in this recipe. Each letter in the pattern determines a unique ingredient, however there are a couple of unique characters too. Each section, determined by commas, represent a row in the crafting grid. In the pattern above, the rows are: "_H_", "GGG", "GGG". Each character then represents its own space in the crafting grid. An underscore ( '''_''' ) tells the game that this is a blank space and unused in this recipe. | |||
Look back on the previous recipe, and make sure you understand the ingredient pattern there. It is a 1 by 3 recipe, where each row is seperated by a comma. | |||
=== Recipe Ingredients === | |||
This recipe uses two ingredients - A hammer and a gold block. | |||
Add the following code to your file, below the height property.<syntaxhighlight lang="json"> | |||
"ingredients": { | |||
"H": { | |||
"type": "item", | |||
"code": "game:hammer-*", | |||
"isTool": true | |||
}, | |||
"G": { | |||
"type": "item", | |||
"code": "game:ingot-gold" | |||
} | |||
}, | |||
</syntaxhighlight>The ingredients here follow the exact same format as the previous recipe, however there is a new concept to introduce. | |||
==== Asset Location Wildcards ==== | |||
So far in the tutorials, you will have used a lot of asset locations without much explanation about how they work. This is a very substantial topic, and will be explained more in a future tutorial. For now, however, it is important to understand the use of ''wildcards'' within a code property. | |||
In Vintage Story, there can exist ''variants'' of each item, block, or entity. These variants are used to create a large amount of new objects that all share very similar properties, all within a single file. One such example of an item with variants is the ''hammer'' item. There exists a total of 9 hammers with near-identical functionality, however each one uses a different '<nowiki/>''metal''' variant to determine its material. Every object in the game has to have a unique code, so variants are appended to the end of the item code. This means that the full codes for all 9 hammers are: | |||
* ''hammer-copper'' | |||
* ''hammer-tinbronze'' | |||
* ''hammer-bismuthbronze'' | |||
* ''hammer-blackbronze'' | |||
* ''hammer-gold'' | |||
* ''hammer-silver'' | |||
* ''hammer-iron'' | |||
* ''hammer-meteoriciron'' | |||
* ''hammer-steel'' | |||
When it comes to creating recipes, you do not want to have to create 9 seperate recipes where each one accepts a different hammer, so you can use a ''wildcard.'' A wildcard allows a modder to group all these objects together using an asterisk ( '''*''' ) in its code property. By using '<nowiki/>''hammer-*'<nowiki/>'', the game allows any object who's code begins with '<nowiki/>''hammer-''<nowiki/>' to be valid for this recipe. Note that you should still include the hyphen in the code, as using '<nowiki/>''hammer*''' will result in being able to use any hammer and also any hammer''head'' items. | |||
You will learn how to create your own object variants in future intermediate tutorials. | |||
==== IsTool Property ==== | |||
There are a number of extra properties that can be included within recipes to make them slightly more complex. One such property is the '<nowiki/>''isTool''' property. Without this property, the hammer will disappear when the block is created. By marking the hammer as a tool, the recipe simple uses a single durability point, but the hammer remains. | |||
=== Recipe Output === | |||
The final section of our recipe is the output. Add the final section of code to your file, below the '<nowiki/>''ingredients''' section.<syntaxhighlight lang="json"> | |||
"output": { | |||
"type": "block", | |||
"code": "simplegoldblock" | |||
} | |||
} | |||
</syntaxhighlight>As before, we just set this to our block's code. Note that the type has been changed to block in this instance. | |||
=== Finalized Recipe === | |||
Your second recipe should now be complete! You should be able to test it by going on the "simplegoldblock" page in the in-game handbook, or trying to create your item in survival mode. | |||
Here is the full recipe for comparison: | |||
{| class="wikitable mw-collapsible mw-collapsed" | |||
|simpleblockrecipe.json | |||
|- | |||
|<syntaxhighlight lang="json"> | |||
{ | |||
"ingredientPattern": "_H_,GGG,GGG", | |||
"width": 3, | |||
"height": 3, | |||
"ingredients": { | |||
"H": { | |||
"type": "item", | |||
"code": "game:hammer-*", | |||
"isTool": true | |||
}, | |||
"G": { | |||
"type": "item", | |||
"code": "game:ingot-gold" | |||
} | |||
}, | |||
"output": { | |||
"type": "block", | |||
"code": "simplegoldblock" | |||
} | |||
} | |||
</syntaxhighlight> | |||
|} | |||
== Conclusion == | |||
Congratulations, you have now created two recipes for your new item and block! This tutorial should have given you the ability to make simple recipes, as well as a brief understand of variants and wildcards. | |||
=== Next Steps... === | === Next Steps... === | ||
If you want to test your knowledge, consider doing the tasks under the ''Going Further'' section below. | If you want to test your knowledge, consider doing the tasks under the ''Going Further'' section below. | ||
This is the final tutorial in the 'Basic Tutorial' section. Take a look at starting the intermediate content mod tutorials, where you will learn more about variants and error-checking, as well as developing complex blocks, items, entities, and many more. | |||
== Going Further == | == Going Further == |