What are custom Stats?
Custom Stats are changing like Health or Mana and have a Stat as Base, which defines the Max Value of the Custom Stat
For example:
Stat Health: 1000
Custom Stat Health: 500
The Stat Health defines the Maximum Health (1000) and the Custom Stat defines the current Health the Player has (500)
So the Player is having 50% of his Health.
What means Health with Potion?
In this Plugin if the Player uses a Potion, he will not instantly fill up his Health (or other Custom Stat).
His Health with Potion will be higher then the Health, if a Potion was used and for this Amount his regeneration will be faster.
In this Tutorial we will create two Custom Stats.
Health
Regenerates every 2 Seconds 50 Health.
Regenerates 150 Health if Potion used.
Mana
Regenerates every 2 Seconds 25 Mana.
Regenerates 75 Mana if Potion used.
If the Player died and is going to be revived, the Mana should be set to max.
Create Custom Stats
1. First of all we need to create the Stat Health and Mana.
Look for this into the Stats Tutorial.
I will use following Gameplay tags:
Health: Stats.Secondary.Health
Mana: Stats.Secondary.Mana
2. Now we can create our Custom Stats inside our Details Panel of the Stat Component inside our Player BP.
Set following for Health:
Health Stat Type: Stats.Secondary.Health
Health Regeneration Duration: 2,0
Health Potion Regeneration Multiplier: 3,0
Health Regeneration Default Amount: 50
Set the following for Mana
Add one Item to the Array Custom Stat:
Key: Stats.Secondary.Mana
PotionRegenerationMultiplier: 3,0
RegenerationDefaultAmount: 25
setToMaxOnRevive: true
Custom Stat Regeneration Duration: 2,0
Potion Regenerating Amount is calculated by: Amount = DefaultAmount * PotionMultiplier
Now you are able to call reduceCustomStat and usePotion with Health and Mana.
Custom Regeneration
Currently the Player can only regenerate 50 Health or 150 Health (with Potion) every 2 Seconds.
Now we want that the Player can regenerate more Health if for example he has a higher Level.
We can achieve this, with creating new Stats for Health Regeneration and Mana Regeneration.
1. First of all we need to create the Stat for Health and Mana Regeneration.
Look for this into the Stats Tutorial.
I will use following Gameplay tags:
Health: Stats.Secondary.HealthRegeneration
Mana: Stats.Secondary.ManaRegeneration
The Value of the Stat is defined in Percentage.
For example the Value of 10 means 10% faster Regeneration
For Health would be 10% faster a regeneration with Potion = 55 every 2 Seconds
2. Now we can add those Stats to our Custom Stats.
Open the Details Panel of the Stat Component inside your Player BP again and change following:
For Health Regeneration you need to set the Option Health Regeneration Stat Type to Stats.Secondary.HealthRegeneration.
For Mana Regeneration you need to go inside the Mana Item inside the Custom Stat Array and set the RegenerationStatType to Stats.Secondary.ManaRegeneration.
Now depending on the Value HealthRegeneration, the Player can gain different Regeneration Values.