Respawn Mechanic while Keeping Score

Hello All,

I am currently developing a game where I have implemented a checkpoint/respawn mechanic. That mechanic works great, however, when the player respawns whatever data is being tracked is erased and no longer tracks any data. What I want is for the player to respawn with whatever data was tracked before death and to be able keep tracking player data.

This is the event graph in the FirstPersonGameMode:

This is the event graph from a new blueprint (Respawn_BP) I made for the respawn call:

Here are some HUD widgets that keep track of player data. There are called KunaiDistanceWidget (how far player kunai is thrown) and KunaiThrownWidget (number of kunais thrown)


This is the data tracked before the player dies and respawns:

And after:


At this point, after the player respawns, the data that we see on the HUD is no longer being tracked.

The errors I get:

I hope I presented this as best as I could, if more information is necessary I can definitely provide that. Thank you.

A couple of hints:

  1. When you get the ‘none’ error, scroll to the far right and click on the last word. It will take you to the place where the ‘none’ is happening. Whatever you think about that piece of code, you are giving an unassigned variable to the process at that point.

  2. I don’t think it matters how carefully you design the destroy and re-spawn, nothing will get passed from one character to the other unless you specifically do it. The is what the game instance is for. You can pass values between the players using the game instance. When one knows it’s going to die, store data, new player reads data.

1 Like

Personally I’d store this type of data in either the player state or the controller… IF I don’t need it to persist to new levels that is. Otherwise Game instance for current session, then Save Game for eternity.

2 Likes

Thank you for the hints, both of you, I got it working how I want it to.