Modding:Basic Item: Difference between revisions

From Vintage Story Wiki
m
minor formatting
No edit summary
m (minor formatting)
Line 1: Line 1:
__FORCETOC__
__FORCETOC__
Please read the tutorial [[Getting Started with Advanced Modding#Domains|Getting Started]] first, if you haven't done it already. This tutorial should introduce you into the basic of adding an item to the game using JSON files. If you want to add a item with functionality you should check out the tutorial for [[Advanced Items]]. There is a full list of all properties which can be defined inside the json file [[Item Json Properties]]. Adding a block to the game is rather similar, so if you have done that already most of the following steps should be familiar to you.
Please read the tutorial [[Getting Started with Advanced Modding#Domains|Getting Started]] first, if you haven't done it already. This tutorial should introduce you into the basic of adding an item to the game using JSON files. If you want to add a item with functionality you should check out the tutorial for [[Advanced Items]]. There is a full list of all properties which can be defined inside the json file [[Item Json Properties]]. Adding a block to the game is rather similar, so if you have done that already most of the following steps should be familiar to you.


Line 12: Line 13:
== The Texture ==
== The Texture ==


This is the texture we gonna use [[File:Wand.png]].
This is the texture we gonna use: [[File:Wand.png]]


In order to use the texture we need to put it at the right place. Therefore create the following folders in your workspace <code>assets/mywandmod/textures/item/</code>. Now rename the texture to <code>wand.png</code> and place it in there.
In order to use the texture we need to put it at the right place. Therefore create the following folders in your workspace <code>assets/mywandmod/textures/item/</code>. Now rename the texture to <code>wand.png</code> and place it in there.
Line 43: Line 44:
</syntaxhighlight>
</syntaxhighlight>


== Testing/ Distribution ==
== Testing and Packaging ==


There is only one thing left. We need to create a zip file of the assets folder inside your workspace. Either you use an external program (such as WinRAR or 7Zip) or you right-click the <code>assets</code> folder and hit '''Send To''' -> '''Compressed (zipped) folder'''. Eventually you can rename the zip file to <code>MyWandMod.zip</code>. The zip file can be either used for testing purposes or you can send it to other people so they can use it as well.
There is only one thing left. We need to create a zip file of the assets folder inside your workspace. Either you use an external program, such as WinRAR or 7Zip, or you right-click the <code>assets</code> folder and compress it. Eventually you can rename the zip file to <code>MyWandMod.zip</code>. The zip file can be either used for testing purposes or you can send it to other people so they can use it as well.


Furthermore you need to add a <code>modinfo.json</code> file, check out [[Game_Content_Mod|this tutorial]].
Furthermore you need to add a <code>modinfo.json</code> file, check out [[Game Content Mod|this tutorial]].


[https://wiki.vintagestory.at/images/e/ec/MyWandMod.zip MyWandMod.zip]
[https://wiki.vintagestory.at/images/e/ec/MyWandMod.zip MyWandMod.zip]
Line 64: Line 65:
== Mining Properties ==
== Mining Properties ==


Our wand is still rather useless, so it might be a good idea to add our wand some mining functionality. How it works? We the property "miningspeedbytype" we can define the mining speed for each material. Here is a list of all [[Block Materials|block materials]].
Our wand is still rather useless, so it might be a good idea to add our wand some mining functionality. How it works? We the property "miningspeedByType" we can define the mining speed for each material. Here is a list of all [[Block Materials|block materials]].


The number indicates how fast the tool is able to mine the block, while <code>1</code> is the default value. <code>time to mine = block resistance / miningspeed</code>. Meaning a speed of <code>2</code> is twice as fast the default speed of one. So our tool is seven times faster than using the hand.
The number indicates how fast the tool is able to mine the block, while <code>1</code> is the default value. <code>time to mine = block resistance / miningspeed</code>. Meaning a speed of <code>2</code> is twice as fast the default speed of one. So our tool is seven times faster than using the hand.
Line 70: Line 71:
A pickaxe looks like this:
A pickaxe looks like this:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
miningspeedbytype: {
miningspeedByType: {
"*": {
"*": {
"stone": 7,
"stone": 7,
Line 89: Line 90:


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
durabilitybytype: {
durabilityByType: {
"*": 2000,
"*": 2000,
},
},
Line 105: Line 106:
</syntaxhighlight>
</syntaxhighlight>


Now we need to change our <code>miningspeedbytype</code> property to set the speed of each material for each type:
Now we need to change our <code>miningspeedByType</code> property to set the speed of each material for each type:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
miningspeedbytype: {
miningspeedByType: {
"*-shovel": {
"*-shovel": {
"soil": 7,
"soil": 7,
Line 133: Line 134:
We can also change the durability for each type individually.
We can also change the durability for each type individually.
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
durabilitybytype: {
durabilityByType: {
"*-shovel": 4000,
"*-shovel": 4000,
"*-pickaxe": 3000,
"*-pickaxe": 3000,
Line 145: Line 146:


<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
texturebytype: {
textureByType: {
"*-shovel": {
"*-shovel": {
base: "item/wand-shovel",
base: "item/wand-shovel",
Confirmedusers, Bureaucrats, editor, Administrators
1,522

edits