I created a state management component in the Unreal Engine 5.2 to manage HP and stamina, and then created a modify function with input values for the desired state and value. When I used this function to modify my stamina, I succeeded. However, when I modified HP, Get Current Stats Value is always 0. After adding the damage to it, it becomes damage, and the damage is a negative number. How should I solve this problem
Multiply the damage by a negative number and enter the function
stat is health
When the modify value is not equal to 0, add it to Get Current Stats Value(stat is health)
When I printed the value(stat is health), it was always 0,But I’m pretty sure I set it to 100 in the component, and if I use the debug button to print, it’s the correct 100
When I run an attack, the Get Current Stats Value will become 0. After adding it up, it will become the damage value, and then HP will become the damage value.
clamp the health between 0-max hp,and damage is a negative value so health become 0,I will dead