unreal engine subsystem 2nd player error

I created a subsystem game, then joined with another player, but the AI ​​dies when it hits the participating player, but the head bar doesn’t seem to have low health. What should I do?

Hey there @DemirYapim! Welcome to the community! Just to clarify the question, is your health bar not reflecting correctly or is the AI being killed faster than expected? Could we also see the problem BPs?

yes, the health bar is not reflected correctly, only the health bar of the person who set up the room is reflected

Singleplayer

Gotcha, so if your project is singleplayer and you mean you got a new character in and the health bar stopped functioning, it could be for a myriad of reasons. Is your health bar a 3D widget component attached to the NPC or is it a widget tied to the player viewport?

In case of the 3D widget, it should be tied directly to the values of the health so that should remain accurate.

In the case of tying it directly into your UI, it’s likely that your new player just got the reference and the HP UI element, but it could be a reference missing after the fact or possibly that you’re calling from the damaged actor to the UI which will unfortunately cause this problem where new respawned players may not be “up to date” with the information.

Could we see how you handle the health bar and how the variable is read?


Multiplayer

If your project is multiplayer, and has games where players can join in and out, you’ll need to work with RepNotifies to make sure all clients get the information updated when they join. Example video below:

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

Thank you for the answer. Could you please answer my other question? A friend answered but I’m new so I don’t understand what you mean. Any chance of showing with an example?(ss) :slight_smile: https://forums.unrealengine.com/t/my-widgets-are-conflicting-what-should-i-do/751135/2

1 Like

No worries, I dropped a reply over there, but Raven is one of our most powerful community members and will likely also show you a more robust way of handling it. For this question, definitely try and work out a solution with what’s been laid out, if you can’t or just have more questions I can go into more depth if we can see the blueprints and such, as otherwise we can only guess how you’re handling the health. Awesome work so far!

1 Like

I’ll try to prepare a quick scene with health ui

Edit:
Here is the uploaded project.

It’s based on rep_notify so only changes in the health will be replicated, not taxing the network bandwidth as constant replication.

Oh and if you want to implement a listening server the you may need to call the update on the ui manually after damage (multicast is only called out to clients, not on the server) so just call the update manually on the widget passing in health and maxhealth and it should work fine.

1 Like

Thankss:)