I have been looking, but i do not understand how to make selectable characters, or really how to "posses" anything
As the title states, i can get a character to move, but i do not understand how to simply change characters
Lets say i want to make something that has multiple turrets, but the player can only control 1 at a time
How do you go about making that character "control" that object?
I have tried using the posses function, but im either not getting it right or i am using the wrong function
LIke, my ultimate goal is to make multiple selectable characters that i can spawn in (think like tf2, pyro, heavy, ect) and then give them the ability to either man turrets, or what have you, and i want to understand how i should be telling ue4 to fire the interactions between these characters
All help would be massivly appreciated, i have been searching around i have not been able to find something this simple in like 6 hours of searching
asked Aug 20 '14 at 02:34 AM in Using UE4
Are you looking to use blueprint or c++? I can show you how it's done in blueprint but if you're using that, but for future reference you should specify your question category as either c++ or blueprint.
Regardless, here's my BP solution, it will look messy and complicated but I will just try to be elaborate as this annoyed me as well.
There are two main things to understand here, the playercontroller, which is the interface between the player and their character, and the character. So while the character may die or respawn the playercontroller will remain. Think of the playercontroller as representing the player themselves who may be manipulating various characters or vehicles.
I don't know how your setup is, but chances are you'll want to create your own playercontroller, make a function for possession like mine here: http://puu.sh/aZWIX.jpg
I created a variable in the playercontroller called "possessed character" and a variable in the mycharacter class called "control" and by setting each one, you can access them in either's blueprint.
So all you need to do is call that possession function, using event begin play and likely after the character dies and is respawning. Instead of spawning mycharacter and possessing it though, you could use a switch statement and spawn any kind of character you want and possess it the same way. You might want to make a menu in UMG where you can select which class you want to spawn as. I would probably make a separate function for controlling turrets but it will work basically the same way, except instead of spawning a character and possessing it, you'll get the variable for the turret and possess it. There are a few things I can't advise you on because I don't know the specifics of your game design (do players disappear when manning a turret? Do they get inside it? Can you switch between turrets on the fly? Do you possess nearby turrets or pick them off a menu?)
The last thing to do is to set the player controller under "world settings" (which is on the right side of the editor by default) in the game mode information to the player controller you created so your code will actually work.
Let me know if this helped or just confused you more, or if I misinterpreted your question. Start by just getting your own playercontroller to possess your character and work from there.
Under the blueprint menu at the top, select game mode create, and in that gamemode you get to choose the default pawn. It's this default pawn which is what you will automatically possess when you start playing. Under world settings you choose which game mode to use. That is all that is necessary. Other things to take control of input are necessary in different scenarios but shouldn't be necessary unless something else is stealing them away
So in your map, you place down a player start and what will spawn there when you hit play is the default pawn. In that default pawn's blueprint you need to put functions with what to do with your inputs.
Be sure to set up your inputs in the project settings and don't "hard code" them into your blueprint.
Good luck. This was a major stumbling block for me when I started
answered Aug 20 '14 at 04:33 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here