Chapter 9. Equipment

In the previous chapter, we covered how to create useable items, populate them in a store controlled by an NPC, allow the player to buy items from the store, and use those items from their inventory. In this chapter, we will continue from where we left off by offering the player weapons and armor to equip themselves with.

We will cover the following topics in this chapter:

  • The weapons Data Table
  • Setting the weapon and equipment screen variables
  • Creating the weapon button
  • Revisiting the equipment screen
  • Setting the equipment screen Text Blocks
  • Correcting character stats when equipping

The weapons Data Table

Now that we have a decent framework for item creation, it will be very easy to create equipment. Since the Items Data Table reads all of the stats of the party members so that the stats can be modified if an item is used, we can expect equipment to modify all of the same stats; therefore, we can use the same structure for the Equipment Data Table, as we did for the Items Data Table.

So, at this point, we will create a Data Table for weapons by clicking on Content Browser and navigating to +Add New | Miscellaneous | Data Table:

The weapons Data Table

Next, we can pick the Items Data structure since we will be calling the same data in the Equipment Data Table as we did in Item Data Table:

The weapons Data Table

Then, name the Data Table Weapons:

The weapons Data Table

We will use this Weapons Data Table to populate every weapon that we plan to equip on a character in the game. For now, we will only make a Data Table for one character's weapons, but you can use all of the following steps to create more weapon Data Tables for additional characters.

You can now open the Weapons Data Table, and just like our Items Data Table, we begin with creating data by clicking on the Add button and then naming the data. In this case, we will make our first weapon, a dagger, and then give the dagger some stats. Since the dagger is a weapon, we will just need to modify the ATK stat. Since we are keeping our examples simple, we are not utilizing other stats that many other RPGs have such as accuracy and dexterity because we do not have accuracy or dexterity in our RPG framework. However, if you decide to add these additional mechanics to your game later on, you will want to modify the appropriate stats in your Data Table that are associated with your equipment. You may also want to give the dagger a gold value if weapons hold a resale value in your game.

The weapons Data Table
..................Content has been hidden....................

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