Problem replicating to In-Progress Client (with rep notify)

Hello guys, my name is Alejandro and today I’m bringing up a problem that got me at least 2 days of bashing my head against the keyboard.
It should be very basic to solve, it’s just that my knowledge in this area is limited.

I have a replicated function that works perfectly. However, when a new client joins the game, they cannot see the other clients executing that function. I believe the issue lies in the fact that the function is within a widget. Since widgets exist locally for each client, the new client cannot access the functions in other clients’ widgets. As a result, the function doesn’t execute for the new client. How can I make sure the function works for all clients, and the new ones?

The widget lives in the character, as a component, intended to be a HealthBar, Floating above the character head, as for example, in Dota2

I will guide you step by step:


This BP_HealthStart, comes from BeginPlay, but I even tried it on OnPossesed, and tried adding Delays to it.


This is the OnRep_Function, that sends the CurrentHealth thru an interface to the Widget
Till this function, if i have 2 clients and 1 server, it gets executed 3 times per client (as it should)

3
This one is simply because I cannot access the widget function itself, without having to cast, im using the event graph to implement the interface and call the WidgetFunction.


This one would be the main function to set the percentage on the widget.

So anyways thanks for your time, and hope you can spot my mistake very rapidly, and get me on my tracks very soon!.

-Alejandro

Hello

It looks fine to me. The Set w/Notify Current Health is being set server-side on a relevant replicated character right?

Do you have any runtime errors or warnings in the log output?.

You may also try to make a new OnRep variable to check if something went wrong creating the old one.

You are right that widgets only exist locally but that should not be a problem as long as you keep the replication on the Character and have the widgets react to the OnRep function as seem to be doing.

Character is set to replicate, and always relevant, with no errors or warnings on the log output. I tried setting it on a different OnRep Variable, but still no luck.

Here are the Ingame Results:

Players when game start
Server and client 1, when the game first starts (they see correctly), ignore the yellow bar.


Client2, which joins later, sees the health bar not set on Server and Client1.

Thank u so much for the time!!

Found the solution, looks like something went wrong with the first variable as i have created another one, with rep notify, didnt change a thing and worked like charm

Solution1


Now i gotta find a way to clean all this mess and see if i can replace the first variable without breaking the game

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.