How can I place pawns to dedicated locations in multiplayer lobby?

Hi,

I’m using listen server for my lobby map and I’d like to place the player pawns at specific places.
For instance, imagine I have a kind of chess grid and I want to place the player pawns on each cases.

Each time a new player joins the lobby I want to place the pawns automatically.
The pawns cannot be moved by players, it’s just for display during the lobby.

I’m using blueprints, and I wrote the code in the GameMode with OnPostLogin. The host is correctly placed because it’s the server, but when other players join, they stay at the PlayerStart location.

How could I make the server place the other pawns? Aren’t the pawns location replicated automatically?

Could someone give me a hint on how to get it working?

Thank you in advance

There is a FindPlayerStart and ChoosePlayerStart functions in your GameMode that you can override in order to choose where each player should be placed.

Hi, thank you for the answer, I didn’t precise it sorry but I don’t want to use the PlayerStart.

I want to use 1 PlayerStart to spawn the pawns and then move them to the place I want, like a vector location.

Just create an actor class and drop them in the spots you want. In the GM FindPlayerStart function add code to get all actors of class (your custom point). This will give you an array of those points.

You can then get a copy for anyone of those points, then get the location of it (vector).

Thank you,

Is it mandatory to use FindPlayerStart?

I can move the pawns after the players have spawned?

You don’t have to use those functions.

So I followed your instruction with the FindPlayerStart and I can get the vector I wanted:



But the player isn’t placed to the point still:

My main problem is not getting the right place, it’s to place the player at this point, it seems it doesn’t work, what am I missing?

EDIT: I could make it work in the server (S) but the client (C) doesn’t see his player moved, it is still in the default start location, even if it is set to replicate location:

So why the pawn location isn’t replicated in the client instance? And how can I overcome this?

So, when login 3 players I can see all players placed correctly on every clients excepts the current client.

For example, the player 2 can see the player 1 and 3 placed correctly but not his own pawn.

So in the game mode I called an rpc on the pawn to place it directly on the client and now everyone is placed properly.

But it seems the replication update isn’t working properly for the client’s own pawn, even when calling Force Network Update on the pawns…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.