Multiplayer Health Replication

Hello everyone,

I am fairly new to UE4, been developing for only a month.

I have a question regards replicating health variables.

I am trying to setup a cube model blueprint that damages actors when they overlap it.

I was able to do that, but the issue is that all clients are taking the same amount of damage, even though they are not overlapping the cube model. It seems to me that they are sharing the same health variable, and whenever it changes by the server, they all change to the same value.

Can you help me please:(

Blueprints:
Box blueprint that deals the damage:

Character event AnyDamage blueprints:

Take Damage Function:

UI widget the shows the amount of health:

Result:

278369-ezgif-5-4225f9a26e8a22.gif

One problem is that in the overlapping box function you are not damaging the actor that started the overlap but all actors
it should look like this

You do the same thing on the health bar getting all actors and then setting the value,
you need to get the actor the health bar is on and then only show the health of that actor on his healthbar

Hello,

Thank you for the quick reply, i fixed the box blueprint successfully. However, when i try to fix the health bar UI issue, i end up with Cast To function that requires an object, and i couldn’t figure out what type of object that it requires, so i used the get all actor function.
i tried to use get player controller, get player character, self, made local variable of the player character blueprint inside the animation blueprint that also did not work, sadly.

please refer to the attached picture bellow.

When i use get player character, i end up with empty bars:

setting the health bar value is not super trivial,
basically you need to connect the widget with the actor that it is on,
one fairly exhaustive description how to do that is here

and just as a side note, none of that has to do with replication yet
that’s just how to damage and show health of different npc
to make it work in multiplayer the health value needs to be set to replicated, and the actor and component it’s on as well

Thank you very much for helping me out!

I was able to successfully fix the health bar issue by following the instructions that are given in the link above.

happy to help, could you pls accept the answer