Modding:Basic Item: Difference between revisions

From Vintage Story Wiki
No edit summary
No edit summary
Line 1: Line 1:
__FORCETOC__
__FORCETOC__


This tutorial should introduce you into the basic of adding an item to the game using JSON files. If you want to add a block 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]].
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 already be known to you.


= A Simple Item =
= A Simple Item =
Line 14: Line 14:


Now we need to let the game know if its existence. We can accomplish that by creating a json file and placing it inside <code>assets/itemtypes/tool/wand.json</code>.
Now we need to let the game know if its existence. We can accomplish that by creating a json file and placing it inside <code>assets/itemtypes/tool/wand.json</code>.
The content of this json file should look as it follows:
<syntaxhighlight lang="json">
{
code: "wand",
creativeinventory: { "default": ["*"] },
texture: { base: "tool/wand/wand" }
}
</syntaxhighlight>
* '''code''': A unique identifier for your item. If you plan a larger mod, it is suggested to prefix your modname to the identifier.
* '''creativeinventory''': The creative inventory tabs the itemshould be shown in (currently only 1 tab available)
* '''textures''': What textures to apply.


== Testing ==
== Testing ==
Now we got everything ready to run our first test. You should be able to find the added item in the creative inventory.
[[File:2017-01-30 13-59-27.png|700px]]


== Naming the Item ==
== Naming the Item ==
To give the item a proper name, you currently have to manually add a line like this in the file <code>assets/lang/en.json</code>
<syntaxhighlight lang="json">
"item-wand": "Wand",
</syntaxhighlight>
A better way of handling naming and translation will be added once its desired.


== Distributing a mod ==
== Distributing a mod ==
The current modding system does not yet support mod-specific asset folders. The current way of doing it is to create a zip file a user can extract into his game folder that will extract the files into the right folders. Example:
[[File:MyWandMod.zip]]
A proper mod manager will be added to the game once there is a few serious mods out there (go bug tyron about it ;-) ).


= Advanced Properties =
= Advanced Properties =

Revision as of 13:05, 30 January 2017


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 already be known to you.

A Simple Item

So, the first thing we going to need is an idea. What does this game need. Wait i got it ... the game needs an overpowered wand.

The Texture

This is the texture we gonna use: Wand.png. In order to use it we need to place it inside the assets folder inside the Vintagestory folder. Therefore the path should look like this: assets/textures/items/tool/wand/wand.png.

The Json File

Now we need to let the game know if its existence. We can accomplish that by creating a json file and placing it inside assets/itemtypes/tool/wand.json.

The content of this json file should look as it follows:

{
	code: "wand",
	creativeinventory: { "default": ["*"] },
	texture: { base: "tool/wand/wand" }
}
  • code: A unique identifier for your item. If you plan a larger mod, it is suggested to prefix your modname to the identifier.
  • creativeinventory: The creative inventory tabs the itemshould be shown in (currently only 1 tab available)
  • textures: What textures to apply.

Testing

Now we got everything ready to run our first test. You should be able to find the added item in the creative inventory.

2017-01-30 13-59-27.png

Naming the Item

To give the item a proper name, you currently have to manually add a line like this in the file assets/lang/en.json

	"item-wand": "Wand",

A better way of handling naming and translation will be added once its desired.

Distributing a mod

The current modding system does not yet support mod-specific asset folders. The current way of doing it is to create a zip file a user can extract into his game folder that will extract the files into the right folders. Example:

File:MyWandMod.zip

A proper mod manager will be added to the game once there is a few serious mods out there (go bug tyron about it ;-) ).

Advanced Properties

Mining Properties

Variants

Texture Overlays