Hello! I have a problem and no matter how much I search, I can’t find a solution.
I will give context so that it can be understood better: I have a Blueprint of type character that is the character, I have a multicast event which contains some branches and at the end it has a “Blueprint Interface” to connect with the weapon blueprint
My big problem is that when I run this in multiplayer, 2 windows appear, the editor one and another separate one.
In the editor’s gun it shoots correctly, but in the client’s gun when he shoots, his gun doesn’t fire and the server’s gun shoots, I’ll explain again in case you don’t understand:
Player 1: Server
Player 2: Client
When shooting in player 1 everything is fine, when shooting in player 2 it doesn’t fire but you can see that player 1’s gun fires.
I have searched thousands of places and I can’t find a solution, can you help me?
Client presses Fire → Fire a Local only shot → RPC server to Fire
Server Fire → Same exact firing logic as client → Multicast to Sims
Multicast to Sims (Data server used to fire its shot) → Sims Fire
That’s the basic flow. If you’re using projectiles there’s a more complex setup. You don’t replicate projectiles. Each proxy needs to either pool or spawn a local only projectile. Whereas the servers is the only that does damage on hit.
I still can’t solve it, I did it as you told me, although it is not clear to me about the server value, I have been trying to solve this for 6 days and it has stopped me.
Add a line trace and it looks upside down, I imagine it’s due to the “socket” of the weapon, however, I am suspecting the blueprint of the weapon, or the spawn actor because the shooting animation does reproduce it perfectly in the client, I also think that I am missing an “owner” that indicates who is the owner of the weapon that is being fired, although I tried that and it doesn’t work either, or I did it wrong.
I think I left out that the weapon is built with PrimaryDataAsset → Data asset, and a blueprint for the logic.
When you instantiate the weapon on the map, only that weapon fires, so I realized that it doesn’t matter if the replication is done right, the first weapon instantiated will always be the one that fires.
Do you know any way to tell the gun that it can only fire from the player?