x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How would I Create an Inventory System with Blueprints?

I'm a complete noob when it comes to programming or game design.

I intend to create an inventory system in the vein of the STALKER series, it will be limited by weight and item size.

From what little I do understand I will need to create an array then add to it and remove items as well then eventually tie it all to a UI. But I want to get the logic down before I get into that.

I guess my questions are:

  • Should my inventory array be in a separate blueprint or in my character blueprint and not in my GameMode? (probably a silly place)

  • Should my array contain just actors?

  • Will I need some sort of database to organise potentially hundreds of items?

  • What is the best way to connect my inventory to my character so when I pick up an item it is added to my array?

Product Version: Not Selected
Tags:
more ▼

asked Apr 20 '14 at 07:02 AM in Blueprint Scripting

avatar image

Althaen
166 13 19 32

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

1 - Put the inventory in a different class (or Blueprint) of its own. Blueprints are technically equivalent to C++ classes in UE4, so the same Object-Oriented design rules apply here as well.

2 - Your array should contain "inventory items". This will, again, be a new class, which specific items will inherit from.

3 - Hundreds is nowhere near big enough to start considering databases. If you have tens or hundreds of thousands, it might be a different story though.

4 - Create an inventory variable in your player class (that is, a variable of the inventory type you defined in 1). Redirect interactions with objects to that inventory object.

End of the day, what you're asking here is: "how do I handle this or that object"? The answer to that question has been the subject of much debate in the field of object-oriented computer programming. I would strongly recommend against attempting anything too big with Blueprints if you're not familiar (at least to some extent) with Object-Oriented programming. I'd recommend you to learn a bit about it first. Even if you don't want to do that, keep this one rule in mind: your code must represent, as closely as possible, real world objects and their interactions, including their different functionalities.

more ▼

answered Apr 20 '14 at 08:12 AM

avatar image

Arshia001
549 31 36 164

avatar image Althaen Apr 20 '14 at 08:27 AM

Quick question, should my inventory BP be an actor class or is that just Epic's set up? When creating a BP it asks you for a parent class.

avatar image Arshia001 Apr 20 '14 at 08:37 AM

To the best of my understanding, that is "just epic's setup". I think it might have something to do with networking, but I've never invested much time in multiplayer games, so I wouldn't know. However, the fact remains that Epic's guys know how best to use their own engine, so I try to do everything like they do, believing they had a reason for doing it the way they did.

avatar image Shadowriver Apr 20 '14 at 01:49 PM

Looking on old inventory apis from UE3 might give you some ideas http://uncodex.com/2012-03/engine/inventory.html <-item class http://uncodex.com/2012-03/engine/inventorymanager.html <-inventory menager, which is kind of like backpack class

avatar image Althaen Apr 29 '14 at 07:26 AM

Where should I put the array?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I'm not sure if anyone has linked this yet, but a fellow by the name of Tom Looman has released a two part tutorial on object interaction/basic inventory system. Very much worth the time it takes to walk through it. Hope this helps!

http://www.tomlooman.com/tutorial-multiplayer-supported-usableactor-system-in-blueprint/

more ▼

answered Jun 24 '14 at 04:03 PM

avatar image

GabrielDamato
136 13 15 25

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question