Hi everyone! I’m writing here more often then I should but this is my only hope
Today I’ve implemented respawn system. As you can guess it uses Actor destroying in certain situation and then spawn new character in particular place. It works pretty well but I found out the score that player got earlier resets and items that gives score are still picked up and aren’t on the map anymore.
So I want to keep the score after player’s dead. Is there any possible way to transfer this score from destroyed actor to a brend new?
Hi @FL1PPY19, you can create a custom Player State blueprint and set the score inside it. So even if the player character dies, your score variable will remain intact and there’s no need to add any additional logic to handle it. Plus you can access it from your HUD class (get Player Controller >> get Player State >> Cast >> Get Score).
Also, make sure to set this new Player State as the default Player State class in your Game Mode.
So I did something like that. I cast my coin that gives score to Player State instead of to Player. And i deleted variable in Player and created variable in Player State. Is that ok?
Yes since you have the variable in the Player State now, you won’t need it in the Player Character.
Now inside the “Get Text 1”, delete the cast to Player Character and use the following node setup: Get Player Controller >> Get Player State >> Cast to your Player State class and Get the Coins Amount variable.
In the overlap, you can cast the “Other Actor” to your Player Character (since your character is the one overlapping and not player state), and then use the same set of nodes I mentioned above, but with an additional step to Set the Coins Amount (which you’ve already added).
Hi @FL1PPY19 I am doing a school project and encountering the same problem, I can’t figure out by following all the helps above, could you please share your finished blueprint, thank you very much!