Items.xml is markup file that contains all data about all items in game. But on mod side items.xml is just addition file for main items.xml inside of game files, this means if the mod folder has items.xml when the mod is loaded the main game's items.xml WILL NOT BE REPLACED with item.xml from mod, but all content from items.xml will be exported to main file and all original content and all content from all loaded mods will work together.
Open your mod folder and create file "items.xml" open it with your text editor. If you used XML before not hurry to add XML version line.
<?xml version="1.0" encoding="UTF-8"?>
This not need! Because all xml files on mods side is not standalone xml files, they only contains addition content for main xml files in game files. You NOT NEED TO ADD IT, else game won't can read your xml file.
To create your item use this template:
<item id='MyNewItem'> <name>MyNewItem</name> </item>
Here important moment, I advise you to read them very attentively. Without this, nothing will works.
- "id" of item ("MyNewItem" in this example) and "name" element should be same!
Let's do such situation, you need to add two items, how to be? Everything easy, just add one more below next to past item. Example:
<item id='MyNewItem'> <name>MyNewItem</name> </item> <item id='MyNewItem2'> <name>MyNewItem2</name> </item>
Remember two items can't have same name and id! If item with "MyNewItem" already exist you can't add such item again, you have to choose another name and id for it.
Let's taka a look xml code on one simple item to understand how this should looks.
<item id='Long sword'> <type>weapon</type> <png>long_sword_eq</png> <inv_png>long_sword</inv_png> <dmg_min>20</dmg_min> <dmg_max>35</dmg_max> <slot>Hands</slot> <name>Long sword</name> <desc>Long powerfull sword.</desc> <price>1337</price> </item>
This example of one melee weapon. Every item no matter what the type, should have elements.
- name - Contains name of item and in same time ID of it.
- desc - Contains description for item that player will see when click on it in inventory.
- price - Contains amount of gold that you have to pay to buy this item in shop, this number will be also base for calculate of amount of gold that you will got when sell it.
- inv_png - Contains name of png image that will use for icon that locate in "Spriters" folder of mod in inventory for this item.
This main elements that have every item. Other elements are optional and depend of item type. All elements for all types you will can read below.
To you was can use any images for your items you have to create "Sprites" folder in your mod folder and put all images to there.
When quick and small course complete you can start making own items, but you will ask where you can get all elements, we have not whole list of elements with description, but you can get original items.xml right in game, there whole code for all items of game, just take a look on items code and you will see how use element in your own items. Just go to mods menu and press copy items.xml