Inventory system is done! Kind of!

I don't want to go on too long about what I have just done with the inventory system, but all being well, aside from the occasional bug that I am still looking to fix, it will be done, and I can start on the game world mechanics such as a day/night cycle, a calendar, and in-game time.


Whenever the player picks up an item, there is a boolean called "Show Obtained Notification?" If this is enabled, the player will receive a small pop-up telling them what item they just obtained. If it is disabled, the item will still be added to the inventory, it just won't show the notification.


There is a sort button (on the mouseover) (also, custom mouse pointer!) that when clicked will organise the inventory by the enum to the left, clicking it again will trigger a flip-flop and reverse the sort (From A-Z, then Z-A)


It will sort by the item's category (What order they appear in the BP_MasterItem Category Enum)


By the amount of items in a stack (From 99-1, then non-stackables.)


And by the item's name (Default Z-A, this is one of the small things I aim to fix before release)


Dragging items that are usable (CanBeUsed bool =1) onto the hotkey at the bottom will allow the player to use whatever is in that hotkey slot by pressing the hotkey in blue (Underscore needs fixing, it's either underscore or numpad- which are both big and out of place and cause the grid to become misaligned)

This also showcases the map widget, currently not functioning as I have not built the levels these buttons will lead to, but the buttons will serve as a quick-transport to the desired level. The small white parts at the bottom of the map are unintentional and will be fixed later, although currently this is a very minor thing, getting the levels built and the buttons working first will be more important

A very minor bug that sometimes crops up with the main inventory as well, is that each slot has styles for when they are default, and hovered over. As you can see, I hovered an item over slot 4, and didn't put anything inside of it. However, the button style didn't go back to its default that can be seen on the rest of the buttons.


Using the sword that was in slot 3 will equip it, taking it out of the inventory, storing it as a variable on the TopDownCharacter and equipping it as a skeletal mesh to the characters joint. Pressing D will return it to the inventory and take it off of the character mesh.


There are also merchants that allow you to sell your unwanted items, and to buy other items they may be selling. The offered items is an array of items with values that can be changed in the items respective blueprint. As the map will be an important method of transportation for the player, I have made it so every merchant will sell a map for 0 gold. Over the top of this is the sell widget that only appears whenever the player tries to sell a stackable item that has 2 or more items in the current stack.

This is also a basic currency system.


If an item is too expensive, the gold text will be set to red, and the purchase button will be disabled. This is updated every time the amount to purchase (number between the + and - buttons) is changed. For items that are not stackable, such as the map, there is only a button to purchase. Should the player want to purchase multiple non-stackable items, they would have to click one at a time, and I plan to have it set out that the player will never require many non-stackables of the same type, but should the need arise, the purchase multiple buttons can be added.


As previously mentioned, I set the ShowObtainedNotification to be true whenever buying from a merchant, but this can be disabled at any point. Buying two wood took the cost away from the players current gold, and because the player can no longer afford two wood, the text is set to red and the purchase button is no longer clickable.


As with the sell widget for stackable items, there is also a near-identical widget for discarding a stackable item...


...and splitting a stackable item into smaller stacks that can then be dragged on top of one another to rebuild a larger stack.

Typical inventory shortcuts in most RPGs, such as dragging an item out of the inventory, will delete it, or bring up the discard widget if the item is stackable. Similarly, if you hold shift when you drag an item over an empty inventory slot, the split stack widget will show, but only if the item is a stackable. Dragging an item into an empty inventory slot will move it to that inventory slot.

Although there is no in-game way currently to increase the amount of item slots in the players inventory, a blueprint has been implemented so that every time the player presses "N" they will gain 4 more inventory slots. This is mostly as a debugging and testing method, this function would most likely be called on events such as levelling up or certain quest milestones.


If an items category has been marked as "Quest Item," then the player can essentially do nothing with it other than move it around or add it to the players stash. There are no shortcuts for removing the item, nor is it sellable, and the action menu is collapsed to show that fact. The action menu pops up whenever the player right clicks an item in the players inventory.


What would Adstus Fabrica be without its crafting system? Well, okay, I've still not come close to setting up the crafting mechanic, as it requires me to start working on skill trees and a spellbook, which I do plan to implement down the line. For now though, to prove the basics of a crafting system, the items the player can craft are displayed on the left hand side. Clicking on one will show the required materials for crafting one, as well as a big "Craft" button.


Clicking the craft button will remove X amount of items in the players inventory (The number on the right) and add the item to the players inventory. Again, the obtained notification is set to true, although this can be disabled.


If the player does not have the required materials, the materials they are lacking will be displayed in red, and the craft button will be disabled.


The player also has access to a stash, or a storage, or a player bank, whatever you would want to call it.
Dragging an item into an empty storage slot will store it, and the storage chest is just a duplicate of the players inventory, just with many functions and unnecessary variables taken out. This does mean that if the player closes the chest, the items will be stored.

Although extremely basic, there is a saving and loading system that will save and load certain variables I chose to save, such as players inventory, players gold, PickupIDs and the storage.


When a player approaches a pick-up actor, a widget will appear above the actor displaying the name and amount of items if appropriate. Once the player interacts with the pick-up actor...


...then not only will it destroy itself and give the player its item, but the pre-assigned ID of that pick-up actor will be added to an array on the top down character which contains a list of all the IDs that have already been picked up. Whenever the level loads, or the game loads, the game will check this list of IDs against the IDs that are placed within the level. For each matching ID, that actor will be destroyed on the level load, to avoid the player picking up multiple items.


The main BP_inventory has many, many functions.


And the project has many widgets as well. This is only one core mechanic, and I can expect many more to come as I further flesh out Adstus Fabrica.

Project Management

There is exactly one month for me to crack out the small mechanics of the world, and then sort out the main crafting system. Ideally, I would like to get the crafting mechanics sorted out first, as that would include the abilities, spells, a spellbook widget and talent trees, and although the demo idea behind Adstus Fabrica is a short amount of time to play as a demo (In-game days) it wouldn't be the end of the world if the player can play for an unlimited amount of time without the day-by-day progression. In terms of using this as a portfolio to showcase what I can do in unreal, more widgets and ability implementations will definitely get me more noticed than a day/night cycle.

So, for that reason, I am aiming to spend roughly 3 weeks on this crafting system. There is a good chance it may not take as long as 3 whole weeks when I can spend about 3-4 hours per day on this project, although this inventory system did get a bit complicated and take longer than intended as well. The result I would say was definitely worth it, however my lack of in-depth knowledge of programming can only allow me to make estimates of how long certain things could take.

I want to leave at least one week, if not longer, to the smaller mechanics, importing all the custom assets I created over March, and developing the games levels. This doesn't necessarily have to be the last week before the games debut, and I can see myself doing some of these smaller tasks in between larger tasks of the crafting mechanic.

Comments

Popular posts from this blog

Architecture - Blueprint Inventory Part 2: Inventory Functionality, Drag and Drop

Architecture - Blueprint Inventory Part One [Long Post!]