AI Character: No owning connection

When calling a server RPC on a character that is controlled by an AIController (like an RTS unit) will throw the following warning:

LogNet: Warning:
UIpNetDriver::ProcessRemoteFunction:
No owning connection for actor
RTS_Test_Character. Function Server_RPC_Foo will not be
processed.

This makes sense because the Player whom calls the RPC is not technically the owner of this actor, the server is. But, how can you make this work? How is this intended by Epic?

Note that someone gave me a c++ hack around it (by overriding the GetNetConnection() in every such actor that has server RPC calls and assigning the first PlayerController to it instead) but what is the ‘non-hacky-way’ of doing this?

1 Like

I would really like an answer to t his as well because im having the same problem.

2 Likes

Hello! Have you ever found a solution and are you willing to share that?
Thank you in advance and with kind regards,
Eric

Solved it. I confirmed that the AI is being run on the server and the server also own the AI. So I am able to call RPC’s and replicate back to clients from any AI. You just need to make sure that you are also not running it double on the client, because that can give you trouble. I thought it was doing that by default but it is not and is actually quite logical.

Can you send your code as to how you did these things? I’m getting completely spammed by this warning in my logs

Add a Switch has Authority before you are running any code on your AI. Use the authority to only keep it running on the server.

Sometimes you would want to run some things on the client as well or only on the client. That code can be connected to the remote.

1 Like