Hello, Ive been trying for a while to get my projectiles to replicate for multiplayer. I watched the unreal tutorials for networking but still dont understand how to do it. Can someone please explain it and help me figure this out thanks.
Can anyone help me figure this out?.
Its kind of strange but what you need to do is create a custom event then set it to run on server. Point the custom event to your projectile function.
Then call the event from where you were calling your projectile function from before.
I’m a little confused. I have Input Action Fire Running my function. Do i just have the custom event go to the same place the Fire function does and have the Custom function at the end of my fire function?.
Should be similar to C++, which is SetReplicates.
I have not done c++ i have only used blueprint.
Hey, input events are only fired on the local player, so if want to spawn something when you click your mouse you need to call an event that replicate on server (run on server, reliable). You need to do the things that you want to replicate on the server or it will not work.
Ok, I set a custom event “Fire” and have it play when i left click. Now the server sees the projectile but the client doesn’t?. Does anyone know why.?
The actor(your projectile) that you spawn need to have replicates and movement replicate checked inside his default proprieties.
It is set to replicate but it does not show up on the client just the server now.
Have your input button (Left Click) for firing the weapon call a custom event. Set the custom event to Run on Server.
Should look like this.
Oh, i missed a detail in there and see that you did something like this. Hmmmmmmmmmm This exact set up is working for me.
You did this right? This is inside the projectile BP
Yeah thats how i have it setup but for some reason it does not appear that i hit something. Inside my projectile i have a hit result that spawns an emitter and i cannot see the emitter spawn when the projectile hits on the client side.Also for some reason in the server side the hit is off for some reason. I shoot 1 place in the client it it displays like 5 feet to the left of where i shot on the client.
I still cannot get the projectile to show on the client. Its only showing on the server and not even in the right spot.
Spawning of the particle will also have to have the same kind of replication applied to it. Needs to be called by the server.
Something sounds seriously screwy with the way you have it set up. Especially when I hear that things aren’t even showing up in the right place. You may have some of the spawn transform properties messed up as well. A good practice would be just to start over and make sure you understand how everything is working.