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"

Inventory pickup class storage

I'm working on the inventory system and came up with the question. Say, all pickup items are various children of base pickup class and one item placed in the world was picked up by a character. How does storage of an item would work? I can imagine item having an inventory slot number integer that would be set upon pickup. After item is picked, it simply gets hidden and it's collision gets disabled so item is not visible in the world. If item is needed to be dropped from inventory, it just gets visible and collidable again with updated drop location. I guess, that would work, but what if new level is loaded? Loading new level would destroy an item and there would be no way to drop it back because dropping is just a re-positioning an item. Coolest way would be to destroy an item upon pick up and just store it's type in item slot unit. If item needs to be dropped, it gets casted to a stored type and is spawned in the world. I have no idea how to make a type storage without using if's and strings. (i.e. if string is "ball", cast to ball_type). Sorry for a wall of text.

Product Version: UE 4.9
more ▼

asked Oct 04 '15 at 10:24 PM in Blueprint Scripting

avatar image

74 12 17 24

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

1 answer: sort voted first

That's actually fairly easy.

You don't need the type of the class. It's not important to know what the name is. What do you need to spawn something? The type or how it's more often called: The class.

So what you need to save is the class of your actor / item object which you find via a simple "Get Class" from your object reference.

Cheers :)

more ▼

answered Oct 05 '15 at 08:29 AM

avatar image

5.9k 291 86 293

avatar image Unteroid Oct 07 '15 at 12:10 PM

Thank you very much, sir. GetClass function just blown my mind so it was impossible to do such thing in vanilla C++ without using boost or something. Incredible useful function.

(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