Transitioning to a new round when the current round is won

Now that we have a transition screen to display, we want to integrate it into our End Game sequence and combine it with the nodes that will increment the round each time the player beats their target goal. Return to the FirstPersonCharacter Blueprint, which is located inside the Blueprints folder of the Content Browser, to start working toward this goal.

Find the sequence of nodes you modified to branch between the win and lose menus that are triggered by the End Game Event. In the Branch node, disconnect the Create Round Transition Widget and Add to Viewport nodes from the False output execution pin, and then move them to the right. We will add nodes that increase the round by one and save that new round number in the save file, before displaying the transition screen. The Blueprint nodes meant for calculating and saving the current round number can be seen in the following screenshot:

Begin by dragging and dropping the Save Game Instance variable onto the grid below the Branch node, and then selecting the Get option from the menu that appears. Then, drag a wire out from this node and attach it to a SET Current Round node. Attach the input execution pin of this node to the False output execution pin of the Branch node. Next, we need to calculate the integer that will be set as the current round.

Drag a second wire from the GET Save Game Instance node and attach it to a GET Current Round node. Now, attach this node to an integer + integer node. Fill in the bottom input field with the number 1, and then attach the output pin of this node to the Current Round input pin of the SET Current Round node. Finally, store this information in the save file by dragging the third wire from the GET Save Game Instance node and attaching it to a Save Game to Slot node. Attach the input and output execution pins of this node and the SET Current Round node, and then fill in the Slot Name input field with BlueprintGameSave.

Next, we need to connect the Save Game to Slot node to the Create Round Transition Widget node, as seen in the following screenshot. We are now ready to test whether our round system is functional. Compile and save this Blueprint, and then click on the Play button to test:

When you load the game, you should notice that the target goal counter at the top of the game has a low number of enemies as the goal. Defeat the number of enemies indicated by the goal and you should see the round transition screen appear, displaying Round 2. When you press the Begin Round button, you will reload the level with your health and ammo restored, but with a higher number of enemies as the target. Defeat the number of enemies shown by the new target, and then you should be presented with the Round 3 transition screen. Finally, if you quit the game and then click on the Play button again, you should find that the game loads the round that you were last on.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset