Random pawn possession at startup

Hi there

I am trying to make a multiplayer game. It includes 5 different characters that are already placed on the map.

What I want to do is when the game starts, each player must possess a random one of those characters to play with.

I also want to sort the pawns into a few groups, where each character may be in more than one group, but each group can only contain 3 characters. So that if only 3 players join the game, then it should fill a random group first. The groups I can probably make with arrays, right? But the array that should be filled should still be selected at random on start game. And in that array the characters should still be chosen randomly.

How do I pull of the random assignment of characters on startup?

I have no knowledge of C++, so it would be awesome if this could be done with blueprints!

I am very new to this, and I am probably biting off more than I can chew, but the community here seems extremely helpful.

Thanks in advance!

Sounds completely doable just in blueprints. For random assignment, you can use a “Random int in range” node and then use a switch on int, or a get index from array so that it’s always random.

Just begin with that concept in mind and I’ll try to help you sort things out if you are confused.

Since this is a learning project for you I’ll try not to do things for you. Good luck!

Finally managed to figure it out! At least, the most important part. Possessing a random character, and ensuring that that character cannot be possessed again.

But this only works when I play with one player. If I test play with two players, they can still possess each others characters, and the client seems like it’s bugging out. I use the third person models, and as soon as the client possesses a character, it just sorta floats mid fall animation.

All my variables are replicated.

If anyone knows of a better way, I would appreciate the advice!

check the blueprint respawn wiki that I wrote, try avoid player index as much as you can in a multiplayer environment.

I looked at the wiki, and I am still a little bit confused. Trying to sort it out to what I need for my project.

But the way I understand, is that the problem lies with the player controller, and the fact that it looks at index 0, right? So how can I make it look at whatever the player controller is that pressed the button?

The Blueprint that I attached is on the Level Blueprint, is that a problem?

yes, pretty much. But from your description you still need to read more about the networking part of thing and the framework.
Read the links in my signatures and then do it slowly from a player controller BP.