First off, cause this is really going to bother me, can’t you just just do current health / max health to get the ratio? Is there any need for those extra / 100?
Second, I’m assuming your max energy is 100? Otherwise, shouldn’t your if (CurrentPlayerEnergy >= 100) be if (CurrentPlayerEnergy >= MaxPlayerEnergy)? And you don’t need the first branch either. Instead you can just change it so it’s if (CurrentPlayerEnergy < 100) and plug that directly into a SetCanRegen? And if you’re not using that variable for anything else, you can just plug it directly into the second branch.
Third, I personally wouldn’t put any of this into the tick function. I’d only call the SetCurrentHealthPercentage when you change your health. So you’d have a function called TakeDamage (and Heal) or something and do the set stuff in there. There’s no point in calculating and setting the variable every frame if it’s not changing. And what you’re doing to recover energy, I’d just make another event to do that. Something like IncreaseEnergy. So it would look something like:
IncreaseEnergy -> Delay(3) -> if (CurrentPlayerEnergy < 100) -> CurrentPlayerEnergy++ -> IncreaseEnergy. Else IncreaseEnergy
And then just call it on BeginPlay. That way every 3 seconds it will check if the CurrentPlayerEnergy is less than 100, and if it is, it will increase it by 1. Btw, I’m not 100% certain that will work as I’m very sleep deprived and wrote the first thing I thought of, but I don’t see anything wrong with it right now.
And now to actually answer your question. That amount of stuff in your tick should be fine. It’s all really simple math, but again, I personally wouldn’t do it like that.
Edit: Oh yeah, and if you don’t know what the ++ next to CurrentPlayerEnergy++ is, it just means CurrentPlayerEnergy = CurrentPlayerEnergy + 1. It’s just a faster way of writing it. I believe there’s a blueprint node for it too, called Increment or something. If you drag off from the variable and just type ++ it should come up.