x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Spawn object and replication

Hello everybody!

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 :

  • Call a RPC event that is in Player state, from my UI

  • in the RPC event in player state do the spawning.

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 :

  • From the BP of the spawned actor, call a RPC event that is in my Player state

  • in this RPC event call a multicast event that will destroy the actor.

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

Product Version: UE 4.20
Tags:
more ▼

asked Apr 02 '19 at 11:03 AM in Blueprint Scripting

avatar image

Elites94
12 1 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

more ▼

answered Apr 02 '19 at 01:40 PM

avatar image

Elites94
12 1 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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 :

  • Call a RPC event and give in input the actor you would like to destroy (This event must be somewhere like in the Player State)

  • In this RPC destroy the actor that you have in input.

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.

more ▼

answered Apr 02 '19 at 01:50 PM

avatar image

Elites94
12 1 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question