Skip to content

Stat Modifiers

We've seen so far that objects with a Traits component can change their Stat and Attribute values at runtime using Formulas and Tables. However, characters in games can also increment/decrement their stats when equipping weapons and other kinds of wearables.

This is where Stat Modifiers come into play: They increase or decrease a Stat value by a certain amount, and can be added and removed at any time.

Adding Stat Modifiers

To add a Stat Modifier to a Traits component, use the visual scripting Instruction Add Stat Modifier. This instruction allows to specify a target object, which must have a Traits component, a Stat to affect and a value.

This value can either be a percentage or a constant and can be displayed separately in the UI.

Stat Modifiers in UI

Percentage and Constants

You may have raised an eyebrow when Stat Modifiers can use constant and percentage values, as the result is different when applying a product after an addition or vice versa. The Stats module always applies percentage based modifiers first, and then adds any constant modifiers.

Add a Stat Modifier

Removing Stat Modifiers

Removing a Stat Modifier is as easy as adding one. All that needs to be done is to use the visual scripting instruction Remove Stat Modifier and input the same values as a previously added one.

Remove a Stat Modifier