Spawn object and replication
I am doing a spawning tool in my game. I would like that, when a player press a button in a UI, an object spawn. Actually, I managed to do it :
In my interface when the button is clicked I launch a RPC event on the player state. Then, I call a multicast event and spawn object in this event. It works well but I am not satisfied. At the beginning I tried to do the following :
This was not working, but I have no idea of why.
Question 1 : Does someone could explain me why ?
Now, I would like to destroy this actor when a player press a key. But if I destroy the actor it does not destroy on client (since each client has they own actor replicated).
I tried to do the following :
This is not working : If player 1 come and take the actor, it is not destroy, even for him. It is only destroy for the server.
Question 2 : I would like to know if someone can explain me why it is not destroy for other players.
Sorry for my mistakes, I don't speak english very well...
Thank you for your answers !
All the best
asked Apr 02 '19 at 11:03 AM in Blueprint Scripting
Hello, I have partially solved my problem. I didn't realized that since we can't simulate physics properly in multilpayer (just by checking the option), it was the reason why when I spawned the object in a RPC event it doesn't work. I found a new solution that work well without having to do a multicast to spawn the object and see the object falling on the floor as I would like to do : Instead of simulate physic you can, to make an object fall on the floor, use it as a projectile. It is quite strange I think but it works well. You will not be able to shoot the object and make it move next but it will fall. If it is just what you want it is ok.
So, I had partially solved my problem, since I am still not able to destroy the object for everybody easily.
answered Apr 02 '19 at 01:40 PM
Ok I solved all my questions. If you have spawn the object using a RPC event, you will have to destroy it exactly in the same way you create it :
If you need help to use projectile, this video may help you : https://www.youtube.com/watch?v=AM3TXKI-4co
I hope it will help someone in the futur ! If someone have a better way to do it please don't hesitate.
answered Apr 02 '19 at 01:50 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here