ItemObject is a Scriptable Object which holds references to all the data set up with the Items Module. It implements IAffectStats and IFitInInventory
ItemObject.cs
public string ObjectName
public string ObjectType
Setup
The objectType of an Item Object is the name of the folder the Scriptable Object is in. Create one named as you'd like, and right-click inside to select the menu option:
/Create/Game Modules/Items/Item Object
This will create an ItemObject Scriptable Object in your project. Select that and view the Inspector to begin setting up your data. The name of the Scriptable Object is saved as the objectName value.
Note that names of Item Objects must be unique. The console will provide a warning if there are multiple Item Objects with the same name.
Use ItemAttributes to differentiate between things like "Wooden Sword", "Sword", and "Master Sword". In this context, both "Wooden" and "Master" would be ItemAttributes.
Inspector
Select your new object and view it in the Inspector. Here is where you can manage all the details about this Item Object. Note there are multiple tabs, each of which provide access to specific, and optional, information.
The Quest Itembool is used to identify this ItemObject as something special, which may need special rules. For example, the drag-and-drop Inventory System will not let a player "drop" a quest item, as that may result in the quest item being lost. Your own systems may choose to make use of this value.
Once you have Stats set up, you can set how this Item Object will affect them here. The math is all handled automatically once you have your data set up at runtime, so that any Item Objects you choose can affect the Stats of a player or other object which has Stats.
Stats have two key concepts: Value and Proficiency. Value are numbers, while Proficiency is a percent. In the example above, the "Sword" weapon will increase the "Attack" Stat of the owner by 2, and incrase the "Damage" Stat of the owner by 3.
Check out the Stat documenation for more details and the math behind it all.
"Targets" are the Stats that will be affected by this Item Object. Add new Target using the search & drop down at the top.
The "Base" values are modified directly simply by this Item Object being included in the calculations. The amounts you insert are not modified by any other Stat.
"Sources" are the Stats that will be used to compute the affect values on the various Targets. Add a new Source using the drop down on the right.
Our "Master Sword" ItemObject is a Quest Item, and has an impact on Might as well as Attack and Damage. The "Base" value for Might has a proficiency boost of 0.1. This means that the owner of this weapon, when equipped would get a 10% point boost in the proficiency of their might stat.
There is also an addtional source, Personality. This is set to add 0.01 to the proficiency of might for every "Final Stat" in the owners Personality. This means that if the owner has a "Personality" of 20, there will be an additional 20% point boost in the proficiency of their might stat.
Computation types
Other values are modified by the SourceStat selected. There are multiple ways to compute the modification, which you can select via the drop down. Toggle the row off if you do not want this particular Source to affect the Target.
Raw
This is similar to the "Base" option, but will only be included if the Owner of of the Stats being targetted also has the SourceStat.
Points
The Base and Proficiency values will be multiplied by the "Points" associated with the SourceStat.
Proficiency
The values provided will be multiplied by the Final Proficiency of the SourceStat.
Final Stat
Selecting this will multiple the values by the Final Stat of the Source.
X * Value of
Selecting this will present additional drop downs for another Stat, along with a Lookup Table. In the example below, you may read it as "0.01 * Final Value of Level * Value of Wisdom in Stats Bonus".
Lookup Tables provide specific output numbers based on the input. If the object with the Stats has an output value of "6" for the Stat "Wisdom", and a Final Value of "Level" of 10, the math would equate to a 60% increase in the Proficiency value of the Stat "Critical Strike":
0.01∗10∗6=0.6
X * Value
This Computation option will obtain the Lookup Tableoutput value for the SourceStat selected, and multiply the values entered by that.
Using Stats to modify other Stat values is a great way to add complexity to your game, and give your players many ways to improve their characters. This system will make it much easier to connect all of the various Stats you have with the things that affect them.
If you have Loot BoxItems set up, via the Loot module, you can see which Loot Box Item objects this Item Object is included in. You are able to remove it from existing ones, or add it to new ones via the drop down menu.
If you are choosing to use the drag-and-drop Inventory system, you can set the basic values for the dimensions of your object (Height and Width) on the grid, plus set the Inventory Prefab and World Prefab.
Here you can manage the values on the various Dictionaries key/value pairs set up. Each one is a List and you can add and re-order the entires as you'd like. Each KeyValue can hold many different types, including Game Module types.
To add keys to individual ItemObjects, you will need click the "Manage Item Objects" button at the top of the Inspector. Dictionaries keys are the same for all Item Objects of the same objectType. On the "Manage Item Objects" panel you can set up Keys, and optionally choose to display strings in those keys as a textbox.