Download

Executing server event not working for client

So basically what I currently have is a door that is set to play an animation whenever a player overlaps the boxtrigger and presses an input. I’m trying to replicate this to players that don’t have network authority but it doesn’t want to execute the “on server” event that fires the Multicast door opening event.

This is the blueprint for the door parent class:

And this is the blueprint for the door class itself:

The actor holding this script needs to be replicated and has to have a valid owner set (use node “set owner”). Otherwise clients can’t call server events on the actor.

Okay that works, but it doesn’t work well when there’s more than one player in the box trigger. Currently it sets the owner every time a new player overlaps, but is there any way I can set multiple actors as owners and solve that problem ezpz?

Edit: I tried to do the above and it works to an extent, but it still seems too resource-heavy for a simple door being opened/closed in multiplayer. I’ve read that the RPC should be in the player bp to begin with, but I’m not sure how this would work with multiple different types of doors each with their own triggerbox. Would I need to check the overlapped assets every time the player presses E, or make it just trigger an action on the player whenever they overlap the box?

Did I mention I was new to UE4?

Oh, my mistake. Level events can be replicated in the Gamemode blueprint. But I am actually unsure how to do this. I have a silly method of interacting with objects in the world that involves a Interface blueprint that the player uses to trigger scripts in an interactible object. That object then shoots another interface function back at the player. The player then jumps through the "run on server’ and “multicast” events, then shoots a final interface function back to the object which is now firing on all clients.

I’ll show these working in step by step then I’ll post the interface at the end if you needed to reference it.

First is interfacing to the player. In this case I save off a reference when I first grab an object and then, when I push my interact button, I interface to that player.

The player then jumps through a “run on server” event then a “multicast event” then interfaces back to the object. There are multiple sets of these nodes here because this way I can allow more than one type of replication for the interactible object.

Finally, the event returns and fires off the appropriate event based on the integer that I send from the start.


The interface has nothing to it. Just a bunch of differently named functions so that I can have more choices for replicating. Whether all I need is a “run on owning client” or a “run on server” to “multicast” and exclude re-firing on the initial client, and whether or not the action should be rpc reliable.

Okay, I’m a bit confused so bear with me. Currently in my door parent bp I have a door mesh and a trigger box. I set up an interface to get the player controller from an input actor. Of course the server has network authority so replication and event triggering works fine on that. For the client however, he’s unable to trigger the execute on server event despite being assigned as owner to the door he is overlapping. Both the actor and character are set to replicate.

Edit: I just tried setting the owner via the overlapping actor node of a triggerbox and it works fine for the client. The set owner node doesn’t work in the interface event on the door blueprint; code after it still fires.

The interface is nothing special, just one function with one input.