Download

Help replicating an Overlap event

I’m a complete noob to replication so I’m likely doing everything wrong but I can’t figure out how to get an overlap event to destroy an actor in multiplayer. Everything works fine in SP but it doesn’t work client side which is confusing because I’m telling it to run on the server. It’s just a physics object that is hitting the trigger and supposed to be destroyed. I didn’t think you’d have to replicate everything in the environment but apparently you do? Both the trigger component and the physics object mesh have Component Replicates set to true but it always says the Switch Does Not have authority.

Switch Has Autority is just a “branch” to know or to choose what happen when something is called, if the code is called on the server then that will be the authority, if a client call it it will be executed on the client side, in this case the actor overlap so is the client to call that, this is why you receive always “Not Authority”. you need two custom event, one is Execute on Server, the second one is a multicast, you tell the server to destroy the actor, the server destroy it but in this case only the server know that the actor has been destroyed right? So now you can call the multicast event at the end of the Execute on Server event, with the multicast you tell other clients that the actor is actually destroyed.

try to go inside the overlap with the server as a player and you will notice that him have the authority.

Certain events are replicated by default on replicated actors like Spawn and Destroy. If you call “spawn actor from class” on the server it will also spawn on the client, and if you destroy the actor on the server it will also be destroyed on the client.

Other events like “attach to actor” is not replicated and needs to be replicated manually with perhaps multi-cast.

This is interesting.

If that is the case then why isn’t my actor being destroyed client side? This is exactly my scenario. The actor has been spawned and then I apply physics and then I’m trying to destroy it with a trigger when it falls below the acceptable level but it’s only being destroyed server side.

Have you checked “Replicates” on the Actor in “Class defaults”?

“Component Replicates” is used to replicate variables and events inside components. This has nothing to do with Actor variables and Events.

Thank you so much. That was the problem :slight_smile:

You’re welcome :slight_smile: .