How to replicate a function without player character?

To try and explain this clearly, I have a plugin for interaction and i need to call the function “Set Interaction Duration” on my interactable component.


The problem is however, i need to do this on the server, and since all of my players are clients, this would not really work. I have tried many finnicky solutions to this, but from what i understand, i apparently need the player character to do any Server RPCs, and getting the player is a bit odd as i get no real direct way to do it with the plugin.

The latest method i have tried involved in me getting the hovering interactor component, then setting it’s owner (hopefully the interacting player) to the interactable owner.


Once i needed to call the “Set Interaction Duration”, i made an event which casts to the player character (taking the interactables owner as the object) and then executing an event from the player.

This event would get the hovering interactable, then set the interaction duration from there.
The only problem with this is the “Hovering Interactable” is seen as “none” on the server, and even setting it as a variable on the server using another event didnt seem to work.

In short, since this is probably confusing, i just want to replicate a function (that being “Set Interaction Duration”) in an actor which preferably has little to no relation to the player.

I should mention that if i use Listen Server, the interaction works perfectly, but breaks when a client interacts with it.
Also in case its needed, the interaction plugin used is here

or a player controller

while you hover the target you can get a reference to it, then you can call the RPC on the player controller which calls the interface by reference.

1 Like

or owned by it.
you can have an actor (invisible) that acts as manager, replicated, always relevant, that’s owned by the controller and it can work as well.
afaik that works well. i’ve used it in the past (if i haven’t mixed any detail).

1 Like

correct, usually even if you dont have a pawn as such you’d have some sort of camera which the player owns (which in essence is still the pawn ha)

i wouldnt mess with changing ownership on hover though

1 Like

I followed your advice, and made a seperate interaction manager, which is owned by the player controller, and to my knowledge - server events do work.
I spawned the manager in the level blueprint, then made a globabl variable referencing it in the game instance.
I then made an interface to request and accept replication.


(Interactable Actor)
This works for the most part, but the issue arises with server replication in the manager.

(Interactable Manager)
If i were to remove the owner, or remove replication for the event, the code runs fine and prints out “Works” on the client, however its on the client, and whenever i try to make server events run it just doesnt feel like working
I should also mention that using “Switch Has Authority” gave me an output of authority, but i dont know how important that could be.

I feel like im missing something about replication, but thanks for the idea nonetheless.

this is overly complicated, if you need a manager just spawn it in your player controller and set the owner to self (the player controller) or just use a player controller actor component then you already own it.

but then do you even need to spawn anything? why dont you just use the player controller?

Would c++ be an option?
Ideally, you should be able to send data with some net code off of anything. And in fact, your core problem appears to be the limits of blueprint.

Otherwise, the manger is the best way to go about it. You just need to make sure the calls to it can happen correctly, which I believe is where your latest issue is?

Try using inteface calls if you are stuck with blueprints?

they’ve changed that recently. you can only do rpcs from objects that follow a chain of ownership to the local controller. supposedly to avoid cheating by injecting code. afaik.

1 Like

I agree, this may be overcomplicated but anything else just doesnt seem to work.

but then do you even need to spawn anything? why dont you just use the player controller?

If i interpret this correctly, i set the interactables owner to the player controller (index 0) at begin play, and instead made it fire a server event.
If this is what im supposed to do, then i must be doing something else wrong, since it really doesnt want to replicate any server events no matter what i do.

no, i mean run the RPC actually on your player controller (or something owned by it, ie an actor component.

messing with the owner of an interactable is a bad idea and note beginplay runs on all clients so owner is set multiple times.

I think i managed to get it working (well enough atleast).
I will now detail the steps i took below, because why not.

First i created a new Player Controller BP, set it to replicate, and set it as my main player controller in the world settings.
Inside the player controller, i implemented an interface with one message, that being “Request Replicated Interaction” and has 2 inputs, being the Interactable Component Reference and the Time to Set. Then upon recieving the message it executes the code to be replicated inside a Server event.

Here is the code inside my interactable blueprint.

1 Like

nice, just note you shouldnt use GetPlayerController(0) for multiplayer, you should pass in a ref to the interacting controller. its probably fine for what youre doing now but could lead to issues in the future.

good luck