Using Generic Shooter: How to implement a system that allows for specific characters depending on what team player is on?

Hi! I just recently bought generic shooter and am trying to customize it to my liking. Whether or not I use it to create a releasable game is not yet decided. With that said I am trying to implement a system for the team death-match game type. Currently when joining a match the player will enter a lobby, have the option to change teams and then when ready or out of time the player will spawn with the main character class with a set team color. What I would like to achieve instead is to have a menu option before each spawn, depending on the team the player is on, to give the player the option to choose a specific character, and then spawn. I will be able to give each character its’ own set of weapons and stats, I just need help creating the choice of character. Any help is appreciated, I have little knowledge on c++ but I am c++ capable.

Hey there, check this.

So, I know I said that I am cpp capable, turns out I was wrong. Is their a chance that you could explain what is being done in blueprints? I am currently taking a course on cpp and ue4 so I wasn’t lying, but it turns out I am unable to replicate that within this project.

I made a struct and a variable of it within the player controller being used, but I cannot seem to find a RestartPlayer Function inside the deathmatch gamemode class. Thanks for answering though, If i was better at c++ then the original answer would probably do the trick. Another issue is that all the classes within this project are blueprints, so I don’t even know how to edit them with code.

So the basic idea of the link that i’ve sent you is that in your custom game mode blueprint you should be able to override a function called GetDefaultPawnClassForController, which takes a player controller and based on that you can decide what is the character class that he’s going to spawn for that player. In order to make that decision you need to have a custom player controller and add to it a variable that tells what character the player has selected in the menu (lets say for now you have classes like medic, engineer and soldier). When you override the GetDefaultPawnClassForController if you cast the player controller to your custom player controller you should be able to access what class the player has selected, based on that you can do something like:

UClass* AYourGameMode::GetDefaultPawnClassForController(AController* InController)
      AYourPlayerController * PlayerController = Cast<AYourPlayerController>(InController);

     // 0 for Medic
     // 1 for Engineer
     // 2 for Soldier

     int32 PickedClass = PlayerController->GetPickedClass();
     UClass * Class = DefaultPawnClass;

     if(PickedClass == 0)
           Class = AMedicCharacter::StaticClass();
     else if(PickedClass == 1)
           Class = AEngineerCharacter::StaticClass();    
     else if(PickedClass == 2)
           Class = ASoldierCharacter::StaticClass();

     return Class;

Thanks for your help, but I messed something up that I’m unaware of then the auto save (I forgot to turn off) caught me off guard while trying to find it so I’ll be creating a new project most likely. I’ll try again tomorrow night after my computer finishes loading the new project.

Surething :slight_smile:

I got it, thanks!

Idk how to make this answer “Solved”

Just click on the check mark on my first answer, if you found it helpful you can upvote it by click the up arrow.