Setting the weapon and equipment screen variables

Now that you have a weapon in your Weapons Data Table, we can set up a framework to equip this weapon.

Just like the items that you created, you can choose to populate the weapons in a shop, you can choose to allow weapons to be picked up automatically from other NPCs in the field, or you can make them enemy drops just like you did with gold. Whichever method you choose, make sure that the weapons end up getting populated in your equipment screen in a similar way in which the items got populated in your inventory screen. At the bare minimum, we will need the character to hold an array of weapons. Navigate to the FieldPlayer Blueprint and open the Event Graph. Then, add a new text array variable that is similar to the arrayItem variable that you created in the previous chapter, and call it arrayWeapons:

Setting the weapon and equipment screen variables

The major difference between the items and equipment is that we will be able to equip and unequip equipment rather than just using the equipment, so we will need to create a framework for this on our equipment screen. While we are in the FieldPlayer Blueprint, we can start creating this framework by also creating an equipmentScreen Boolean that we will eventually set to let the system know when the player is accessing the equipment screen. This will be needed when equipping weapons and armor just like the inventoryScreen Boolean was needed to allow the user to use items when accessing the inventory screen:

Setting the weapon and equipment screen variables

Now that the player can hold a weapons array and an equipment screen Boolean, we need to navigate to the Pause_Equipment Event Graph, and set the equipmentScreen Boolean to true when the event is constructed, and set it to false when the player leaves the screen. This is identical to the way in which we set the inventoryScreen Boolean in the Pause_Inventory Event Graph:

Setting the weapon and equipment screen variables
..................Content has been hidden....................

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