Download

How Can I Replicate an overlap?

https://forums.unrealengine.com/ewewfewfewfwefew
Hi, I was recently trying to make an ovrelap of a collision box replicable, I have been stuck in this obstacle for a long time, could you help me? Thanks

Hi, in most cases there is no need to replicate it. If the overlapping actor and the box collision both exist on the server and move the same on the serve as on the clients, then the overlap will also happen on the server and therefore there is no need for the client to tell the server. That is generally the way I would build the logic.

If for some reason the overlapping actor or the box collision is not existing on the server or not behaving the same on the server and for some reason you still want the server to know that an overlap has happened on some client, then you need a way for the client to tell the server that an overlap has happened and you do that via a RunOnServer event. But the only client that can call a RunOnServer event on an actor is the client that owns that actor. If any other client tries to call a RunOnServer event nothing will happen. Therefore you could reroute the event through something that the client does own (clients player controller or controlled pawn) or tell the server to set this client as owner of the actor (again telling the server from the player controller or the controlled pawn). But imho both ways are not optimal and therefore you try to build your logic in a way that the overlap automatically happens on the server and therefore removing the need for the client to tell it.

While they both exist in client and server, they not share the same location, well at least in UDK idk about UE4…

You may not need to replicate it, but if you want a multicast from server would be enough -> AddCustomEvent -> Choose run from server -> From this new event AddCustomEvent -> Choose Multicast then the clients they all will receive that event and do stuff with servers precision.

In the end I fixed this error, what I did was create another blueprint class (with the collision box inside of course) I set the overlap and I noticed that strangely one was replicable so I made the classic replicable spawn class ( two custon events one run on server and the other multicast) and it worked thank you