Download

Projectile hit display widget on hit player

Hello friends!

This issue seems to be causing me more grief than it should, I’m certain it is something incredibly simple that I’m missing, however, the problem is, in this multiplayer game when a player is hit with a certain projectile it is meant to display the widget only on the hit players screen, similar to a blood effect seen in most shooters. What is actually happening is it is being displayed on all client and server screens when anyone gets hit with the projectile.
Nothing has been set to replicate, the only thing that does is the projectile itself.
The hit logic is compiled into the character blueprint, again nothing is set to replicate.
I appreciate any feedback.
Thanks

Hi, can you show an image of the logic where you create/show the widget?

You should make sure that this logic only happens on the client where you want the widget to appear (e. g. keep in mind that if the projectile replicates, then the Hit event will eventually most likely happen on server and all clients)

There’s not really much to show, event begin play plugs into create widget, that widget is set to a variable, that’s it for creating the widget.
The hit logic is on component hit, I use a TAG on the projectile, this TAG is used to verify it’s the correct projectile, plugged into a branch, when true adds the widget to the viewport

Ok, the hit event will most likely execute on all clients and server (you can verify via print).

Now if you want the widget only to display on the player that was hit, then you can check whether the pawn that was hit is locally controlled and if so show the widget.

Ok, so yes the hit event is being generated across all, verified by the print string. Such fun…
When shot from the server the hit displays on the character hit as well as the server. When done from the client it displays on the client shooting not the client hit as well as the server. If the client shoots the server, it displays on all. I really hate the way replication works in unreal, I’ll have to spend some more time on this now knowing it’s replicating

Ok so, I don’t know why it’s working now, I erased it all and started again, as I have tried with the local controlled function as well previously and still had issues. Here is the final structure which is pretty much as you’ve stated here. Thanks for your assistance!

1 Like

I’ll have to spend some more time on this now knowing it’s replicating

It’s not replicated. The Hit event will execute locally wherever the collision has happened whenever it has happened. So since the projectile exists on the clients, when it collides with something in a clients simulation the hit event will execute on that client.