Statis a Scriptable Object which holds references to all the data set up with the Stats Module. It implements
public string ObjectName
public string ObjectType
Create a Stat by right-clicking to select the menu option.
This will create a
StatScriptable 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
Note that names of Stat objects must be unique. The console will provide a warning if there are multiple with the same name.
Remember that the "object type" of any Game Module object is the name of the folder the object is in.
Stathas a few key concepts which are important to understand. The Final Value of a stat is made up of Points, Base Value, and Proficiency. Base Value and Proficiency can be affected by other
Statobjects, or even
ItemAttributeobjects. The math looks like this:
A Proficiency of 0 means there will be no modification to the Final Base Value.
Statcan also be optionally set to
CanBeModified. These change how the system deals with the
Stat, and how other objects can interact with it.
CanBeTrainedrefers to a
Statwhich can be improved upon during the game. You can set up
MasteryLevels, any number of which can apply to a
Stator group of
Statobjects. An example could be Novice, Expert, and Master levels. Each level may have different values, and may have different effects on other
You may have a
Statcalled "Learning", which affects the Proficiency of the
Stat"Experience Mod" (which itself changes how points are allocated to the
You may set Learning to
CanBeTrained, and change the affect it has on ExperienceMod for each Mastery Level. This way, as your player advances, the affect grows automatically.
Statas modifyable by other
ItemAttributeobjects. Turning this on will allow you to select it when setting up the connections between objects. Objects which are not marked
CanBeModifiedcan still impact other
Statobjects, but can not be impacted themselves.
Stats can be "Trainable", "Modifiable", or "Counter". There are
boolproperties in the
GameStatfor each of these.
Counter stats are those which are neither trainable or modifiable. Generally this means they're being used to count a value, such as "Money" or "Experience".
Stats which are Trainable or Modifiable may be both Trainable and Modifiable.
Select your new object and view it in the Inspector. Here is where you can manage all the details about this Stat. Note there are multiple tabs, each of which provide access to specific, and optional, information.
Stats / Mastery Levels
Stats are extremely flexible data containers, and can automatically post to the MainBlackboard as well
This is where you can set the main values for this
Stat, including toggling on/off
CanBeModified. Note that when
CanBeTrainedis true, the middle tab will be called "Mastery Levels", otherwise it will be called "Stats".
The Points, Base Value, and Base Proficiency values can be set as well.
Points are meant to be user-defined -- points that can go up or down throughout the game, such as assigned "Skill points", or "Experience points", or "Hit Points" etc. Other objects can not modify the Points value directly, the way they can Base Value and Base Proficiency.
The optional "Modified by this proficiency" will allow you to select another
Statobject which will modifiy any changes to the Points value. In the screenshot, you can see that the selected
Statis "Experience" and it will be modified by "Experience Modifier", also a
You are also able to toggle a minimum and maximum value, so that after computing the result, the value will be clamped by these options.
Finally, you can choose whether to round the final value, and how to do so.
Trainable Stats can also benefit from "Mastery Levels", the number of which and names of each you specify for your project, allowing an Actor to advance in their mastery of a Stat being used as a Skill.
CanBeTrained, then you can select one of the
MasteryLevelobjects you've created from the drop down at the top.
Statswhich are not marked
CanBeTrainedwill show options to modify other
Statobjects, but there will be no additional tabs for various
The Copy/Paste options may be helpful when populating values for multiple
MasteryLevels, so that you only have to enter the structure once.
Search for or select a
Statfrom the drop down which will be modified by this object. In this example, our
Stat"Learning" will modify the
Base Value/Proficiency values set here will be constant affects. In this example, an object which has
Statswill get a 0.09 increase to the Experience Modifier proficiency if they also have the
Per Skill Point Value/Proficiency will be multiplied by the "point" value of the selected
Stat, Learning. This means that at a "point" value of 1, the proficiency of Experience Modifier will be increased by 0.1, and if the "point" value was 5, the profiency would be increased by 0.14.
You can also add other
Statobjects as additional Sources for modifying the Target
Stats. More details on this can be found in the documentation on Items.
ItemAttributeand other Game Module objects can also affect
Statobjects, and use the same options. Each one has a single
MasteryLevel, just like a
Statobject which has
The Links to other Stats section at the bottom will show you which other
Statobjects are affected by or affects this one, directly or indirectly. While the Scriptable Objects are shown as object fields, you can not change those values -- but you can easily click them to select the other
Create Dictionaries entries, and add lists of any type you'd like to quickly access custom information in your project.
To expose values for modification, you will need to set up the Dictionaries key/value pairs by clicking the "Manage Stats" button at the top of the Inspector. Dictionaries keys are the same for all Stat objects of the same
Selecting this button will open an Editor window with additional options which affect all Stat objects of the same objectType.
Here you can view and modify some of the common settings for each of the
Statobjects of the same
objectType, which you can select using the drop down near the top.
This panel will let you change the selected
MasteryLevelswhich applies to all of the
Statobjects of the selected
Changing this value may force data to be lost, if the number of levels on the new
MasteryLevelsobject is less than the current one!!!
This is where you add Dictionaries items to your Stat objects, and set the name each item. You can populate values while viewing individual Stat objects.
Here you can set up the keys available for all Stat objects of a specific objectType. Values and types can be set individually on each Stat.
The Stat can be set to automatically post its values to the
MainBlackboard, and optionally notify followers as well.
The column "BlackboardNote Subject" lists out what the "Subject" will be when the
BlackboardNoteis posted. The "Topic" will be the
GameId()of the object which owns this
Keep in mind that ALL objects which have this stat will post the values toggled on here to the
MainBlackboard. This may not always be ideal, such as if you have many many NPC Actors which have Stats, like enemies, as you may not want all of those posting notes to the Blackboard.
GameStatList, which holds your
Stats, has two bools, false by default:
If these are true, the stats inside the list will post to the blackboard, and notify, even if the toggles are false in the Inspector. This is useful when you want some Actors to post their stats, but not all.