548 Game Development and Simulation with Unreal Technology
32. That is all we need to do to set up the MySaveGame blueprint at this point.
33. Now we need to save and load the game data in the Level Blueprint.
a. Open up the level blueprin t.
b. Locate the Setup Array logic (this is where we inclu ded each individual
Ball Spawner into the BallSpawners A rray).
c. We will need to use the Event Begin Play to load the game on star tup.
d. Create a Sequence nod e above the Setup Array network.
e. Disconnect the Event Begin P lay from the Set of the BallSpawners by
Alt+Clicking on either end of the connection.
f. Connect the exec(white) output of the Event Begin Play function to the
exec(white) input o f the Sequence node.
g. Attach the Then 1 pin to the existing Set Ba ll Spawners function.
h. Your network should loo k similar to Figure 8.47 so far.
FIGURE 8.47: Placing the Sequence for the Game Load/Save.
34. To make things easier, we can create a variable to store the name of the save file,
to make sure we do not a ccidently name it incorrectly in another location.
a. Create a String variable called SaveName.
b. Set the default value of this variable to Level01Save File in its Details
rollout.
c. We w ill also need a variable to temporarily sto re a reference to our save
game data.
d. Create a variable called SaveGameLocal and set its variable type to Save
Game.
e. Lastly, we need to store our current high score in a variable as well.
f. Create an integer variable and name it CurrentHighScore.
g. The default value for this variable should be left at zero.
35. The first thing we need to check is if the Save Game file exists in the default save
location.
a. Drag a wire off from the Then 0 and place a function called Does Save
Game Exist to the Then 0 pin on the Sequenc e node.