Download

Change a controllers pawn

Hello,

Im currently setting up an old school style arcade coop side-scroller. Everything is working peachy, I’m just not sure about how I would go about getting a different character to spawn per player. Ive been working with the engine for a while, but dont know a ton yet about the API, so I may be missing something that does exactly this or something to help me get there.

IE: I want characters to be selected for the player based on their Player Number. Just like the old arcade games. EG: Player 1 is ALWAYS blue, player 2 always yellow, etc. (Think the old simpson arcade game where homer was player one, marge 2, etc.)

Anyways, Im having trouble with figuring out what to use to change a players character. I’ve look around quite a bit and not quite found exactly what im looking for. I’ve had 3 ideas for how to get this to work.

Now, all of my logic is in C++ classes, I just have blueprints inheriting from them for my designer to change things if he needs.

Idea 1: In the character, under begin play, get the Player Controllers ID and change my Flipbooks to match the correct character. This is not what id like to do, as itll make for a pretty bloated character class.

Idea2: I have separate blueprints for each specific character, and theyre all just duplicates of the default one , just with updated stat changes and character animations etc. I’d like to have a way for the code to select the correct blueprint for the character pawn, based off Player number.

idea3: Override the RespawnPlayer() function in GameMode to spawn the correct player based on game id as well. This seems like the best option, but i feel like it would have a lot of drawbacks later on down the road. Especially as characters respawn or if I add in other logic for keeping items or something on level transition.

If anyone has a better idea, id love to hear it. I’m just looking for the right track on where to move forward. There may be a funciton or bit of code in the Engine for this specific purpose, and I just havent found it yet.

Basically I feel like theres something easy out there for setting a specific playerid’s default pawn at startup, and im making things way overcomplicated.