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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Item activation and replication

Hi! I want to add a feature in my multiplayer game. The players have to activate different crystals. So far, it works that I go with the player to the crystal, activate it and the crystal then gives off an energy beam. The problem is that it is not replicated to anyone. Even if it does the host, it will only show to itself.

Product Version: UE 4.22
more ▼

asked May 12 '19 at 01:47 PM in Blueprint Scripting

avatar image

3 1 1 2

avatar image Lardo Deepdelver May 12 '19 at 04:31 PM
  • how do you trigger the active crystal

  • how should it be replicated

  • is anything on the crystal being replicated

avatar image tylobix May 13 '19 at 06:06 AM

I'm sorry, I forgot to attach the pictures

alt text alt text

execution.png (268.1 kB)
avatar image Lardo Deepdelver May 13 '19 at 08:53 AM
  • Where is CE_Execute being called from?

  • Is the thing where CE_Execute is on (I assume the crystal) set to replicate?

avatar image tylobix May 13 '19 at 12:05 PM

The CE_Execute is linked to Event Tick

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

1 answer: sort voted first

Two things probably stop your crystal activation to work on all clients:

  • The variable Active needs to be replicated otherwise the clients will never find out that it got activated

  • CE_Process needs to only run on the server

that said, the whole control flow feels off, here is how I would suggest to fix it:

  • The event that calls CE_Process should be on either the playercontroller or the playerpawn

  • This event needs to be set to Run on Server (similar to multicast, just that the call goes from client to server, only works on actors the client owns so it will not work on the crystal)

  • The CE_Process sets the Active variable on the crystal on the server and call UpdateAcitve event

  • This variable is set to RepNotify (similar to Replicated, just that additionally it calls a function when it's value gets changed from the server)

  • In the OnRep_Active function (which automatically gets created when you set Active to RepNotify) call the UpdateAcitve event

  • UpdateActive is a new event that you create which checks the state of Active and does the stuff you want to do when Active gets set

This flow would not have anything on tick, and uses one RPC to server call + one replicated value ()

As a side node, the CE_Execute Multicast on tick is not a good idea, what it basically will do is every tick call all clients, who then have to figure out if something happened or not, so a lot of wasted calls + if you don't have a test if you are on the server it will be executed twice, once by being called from the server, and once by being called by the local tick component

... Long Answer, if you have questions I will try to help, but generally, I would recommend reading the Network compendium by Cedric eXi Neukirchen long but helped me a lot.

more ▼

answered May 13 '19 at 12:54 PM

avatar image

Lardo Deepdelver
941 6 4 6

avatar image tylobix May 13 '19 at 06:36 PM

Thank you very much! I'm not in this whole multiplayer stuff yet, so I do not know much about it yet

(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