Events
Working with stat events.
Each Unit Stats Provider has its own events that you can use to make something happen when a stat is changed. Each event accepts an UpgradableStat parameter.
Property | Description |
---|---|
onStatChanged | Called whenever a stat's current value is changed. |
onStatReachedMin | Called whenever a stat's current value reaches its min value. |
onStatReachedMax | Called whenever a stat's current value reaches its max value. |
onStatLevelChanged | Called whenever a stat's level is changed. |
Usage Example
Let's say you have a stat called HP. If you want something to happen when the HP reaches 0, you can use the onStatReachedMin
event.
Script Example
In this example, we're calling a custom function called Death
that handles player death when the HP stat reaches 0.
Adding the Listener
Custom Function
Last updated