Is there a way to display the owning players widget component?

How are you adding the widgets? You need to show us some code and actor component structures.

The problem is your construction script in the widget. You get player 0 for every instance so they will get their health from the same character (yours) and will mirror that characters health. Instead, give it the character reference in the construction script of the character.

Best way to do this is to make an event in the widget called SetCharacter where you just send in the character reference.
Then, in your CHARACTER construction script you call that event on your widget by extracting it from the widget component. I dont remember exactly what the node is called, but you should be able to find it easily.

Plausible issues:

  1. Make sure the variables are replicated if the game is multiplayer.
  2. You force the update from the owning character, NOT the widget itself and it only works on the player character class.
  3. Tick might not be enabled or something.

Here is a working example from my code:

HTH

Hello,

Currently I have a floating health bar showing up on characters of the “Knight” class. The health is working as intended, it is showing the correct percentage values and all - but the problem I am having is that every other players health bar will mimic the currently played characters health bar.

For example:

If I am playing player A, and drop his health to 50%, the health will also appear to drop to 50% on player B even though Player B’s actual health is 100%.

I am using a widget component that has one progress bar and on construct is being cast to my “KnightCharacter”, the progress bar is setup to Bind with a “Health Percentage” that I have set up currently in the KnightCharacter blueprint.

I hope I explained my problem correctly, thank you in advance for any feedback!

190196-widgetdesigner.jpg

190198-knightcomponent.jpg

This is what I have for the Widget itself, and the Knight blueprint. All you see is what is calling the progress bar. (The one UpdateOverheadHP function you see is currently not in use as I found out binding the progress bar is much simpler)

Thanks! I will give this a try for sure.

Hello N0sh,

You are doing it reverse. You need to reach the UMG from Character BP. Create a veriable in UMG and use it as percent reference in UMG. Then open your Character BP bring your widget refence and set health variable and check it with Event Tick.Check the image below you will understand what i want to say.

I tried your way and was able to stop the other players health bars from moving when the current players health moves, however, I am still having the issue of having the other players health bars correctly display as well. Right now, if i switch characters and decrease their health, it won’t appear to move on any other players screen.

It does not really matter which way he does it. It comes down to how he wants to design it. Doing it your way works fine, but dont try to sell it as the “correct” way. Further, sending the data TO the UMG widget is not my preferred method because it adds extra nodes to the Tick event of the character to clutter it even more. This will cost time and annoyance when making modifications. Instead, by putting it in the widget class, you can clutter the Widget class’ Tick because it hardly changes. Finally, encapsulation is a good practice to learn.

Anyways, the point in the end is that both methods work and they have certain pros and cons. Try both and find the one that suits you best.

Both of them worked either way, and you’re correct about the clutter. I’m still just having trouble getting the bars to display other players health.

I will add a few plausible problems in my answer so please look at them.

Let me check this out, I’ll let you know when I’ve got it working.

Still no luck replicating this to display for other characters. I’ve followed everything you’ve said to the T.

Sure. I have been fiddling around with it, trying different things. The asset I will send will be what I currently have on there - which is showing updated health bars, but just not to other players. What files would you need, just the character and widget assets?

Yes. Please just zip them or something.

Anyway I can PM you?

I’ll drop it here and delete the comment once you receive it.

http://puu.sh/weZrE/7353a022e0.jpg

This is how I did it:

http://puu.sh/weZv7/c729dd0407.png

It works for me. This is just what is called when the target receives damage. The best way to do it would be to make an event in the widget called UpdateHealth or something that you call once the changes have been made and put this code in there.

My internet is finally back on :expressionless:

I’m not seeing how you got this to work. I’ve done everything you have exactly. I am sure I’m doing something wrong. Could you send what you did back to me and I can reverse engineer it?

I just did this: Added your widget to the standard FirstPersonCharacter from the template and made the two variables Health and MaxHealth. That line is hoocked up to a function called TakeDamage that removes 10 health. This function is a replicated function and is called once every 10 sec.

Let me see how I can manage this in my blueprint.