I have a scoreboard and score system set up, i want to add those values to a (Total) points) Please help

My skype is cjsavage56 (Dude with red shirt) if you feel you need to explain in detail.

I made a new variable for my player called Total_Points , and it is linked with the player score, I want the game to take the score I got, and add to the Total_Points, saving it(For the whole game). But i am unsure how. I want to do this so i can make a rewards system using the Total_Points .

121554-points.png

Here is how the Total Points is linked to the Total score or (Player Height)

  1. Create a structure called PlayerMapScore that contains the properties for the following: player name, player score.

1a. I would also store in the structure above the following information: map name, date time when map was completed/ended, number of jumps the player made (you can do some fun analytics on this data later in the game).

  1. Create a new class variable MapScore in the Player pawn actor and make it replicate. When the Player pawn actor is spawned in the world (BeginPlay) on the authority (Switch Has Authority), create a new instance of the PlayerMapScore structure, set the player’s name in the structure, default the score to 0 and store the structure in the replicated MapScore class variable.

  2. Inside of the Player actor when the player presses the jump key on the Authority (Switch Has Authority) get the MapScore class variable and increase the player’s Score that’s stored in the struct as desired. You could also execute this logic during the Event Tick if you truly need it there (just make sure you increment the score on the Authority only, this will prepare your game for network play).

  3. Add an Event End Play to the Player pawn actor and on the Authority (Switch Has Authority) save the current class variable MapScore to a custom GameInstance blueprint that is configured in Edit > Project Settings > Maps & Modes. You would call the AddPlayerScore(PlayerMapScore) function outlined below in step 5. at this point or manipulate the array directly if it’s publicly editable (not recommended).

  4. In the custom GameInstance blueprint there would ideally be a public function exposed called AddPlayerScore(PlayerMapScore). This public function would store the PlayerMapScore struct that is passed in into PlayerMapScore array in the GameInstance BP. This function should start with a Switch Has Authority, you don’t want network clients to manipulate it’s value.

  5. When the “High Score” level is started get the GameInstance BP and get all the PlayerMapScore structs (create a publicly accessible function in your GameInstance BP called GetAllMapScores()).

  6. Within the “High Score” level BP create a new local variable of type PlayerMapScore struct array (this could be a local variable within a function the “High Score” level or a local class variable in the “High Score” level for each player sum up their score across all the maps and display it. This variable will contain an array of structs (one struct per player) with each player’s summed up map score.

  7. When rendering the HUD table with the high scores read from the “High Score” level BP’s internal array of PlayerMapScore structs (this array is fed from the GameInstance’s array, but it’s “grouped by” player and sums up each player’s score).

Notes:

  1. The Authority should be the only one creating, updating and passing the the PlayerMapScore struct to the GameInstance BP.