Download

Using Player Controller in Tandem with a Character Blueprint

Hello everyone, I am needing to use a player controller to store my character’s variables so that they persist through death, but I am unsure of how I use a player controller along with my character blueprint. How do I “link” the two? I currently just have my character blueprint with all movement and variables setup. What code would I need to move to my PC? Thanks ahead of time!

Player Controllers possess Pawn based blueprint classes like the Character which contain basic movement functionality.

Im not fully sure i understand your question, in what way are you needing the to link and for what to occur?

Death can be pretty abstract in games. You dont need to delete the entire Character for it to be dead, the Character and all its variables can be persistent through the level, the physical ingame representation of death is all that needs to be shown (No HP, loss of movement capabilities, perhaps even hiding or moving the Character elsewhere).

By link, I mean that I need each PC to store variables for it’s associated character BP, as far as I know, the built in UE4 death thing clears all player variables, which is why I would be using the PC to store those variables.

Why use the default “Death” then? Pretty easy to just do some tweaks. You should probably just destroy the pawn and recreate it rather than the player controller.

Im assuming the data he wants to keep is on the Pawn, so destroying it isnt ideal. My point i raised earlier about Death in games being more abstract attempts to solve this issue. Instead of actually destroying the Pawn when it dies and thus destroying the data on it, just simply unpossess the Pawn, move it to a location that is out of sight and then reset any specific things that class the Pawn as “Alive” when you need it to be in such a state again.

Another solution would be to just handle anything you want to be persistent for a specific character on the Player Controller itself, that way you would only have to worry about reading those values from the PC and not have to be concerned with them being destroyed when the Character is dead or becomes irrelevant.