Posses a pawn as a client on dedicated server

How do I posses a pawn as a client human controller when connected to a dedicated sever? My setup works in single player and on a hosting player but as I understand my RPC calls don’t work in a dedicated server environment because the pawns are owned by the server. How are you supposed to create enter-able vehicles that are owned by the server?

You can have server function call from Player Controller to Posses the vehicle.

This is my set up, you can do something similar to the way i do to switch vehicle, but right now it got error when exit the car.

Thanks, I’ll give that a try.

I just realised something, this solution wont really work long-term as I’d have to define a million different interaction variations within my player controller. I want to use my “Use” key for pushing buttons, opening doors, pulling levers, entering vehicles etc. Surely this graph should be defined within the object you wish to possess?

Yes, this just fast prototype, I have a special solution for this but it require coding though, i make some special interact component for any object i want to interact, then in object blueprint i can create a new event and bind that to special function in component, when player walk over it will allow player to press interact key then trigger that special function along with event bind into it.

For blueprint only you can do this too, make event dispatcher in player controller blueprint, every time you press it will call that function and from other object you can bind that function with object blueprint event, it will do the same. You will wanna to add overlap comp so when you walk over it will bind event and end overlap it will unbind it, so you only activate whatever you want.

Kind of long explain but i suggest you look for how to use event dispatcher, it’s super useful.

Thanks, that sounds a lot like the solution I’ve been mulling over in my head but wasn’t sure how to trigger an event in the player controller on overlap of the vehicle/button trigger volume. I’ll have a look into event dispatcher and let you know how I get on.

Well I managed to make some progress but things are still not quite there, my characters are able to enter/exit the vehicles but the vehicle movement doesn’t seem to be replicated to the other client despite the server actually carrying out the movement operations. If I make the players swap vehicles after having moved them the true(server) location suddenly updates on the client. WTF?!?!

If I set the vehicle as the default player pawn in a custom game-mode everything works perfectly which suggests there is still something wrong with the way I’m doing the possession.

Seems the vehicles that I was remotely controlling were too far away in my level. I moved them A LOT closer to the origin and suddenly I can see the vehicle moment and fired projectiles appearing on both client’s. Seems proximity is a factor? Proximity to what though?

How about make an interface . Inside of it, make a function “Interact” (or w/e you want), and then every object you’d want to be able to interact with (openning it, picking it up, moving, etc) would have just to implement this interface and its functions. Each class would have its own implementation of that (or these) functions from your interface and would handle interaction on its own.

I have this working now. I was trying to resolve the question.

PS: thanks for your response though, my solution has this in place :slight_smile:

Oh… didn’t see your last comment. xD

Took me long enough to respond :stuck_out_tongue:

I got it sorted in the end. Using an interface I was able to request control of a player pawn from the Client to the Server.