Bug in blueprint : @BranchOn_HasAuthority

Understanding that this is a demo, and not really worth troubleshooting/debugging, there is a bug in the example.

In the Tick Event, where the particles are spawned on each character in the area, the lecture had us branch on HasAuthority and we continued on “true.”

As is it, if two players stand inside the area, only one of them will get the particle effects.

Fix is to continue on “false”

1 Like

That makes sense given the server has authority. Thanks

EDIT: The server makes the call therefore the call is made on HasAuthority - i.e. the server, and the clients should receive the request to perform the action. So, while I looked at this initially, what you said made sense @acecase but is actually quite wrong. Apologies for that.

I might have missed a step, but as i was trying to find out why only one Actor gets the Particle Effect (with 3 in the area), i stumbled upon your solution. But switching the Authority Branch to false converted the ClientRPC to Replicate the One Clients Explosion to all…

Any ideas what i could have mised?

Yes, changing the call to not have authority is not the solution. I thought about it some more yesterday and the instructor confirmed. The call is supposed to be made from the server and broadcast to all clients.

I need to look at this more myself to see if I can recreate the issue. It could be once again related to the need to delete the binaries, intermediate and saved folders and then rebuild. If you haven’t already done so, there’s no harm doing this in the offchance it corrects the issue.

Sadly the Folder Clearing did not solve the issue. My current standpoint remains:

  • Particle is shown only on the client, that receives it
  • Only one client can receive the Particle at a time
  • Switching the client by walking off works without any issues

My guess is, that somewhere the For-Each Loop doesn’t Apply to every Client Object, but I can’t think of any solution…

Ok, I am exploring some more. The whole point about the broadcast is it should be sent to all clients.

I am wondering if this is a 5.3 issue given the course was developed in 5.2 - I personally use 5.2 for all tests as it is recommended it should be the same version.

Looking at it more and more, it looks as if it is by design. for each player in the box collider, trigger the message for that player.

I will continue the investigation and get back to you when I can

Yes, I can confirm that the trigger happens on the player that is overlapping and so it is correct behaviour. There is a way to address this however. I found this post in the UE forums that refers to GetCurrentPlayers. You can loop over the collection then and perform the action.

Get list of all connected players? - Programming & Scripting / Blueprint - Epic Developer Community Forums (unrealengine.com)

The problem here is the “Do Once” node, because when it orders the first explosion stops passing to the cast node avoiding the calling on the other overlapping actors.

To solve this I moved the 2 seconds logic to the code since I didn’t find a way to detect when the particle stopped emmiting.

This is my level blueprint

On the player’s .h I declared a boolean, a timer and a function

image

And on the cpp I added

notice that I added a condition to return if the timer is still running.

Then you’ll be able to see the explosion for each character

2 Likes

Privacy & Terms