Possess after serveltravel doesn't work

Hello,

I have an issue with possession and server travel.

I have the above blueprint running in the gammode that gets loaded after servertrvel executes. However, the possess at the very end doesn’t seem to function. All the players just get their views set to the map origin. From the map origin, the player starts are visible, and I can see that the spawn actor part is working working the characters are all being spawned in. It is just the final posses node at the end that doesn’t seem to be firing.

Replacing the OnSwapPlayerControllers with OnPostLogin and running 2 instances in the editor window for the destination map causes no issues. So it looks like I have specifically having an issue with the OnSwapPlayerControllers node.

I have placed a Print String just prior to the possess, all the player controllers and actor names get called correctly entering into the possess node, so i really can’t figure out what the issue is.

Any help would be greatly appreciated!

EDIT: After a little more testing, it appears as though it is the Default Pawn class that is being possessed and not the one that I spawn/state in the blueprints

Does spawn character need to replicate to the clients?

I have the exact same code running in the lobby (LobbyGameMode) of the game, but instead of OnSwapPlayerControllers, I have OnPostLogin which works fine.

I Copied the code across and just replaced OnPostLogin with OnSwapPlayerControllers. With the game running on two machines, I can see that both machines are spawning the character into the level, it’s just not being possessed.

Don’t know if that info helps any more?

it didn’t work pls help me

In my experience, it SEEMS like each machine has its own PlayerController (not replicated) to represent the Player connection(replicated), so maybe passing the PlayerController through the RPC is what is not working - it finds the object and it’s valid, but it’s not the one they’re looking for, maybe?

Also beware that playercontrollers and playerstates and gamemodes don’t all construct on the same tick, so the one you’re looking for might not exist or be initialized right away.

I might be way off in the weeds with this one but it’s something you could check on. I just tend to have a lot of problems with trying to use PlayerControllers directly in RPCs. I have better luck going the long way around, using the PlayerState->PlayerId and then looking for which PlayerController has that unique ID, and using that one.

However you might have a perfectly working thing here, and it just doesn’t have the correct PlayerController class set in the world settings or the project settings or the GameMode that is the default of the project settings.

If you are reading this answer and looking for the solution as a learner, I’m glad to tell you because it was really drive me crazy for hours.
The Possess node doesn’t work because the gamemode bp will override the pawn after you set if you set possess immediately when its begin , so the solution is add a Delay node to let your settings work!
The other code you can refer to the picture above.

1 Like

In addition to this, be sure that character spawning is done on PlayerController, not on the GameMode or PlayerState, solved the issue for me this way.