Chapter 5. Bridging Character Statistics

Now that we have a basic framework set up for our pause menu, we will now focus on the programming aspect of the pause menu.

In this chapter, you will learn how to link character statistics to the pause menu, as discussed in Chapter 4, Pause Menu Framework. By the end of this chapter, you will be able to link any other game statistics you would like to a UMG menu or submenu. We will cover the following topics in this chapter:

  • Getting character data
  • Getting player instances
  • Displaying stats

Getting character data

At this point, the pause menu is fully designed and ready for data integration. In Chapter 3, Exploration and Combat, we had developed means to display some player parameters, such as the player's name, HP, and MP into CombatUI through binding Text Blocks with the Game Character variable in order to access character stat values held within Character Info. We will do this in a very similar fashion, as we did in the previous chapter, by first opening the Pause_Main widget and clicking on the Text Block that we will update with a value.

In this case, we have already designated locations for all our stat values, so we will start with the HP stat that we named Editable_Soldier_HP:

Getting character data

Navigate to Content | Text, and click on the drop-down menu of Bind next to the dropbox. Click on Create Binding under the drop-down menu:

Getting character data

Once you have completed this process, a new function called Get_Editable_Soldier_HP_Text_0 will be created, and you will automatically be pulled into the graph of the new function. Like in previous binds, the new function will also automatically have FunctionEntry with its labeled return:

Getting character data

We can now create a new Game Character reference variable that we will again name Character Target:

Getting character data

Then, we will drag our Character Target variable into the Get_Editable_Soldier_HP_Text_0 graph and set it to Get:

Getting character data

Next, we will create a new node named Get HP, which is located under Variables | Character Info, and link its Target pin to the Character Target variable pin:

Getting character data

Lastly, link the HP stat in the Get Editable Soldier HP Text 0 node to the Return Value pin of the ReturnNode. This will automatically create a To Text (Int) conversion node, which is responsible for converting any integer into a string. When you are finished, your Get_Editable_Soldier_HP_Text_0 function should look like this:

Getting character data
..................Content has been hidden....................

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