Armor Reduce Health Lost
I'm trying to figure out how to reduce the amount of damage taken by a percentage based on the value of armor. So, I have the Armor value once equipped setup and I have the damage/health lost system setup, everything I've tried to get the armor value reduce the number on the damage value hasn't worked. Some help would be greatly appreciated :D
asked Jun 06 '18 at 05:37 PM in Blueprint Scripting
It may sound simple but, have you tried just substracting armor to Damage and then substracting this new value to your hp ? If it doesn't work, wht does printing armor and hp gives you ?
answered Jun 06 '18 at 07:27 PM
below is an example of how this could easily be scripted. the armor variable would be the percentage that you want to be the reduction, this is a value that you could calculate and set in a sepeerate script. now how the script works is that you take the incoming damage and multiply it by the percentage which stands for how much you want to reduce damage, the product here will be the total damage that will be negated so you now need to subtract this number from the original damage amount. once this is done we now have the total calculated damage (affected by armor) that needs to be applied to the character. so as an example lets say you were applying 10 damage and your armor reduces damage by 10%, in this case you would have 10 - (10 * 0.10) = 9.
also note that for the percentage you could have the value set to a value of the damage you want to be applied to the character, for example if you wanted the character to take 80% of the total damage you could set the armor value to .8 and eliminate the need for the subtraction.
answered Jun 06 '18 at 10:01 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here