Hey @adnemannen
here is a small example:
Set the MaxWalkSpeed for the character in the beginning
Set IsSprinting, then set the corresponding MaxWalkSpeed, clear a timer if there is one via the TimerHandle and then set a timer for consuming the stamina or regenerating stamina. These timers use a different time for looping, ConsumeTime = fast 0,01, RegenTime = slow 0,1.
Simple move input
The looping event called Stamina. Yes you can use an event for a SetTimerByFunctionName. First, we check if the character is sprinting AND is moving.
If the character does both, we check if the CurrentStamina is above 0 and then decrease it.
If the character does neither, we check if the CurrentStamina is less than the MaxStamina and then increase it.
Starting values =>
CurrentStamina = 100
MaxStamina = 100
IsSprinting = False
ConsumeTime = 0,01
RegenTime = 0,1
WalkSpeed = 300
SprintingSpeed = 600
In your case it would look like this:
Keep in mind that both ways are currently only changing the stamina and do not stop the character if the stamina is 0.
Here is another example: