Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building an RPG  with Unreal 4.x

You're reading from   Building an RPG with Unreal 4.x Get to grips with building the foundations of an RPG using Unreal Engine 4.x

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher
ISBN-13 9781782175636
Length 360 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Alan R. Stagner Alan R. Stagner
Author Profile Icon Alan R. Stagner
Alan R. Stagner
Steve Santello Steve Santello
Author Profile Icon Steve Santello
Steve Santello
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Getting Started with RPG Design in Unreal FREE CHAPTER 2. Scripting and Data in Unreal 3. Exploration and Combat 4. Pause Menu Framework 5. Bridging Character Statistics 6. NPCs and Dialog 7. Gold, Items, and a Shop 8. Inventory Population and Item Use 9. Equipment 10. Leveling, Abilities, and Saving Progress Index

Setting and getting gold instances


While we move on to making a shopping interface, via the Shop button, we must first be able to pull the currency in order to pay for items in the shop. In a previous chapter, we discussed and made placeholders for gold, but we did not actually create gold values. In this game, we would like gold to be dropped by enemies at the end of battle. In this case, enemies will need some sort of gold data that we can add to the player's gold data (eventually, items will need this gold data that is tied to them as well). In Chapter 4, Pause Menu Framework, we created a pause menu that has a gold placeholder, and we will now add gold to this pause menu.

First, let's add a Gold property to FEnemyInfo.h. Navigate to Source | RPG | Data, open FEnemyInfo.h, and add a Gold property of an integer data type to your EnemyInfo table, as follows:

UPROPERTY( BlueprintReadOnly, EditAnywhere, Category = "EnemyInfo" )
  int32 Gold;

We now need to tie the Gold property with our standard...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime