Scaling Source

Scripting with the ScalingSource struct.

The ScalingSource struct is used by a Scaling Value 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.

NumericValue

public

increment

The scaling amount used for linear scaling.

NumericValue

public

min

The min value used for curved scaling.

NumericValue

public

max

The max value used for curved scaling.

NumericValue

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
ScalingSource myScalingSource = new ScalingSource()
{
    scalingType = ScalingType.Linear, // Linear scaling
    initialValue = 10, // Set the initial stat value to 10 
    increment = 10, // Scale by 10 per level
};

Set Numeric Type

The SetNumericType method can be used to set the numeric type of the values.

myScalingSource.SetNumericType(NumericValue.NumericType.Integer);

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 = myScalingSource.GetScaledValue(1, 100);

Last updated