This page describes how to create various item archetypes. For example: ingredients, tools and weapons, etc.
Item are the simplest form of content you can add to the game. These range from things like wood to sword and armor.
To create an item, first create a new Prefab (Right click in the project tab, Create
-> Prefab
).
Open the prefab and add following components: ObjectAuthoring
, InventoryItemAuthoring
.
This component defines what this object is.
First field you must fill out is Object Name
. Following the naming pattern: ModName:ItemName
. Learn more about Object Names here.
Next field you must set is the Object Type. This field defines the kind of item this is. For this example set it to Non Usable
.
You may fill other fields on your own discretion.
This component defines information about the item for display in the inventory.
You must fill out fields Icon
and Small Icon
. These are the icons the player will see ingame. Both need to be 16x16
px.
Here you can also define item's crafting recipe, sell and buy values, and whether it can be stacked. Crafting recipes will be covered in another guide.
To set item's localized name create folder named Localization in your mod root folder. Now create a file in there called Localization.csv. This file will define all of your mod localization strings. Here you can add both English texts and other languages.
The file is encoded as Tab Separated Values (TSV). Initialize the file with the following content (Choose one of these two):
From the next line starts the actual content which needs to be tab separated. I would recommend to get a good CSV editor. One good option is Rons Data Edit, which can be used for free.
Add following content:
Key: Items/ExampleMod:ExampleItem
, English: Example Item
Key: Items/ExampleMod:ExampleItemDesc
, English: My first item.
Fill other fields on your own discretion. Please note that ExampleMod:ExampleItem
here is your Object Name as set in ObjectAuthoring.
Once you have created your new item you will need to get it to test the mod.
Unfortunately, at the moment, the only way to get an item if it wasn't explicitly added to a workbench, drop table or other source is by using cheats like Chat Commands.
With Chat Commands you can acquire any item like so: /give ExampleMod:ExampleItem [optional amount]
Follow the steps in the generic item guide first to define the other required properties of your item.
This guide has not been written yet! If you know how to do this, add it!
Follow the steps in the generic item guide first to define the other required properties of your item.
To make a equipable item with use animation you need to:
Set the ObjectType
to tool or weapon type
Add DurabilityAuthoring
, GivesConditionsWhenEquipedAuthoring
, CooldownAuthoring
, WeaponDamageAuthoring
and LevelAuthoring
component authorings and configure them correctly
Assign both icons to first sprite in item animation sheet.
Sprite sheets should be 120x120px and have 7 sprites showing item in different states. You can find such sheets for all base game weapons and tools by ripping game content via Asset Ripper.
The CoreLib.Entity submodule is required for this guide section.
To make a ranged weapon you mostly need to do the same as with any other weapon. Except for the fact that you will need a custom projectile entity added. To hook modded projectile entity use ModRangeWeaponAuthoring
component instead of RangeWeaponAuthoring
(CoreLib feature)
Follow the steps in the generic item guide first to define the other required properties of your item.
The CoreLib.Equipment submodule is required for this guide section.
To make armor you need to:
Set the ObjectType
to armor type
Add DurabilityAuthoring
, ModEquipmentSkinAuthoring
, GivesConditionsWhenEquipedAuthoring
and LevelAuthoring
component authorings and configure them correctly
Make a armor spite sheet. Examples of such sheets can be found in the Unity Editor. Now assign your texture to ModEquipmentSkinAuthoring
(CoreLib feature). The component will automatically set everything up.