ItemObject.cs
v4.0
ItemObject is a Scriptable Object which holds references to all the data set up with the Items Module. It implements IAffectStats and IFitInInventory
public string ObjectName
public string ObjectTypeSetup
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.


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.
"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 Source Stat 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 Source Stat.
Points
The Base and Proficiency values will be multiplied by the "Points" associated with the Source Stat.
Proficiency
The values provided will be multiplied by the Final Proficiency of the Source Stat.
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":

X * Value
This Computation option will obtain the Lookup Table output value for the Source Stat 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 Box Items 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.

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.
Last updated
Was this helpful?

