Alright so in my ThirdPersonCharacter bp I have three variables, MaxHealth, CurrentHealth and HealthRegePercentage; inside a function these variables control a progress bar widget that regenerates health until full, and upon CurrentHealth being equal or greater than MaxHealth no more health is added.
The update health function is here: http://blueprintue.com/view/2n6OpZ5Y/
Now that works all fine and dandy, upon the variables being equal to one another, no more health is added. However, in order to test this theory I created two more variable inputs, damage and heal. When V key is pressed, inside the Event Graph of 3rdPerson BP, 5 damage is sent to the update health function to be subtracted from the health regeneration rate total that is being set to current health, the same thing in reverse is done with the heal float, 5 points are added to the regeneration total before being set.
This works until you get close to your max health, I am able to add and subtract from current health perfectly fine, however if you are at 99 health and heal yourself 5 points, the float obviously goes beyond 100 (max health value) and does not regenerate automatically.
Now according to my logic (theoretically), you would just have to send some damage to the update health function in order for damage to be subtracted…However this is not the case.
When you are at 99 health, and heal yourself 5 more points, the progress bar converts this number into its negative equivalent -104 and starts regaining health, because the variable current health is less than positive 100…
Any suggestions on how to fix this? I know its a flaw in my logic, however I can not see the error, working with blueprints is new for me, however programming is not. I just wasn’t catching onto ue4s c++ documentation and decided to go with blueprints. That and a lot of tutorials are outdated