Stat Scaling Source

Scripting with the StatScalingSource struct.

The StatScalingSource struct is used by a Stat as the source to scale itself. It essentially works as the scaling settings.

Fields & Properties

Name
Description
Type
Access

scalingType

How scaling is applied.

ScalingSource.ScalingType

public

initialValue

The starting value.

StatValue

public

increment

The scaling amount used for linear scaling.

StatValue

public

min

The min value used for curved scaling.

StatValue

public

max

The max value used for curved scaling.

StatValue

public

curve

The scaling curve used when the scalingType is set to Curve. This curve is used to interpolate from the min value to the max value based on the level.

AnimationCurve

public

ScalingType

Name
Description

None

No scaling is applied. Only the initial value is used.

Linear

Scaling is applied linearly.

Curve

Scaling is based on a curve.

Create a Scaling Source

// Linear scaling source
StatScalingSource myStatScalingSource = new StatScalingSource()
{
    scalingType = ScalingSource.ScalingType.Linear, // Linear scaling
    initialValue = new StatValue(myIdentity, 10), // Set the initial stat value to 10 
    increment = new StatValue(myIdentity, 10), // Scale by 10 per level
};

Set Identity

The SetIdentity method can be used to set the Stat Identity of the stat values.

myStatScalingSource.SetIdentity(myIdentity);

Get Scaled Value

You can get the scaled value at a certain level with the GetScaledValue method. This requires 2 integers: the current level and the max level.

// Current level: 1, Max level: 100
var scaledValue = myStatScalingSource.GetScaledValue(1, 100);

Last updated