Download

How do I respawn a player in singleplayer?

Hello! I’ve been trying to find an answer to this question for some time, but the closest I can find is this:

[AnswerHub question]How to respawn a player in Blueprint? - UE4 AnswerHub

So, Shadowriver’s answer does make sense, and it sounds like a pretty usable solution.

But the problem is that I’m completely new to blueprint, and visual scripting in general, so I have no idea how to tell the game engine to spawn a pawn when the player character is destroyed, and then make the player controller possess that pawn. I also don’t understand how that pawn will know how to move just by being possessed by the controller. Because all my movement input scripting is in my character blueprint, so I don’t see how some random pawn will know how to react to the input from the controller.

Could anyone please explain this to me with a bit of detail, so I can understand it?

*A PlayerController is the interface between the Pawn and the human player controlling it. The PlayerController essentially represents the human player’s will.

One thing to consider when setting up your PlayerController is what functionality should be in the PlayerController, and what should be in your Pawn. It is possible to handle all input in the Pawn, especially for less complex cases. However, if you have more complex needs, like multiple players on one game client, or the ability to change characters dynamically at runtime, it might be better to handle input in the PlayerController. In this case, the PlayerController decides what to do and then issues commands to the Pawn (e.g. “start crouching”, “jump”).

Also, in some cases, putting input handling or other functionality into the PlayerController is necessary. The PlayerController persists throughout the game, while the Pawn can be transient. For example, in deathmatch style gameplay, you may die and respawn, so you would get a new Pawn but your PlayerController would be the same. In this example, if you kept your score on your Pawn, the score would reset, but if you kept your score on your PlayerController, it would not*

You may want to look at moving all your controls over to your player controller.

There’s a pretty nice walk-through on this exact topic in the UE docs: https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/RespawnPlayer/Blueprints/index.html

You really need to get your head about possession of pawns, spawning from a class, and the player controller, game mode, game state etc…

I mean, ultimately you could do it a number of ways. But have the player controller control things, the player controller isn’t going to die or go away

Most of this seems to make sense logically, so I’m sure it’ll help. Thanks for the input, guys!

I actually tried that one, but it didn’t work. Probably because it’s based on the third-person blueprint template, whereas I’m using a first-person perspective created from the blank template.