Thanks for your replys.
“We are not looking for the owner of the level blueprint in this case. We’re looking at the owner of the character, which would be whichever client that character belongs to. Whichever client overlaps the trigger will be the client that the AddItem event is called on.”
That is exactly the issue, cause it is not that way. You are not looking for the owner of the character. The OwningClient-RPC function got the parameter “Character” added to it, how should the OwningClient-RPC function know which of the parameter (if there would be multiple) to check for the owner? The OwningClient-RPC function can only check the calling instance (which is the LevelBlueprint on the server). The LevelBlueprint belongs to NONE and thus the OwningClient-RPC is executed on the Server as statet in Network Compendium Page 60 which is just a copy of the original Unreal table.
Let me try that the long way.
The Character is moved by the client and the movement is replicated to the server instance of the client character via the movement component.
The server instance of the client character now triggers the box, which leads to execution of the BeginOverlap with OtherActor being the server instance of the client character.
Cause we are on the Server, we will get successfully passt the SwitchHasAuthority.
Now on the Server, we call AddItem-OwningClient-RPC which will check the calling instance (the LevelBlueprint) for the owner. Again, the “Character” variable is just a parameter added to the AddItem-OwningClient-RPC and can not be checked by the RPC function itself. The “Character” variable is not checked afterwards (by the script) either.
Cause of the above reason AddItem-OwningClient-RPC will execute on the server, which is shown by the “Server: Item Added” PrintString in the video at time 0:38.
Still on the server, the “Character”-Parameter of the AddItem-OwningClient-RPC, which is the server instance of the client character, is cast to the ThirdPersonCharacter.
After the cast, the “Inventory” variable is set in the server instance of the client character. The “Inventory” variable is then replicated to all client instances of that character.
For sure Client2 got the item now, but not because the OwningClient-RPG function was executed on the client. Its because the Inventory variable was replicated.
You would get the same behaviour when simply cutting the OwningClient-RPC from the execution chain. Just Overlap->SwitchHasAuthority->CastToFirstPersonCharacter->SetInventoryVariable will result in the same result.
Check this yourself. Build the example as in the doc and remove the replication of the Inventory variable. You will see that it will not work anymore, cause the OwningClient-RPC is NOT executed on the client!
cheers