Download

Health Bar Showing recent damage

I am looking to create a dark souls like health bar that shows recent damage taken by highlighting the section that will be lost in another colour before reducing it over a short period of time. I have bound a progress bar to my character’s current and max health but I’m not sure how to go about showing the recent damage?

Just have another bar under it (in z order I mean) and do something like this.



int barLength;
float timeBeforeBarGoesDown;

void TakeDamage(int healthBeforeDamage) {

}
​​​​​​​

Just put another bar under it (in z order I mean) and have it listen for when you take damage. When you do, do something like this

I don’t know what the actual variables are called so I’m going to make up stuff

int currentDisplayedHealth;
int currentHealth;
float timeBeforeCountdown;

void TakeDamage(int healthBeforeDamage, int healthAfterDamage) {
currentDisplayedHealth = healthBeforeDamage;
currentHealth = healthAfterDamage;
timeBeforeCountdown = Whatever however long you want;
barWidget.barProgress = currentDisplayedHealth / character.maxHealth;
}

and in the Tick function, countdown the timer towards 0, and if it’s <= 0, start lerping the bar from the currentDisplayedHealth to the currentHealth;

That will do it, but I’m not sure how to smoothly reduce the value?

The bottom (underneath) health bar is bound to ‘Previous Current Health’ [PCH] and the top to ‘Current Health’ [CH]. In take damage I set PCH to CH then reduce CH by the damage amount. After this I want a short delay (0.5 seconds or something) to allow the player to initiate a counter attack and regain their health (think Bloodborne) before PCH smoothly reduces to CH. I would imagine I use an FInterp but I’m not sure how to wire it up? I have a variable for Delta which is updated every tick if that helps.

This is what I am currently doing:2018-03-27 21_53_15 - Unreal Editor.png

I’ve never played bloodborne but I looked up a video and it seems like what you’re taking about is what they call the rally system. Considering what you’ve done so far I figured it would be easier to just show you.

Sorry the reply took so long, spent ages trying to make the pics small enough for the forums to let me post them

Dude this is incredible! I never expected you to go to all this trouble, thank you so so much!