Stat Actions
Stat actions make it easier to work with common game stats like health, stamina, fuel, XP, score, heat, and more.
Instead of chaining together multiple math and condition actions (e.g., Float Subtract → Check Float Value → Send Event), Stat actions combine these patterns into one simple, readable step.
Currently the Stat category includes:
- Stat Decrease – for draining stats like health, stamina, fuel, etc.
- Stat Increase – for growing stats like XP, score, heat, etc.
Why use Stat actions?
In many games you repeatedly do things like:
- Decrease Health, and trigger a Death state when it hits zero
- Decrease Fuel, and trigger a Out Of Fuel state when it’s empty
- Increase XP, and trigger a Level Up when a threshold is reached
- Increase Score, and trigger Extra Life or bonus events
You can build all of these with multiple actions and extra states, but it can become:
- Harder to read – the intent is buried in math and comparisons
- Easy to get wrong – missing clamps, off-by-one checks, repeated events
- Verbose – simple stat logic takes 3–4 actions instead of 1
Stat actions solve this by giving you high-level, game-friendly building blocks:
- Stat Decrease → “Drain this stat, clamp to zero, tell me when it runs out.”
- Stat Increase → “Increase this stat, tell me when it reaches a threshold.”
They are designed to:
- Cover the 90% of common stat use cases
- Stay simple and readable
- Still play nicely with other actions when you need something more advanced
Tips for Using Stat Actions
- Use Stat Decrease whenever a value can run out (health, fuel, stamina, ammo, charge, shield).
- Use Stat Increase when you care about hitting a milestone (level up, extra life, overheat, charged, full meter).
- You can still combine Stat actions with regular Float actions for more complex setups:
- Use Float Add/Subtract when you just need math.
- Use Stat actions when you also care about game events and thresholds.
- Keep your FSMs readable by naming your stat variables clearly:
PlayerHealth,PlayerXP,PlayerScore,WeaponHeat, etc.- This makes Stat summaries like “PlayerHealth -= Damage. If zero: Dead” very easy to scan.