Skip to main content

BaseStat

A base stat is used to define stats that are not calculated. These stats simply exist for the purpose of holding a value. Some examples of base stats are (usually) character names, ability scores, item arrays, etc.

Base stats are very commonly used in computed stat formulas to calculate the value of said stat (see the ComputedStat example).

As with computed stats, base stats can be overridden by the user or by a mechanic.

A base stat with a modifier override (such as with the addToStat effect) will still use the value of the base stat, and then add the appropriate modifier to it. If a value override (such as the one created as a result of the setStat effect) is used instead, that overridden value will take precedence.

When getting the value of a base stat, the RPG Companion App stat engine will essentially return the override value if it exists, and the actual stat value if not, and then add the overridden modifiers. In pseudocode, that would look something like get(stat) = (override_value(stat) ?? value(stat)) + (override_modifier(stat) ?? 0).

JSON Format

{
"type": "BaseStat",
"id": ...,
"name": ...,
"plural": ...,
"abbreviation": ...,
"type": ...,
"value_type": ...,
"sub_value_type": ...,
"default_value": ...
}

Fields

FieldTypeRequiredDescription
idStringThe id for this type instance. This should be unique.
nameStringThe name for this type instance.
pluralStringOptional. The plural form of the name for this type instance (e.g: "Items" if the name is "Item").
abbreviationStringOptional. Abbreviation of the name for this type instance (e.g: "STR" for Strength).
typeStatTypeThe type of the stat (base or calculated)
value_typeValueTypeThe value type for this stat
sub_value_typeValueTypeOptional field. Set only for array valueTypes. Represents type of the array (e.g: for an array of strings, we should set value_type as array and sub_value_type as string)
default_valuedynamicThe default value for the stat. Has to conform to the given value_type. Using null is highly discouraged