In this case have my Enemies created and working good using a parent BP called BP_Enemy, from that i create the enemies and the settings for each enemies are stored on a database called NPCTable. Here have the values Health, Mana, Damage, Range, Name and ID.
My problem is when try to create a widget to add a health bar over the enemies i cant ganerate the progressbar for this health or mana.
I dont know the way to take the value stored on NPC Table over in array (0 is health, 1 is mana, 3 is damage) and use that to make the progression bar.
This is the way set my health and mana from the table to the array:
In the first image set the stat health (0 in array) and mana (1 in array) from the Table.
In the Second image take damage and decrease when take any impact or melee attack.
But i can catch this value to update the percentage Bar…
@Okarii i put wrong you user jeje about the test, have the bar over the enemys ok but never decrease when recieve the damage, because i can catch the current help update from the array like say before!
From looking at your section on apply damage. I’m trying to understand a little of why you are using a float array, but regardless, here are some things. You’ve got some redundant nodes there I have Circled in Red, you can just remove those. If you looking for where to plug in the UpdateHealthBar Event I would recommend it right after you set the array element, I’ve marked that in blue. And it looks like you are using a clamp node to try and handle some == logic on a branch node later. given its about if the enemy is alive or not, you could remove the stuff on the left indicated by the black box and just change the branchs logic to <=, then if the health ever is 0.0 or less, you can assume the enemy is dead.
If the Print node you have is still not indicating decreasing health then the issue is not in the nodes your currently showing, its either in whats calling this function, or it could be something on the widget, you may want to have a print node (i would change the text color for it) to verify if health value changes are getting there. Keep in mind that a progress bar works from 0-1, 0 being completely empty, 1 being full. anything OVER 1 will still be treated as just full progress bar.
The problem with the health bar is cant catch the StatCurrent Value i dont know why…
My flow is simple, all the stat for my enemies are stored on a Data Table from here create and array and make the set to the current stat value like the image before.
So the progress bar operates as 0.0 = 0%, 1.0 = 100%. So any value >1.0 is treated as 100% as well. If you want to use 100 health as their health then you need to divide current health by max health and send that to the widget.