Download

How to enable a client via listen server to possess a spawned pawn?

Hello UE4 masters!

I come in great need of your expertise. I am looking for a way to enable the client to spawn a custom pawn, and then within the same player blueprint possess the newly spawned pawn. Attached is an image of my failed attempt to enable the client to possess the newly spawned pawn (Pawn 2). I recently upgraded my project from UE4 4.76 to UE4 4.10. The client spawn-possess system worked in the 4.76 version of UE4, but not in 4.10. Any suggestions?

No one? Does anyone know how the Possess function would work with a client? I can’t even cast to my gamemode from the client successfully just to perform a simple print screen.

Clients can not cast to the GameMode as the GM is server-sided only. Just for basic testing, you can create an integer variable inside the GameMode and increment it every time OnPostLogin is run. Then you check if it’s equal to 1, if true - this means it’s the listen server since they will always log in first. If false, this means a client logged in.

So if it returns false, you can spawn the pawn and then use the New Player pin of OnPostLogin to possess that pawn.

Thanks for your response! On another note, I don’t think this will work for me. Reason being, what I am trying to do is have the client (after the client has already been spawned) spawn a new pawn and be able to possess the pawn by means of player input. I just need to somehow be able to use the Possess function with the client to possess a client spawned pawn.