Stat Value

Scripting with the StatValue struct.

The StatValue struct represents a value of a Stat and is designed to provide a flexible alternative to numeric types.

Fields & Properties

Name
Description
Type
Access

identity

The identity of the stat.

StatIdentity

public

value

The value.

NumericValue.Value

public

Creating a Stat Value

A StatValue requires a StatIdentity and a numeric value.

StatValue myStatValue = new StatValue(myStatIdentity, 100);

Operators

You can use arithmetic and comparison operators for mathematical and comparison purposes.

Arithmetic Example

You can use arithmetic operators for a StatValue for mathematical purposes with another StatValue, int, or float value.

StatValue statValueC = statValueA + statValueB;

Comparison Example

You can use comparison operators for to compare a StatValue with another StatValue, int, or float value.

if (statValueA >= statValueB)
{
    // Do something...
}

Last updated