Back again with another Dev Diary for Project Grand Vault.
Havenlock City is the Hub that players return to inbetween ruin runs in Project Grand Vault. As you would imagine there are several ingame shops for players to buy equipment, and prepare for their adventures. Lately I have been neck deep in User Interfaces and the systems/interactions that they involve,this is breakdown on our Shop System.
Most shops in Havenlock city will only give the players options to BUY, some will offer you to SELL and even fewer will offer CRAFTING. These 3 options pretty much increase in complexity respectively. One of the shops that will offer all 3 is the Junk Shop, owned by the vendor Floyd.
Building off of our previous work involving the interactions with other actors (including conversations) we can proceed to build a the necessary GUI (or Widgets in UE4) elements that are required. Below you can see a picture of the flow between actors.
Our item pickups contain a structure of variables that help define the specific item.
Above you can see the structure of variables. This structure is applied to all Item Actors and their data is populated. On Character overlap these actors information is passed onto the active character and is added to the their Inventory. The active character's Inventory is actually an array of our Item Structure.
To add items to our inventory for example from buying items or crafting we can simply spawn the actor with its information at our active character's location and it will be added to their inventory.
But the complex part is limiting the quantity the player can purchase based off of available item space and meeting cost requirements for the items. For this I had some fuzzy logic to work out. Check out a snippet of the BP
While not the visually most intimating BP this for me was a struggle to find the right logic. Praise be to print strings
Thankfully removing items for discard, or selling is far easier. No limits on QTY or check for required funds. We simply populate the item class and the qty we want removed. If selling we add the value for those items to their wallet. Pretty straight forward.
The neat part is all of this data is pulled form the Item Structure!
With that in place we can execute our plan.
CHARACTER -> SHOP MENU
Using our existing character interaction source code, we create a new character actor, and set the initial components. As of right now we don't have a model for Floyd, so for now we will use our Police Officer with a blue grid material.
Once we interact with him it launches our Dialogue Tree which then leads to the opening of our Junk SHOP MENU. Below you can see the flow of the instructions that drive this interaction.
From this point here it was just a matter of setting up the Widget elements to work with and drive the logic we dictated above. Until we eventually reached the results in the video below.
And there we have it. I hope you guys enjoyed a look into the crafting of the buy/selling system for Project Grand Vault.