Owning client event is not execute (sometimes...)

Hello everyone !

I am going crazy… I have a run on owning client event that is execute… sometimes !

My project is a multiplayer project.

Here is how it works :

I have a Player character with a On possessed event. This event call an other event (run on owning clients) that works.

The run on owning client will call a function “Set Mesh for All” that is in the player state (So I connect the pin “target” of the event with the result of a “Cast to player state” with as the object “Player State”

“Set Mesh for All” get all actor of class Player Character and do a for each loop on the array. Then, if it is not the current player, we launch another event (RPC event) on the player character (that launch the function) and give him the reference of the PlayerCharacter that we are dealing with. So I connected the pin “target” of this event with a cast to player character and using Get Player Pawn as the object.

The RPC event will use the PlayerCharacter we gave to him to get a variable “ID_mesh”. Then, he calls an event run on owning client “SetMeshForThisPlayer” (again on the Player Character that initially launch the first function) and give him the ID_mesh and the reference of the PlayerCharacter we are dealing with. The “target” pin of the event is link to nothing (self).

“SetMeshForThisPlayer” will search in the DataTable (using the ID_mesh) the correct mesh and set it to the given reference of Player Character.

The problem is the following :

  • I launch a player that will not be use (listen server)

  • I launch a second player, the event is calling well (I added a print string in it)

  • I launch a third player, the event is calling well

  • I launch a fourth player : the event is not calling ! (Sometimes it is and sometimes not. 80% times it is not…)

I don’t understand why… Is there any reason why an event can be called only sometimes ?

Thank you in advance for your answers and sorry for my bad english.

Have a nice day !

All the best

1 Like

Hi, two reasons I can think of why this is happening:

(1) if your custom if event is not set to reliable it might be dropped (when your network consumption is too great). But don’t make everything reliable, only what you absolutely need to, since the dropping happens due to network bandwith.

(2) When the actor exists on the server but does not yet exist on the client, then “Run On Owning Client” will fail, since there is no owning client yet (you would solve this by using a delay, so waiting for the client to load).

2 Likes

Thank you a lot chrudimer for you answer. It is working well with a reliable event. :slight_smile:

Have a nice day and thank you for your explaination