Announcement

Collapse
No announcement yet.

Free Inventory System - Backend

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Free Inventory System - Backend

    Hello,

    i am curently developing a Inventory System for a game i am making. I want to share this thing for you, completely free. You can use it in any project you like without asking for permission (maybe a lil note in the credits would be nice but you dont have to).

    The whole System (so far) is a Backend for a Graphical User Interface, wich means its just the Code not the fancy Graphics (Yet).

    Blueprints & Co:
    The zip file needs to be extracted to your Game/Content Folder. Inside the folder you'll find (in the Contentbrowser) a rInventory Directory wich holds two more Folders (CoreBP, ItemBP), and the main Actor File (Inventory Actor).

    The "CoreBP" Folder contains a "Item_Master" Actor and a custom Structure.
    The "ItemBP" Folder contains a Sample Item Actor.

    Functions:
    Spawning the System / Setup (at Runtime)
    Click image for larger version

Name:	1.png
Views:	1
Size:	43.9 KB
ID:	1140845
    Just rightclick in your SpawningBP and chose a "Spawn Actor" Node, then for Class chose the "Inventory_Actor". The Actor by default is Hidden in Game so dragout a wire from the Transform parameter and use a "make transform". The Size pin represents the actual Size of your Inventory in Stacks (How big a Stack is depends on the Setup of the Item, ill explain this later).

    Useing the Inventory:
    Click image for larger version

Name:	Unbenannt-2.png
Views:	1
Size:	155.3 KB
ID:	1140846

    (Most of the Time you will use the Core Functions)

    Add to Inventory: This is your Bread and Butter Function to Add items to your Inventory.
    Target: Reference to the Inventory Actor
    Class: The Item you want to add
    Amount: How many Items you want to add

    Result = False if Inventory is full wich means the amount you want to add cant be added because there simply isnt enugh space

    Remove From Inventory: This will remove Items from the Inventory. (the first found in the inventory)
    Target: Reference to the Inventory Actor
    Class: The Item you want to remove
    Amount: How much of the Items you want to remove

    Result= False if there aint that much items as you want to remove

    Remove From Stack: This will Remove a certain Amount of Items from a Stack (or completely remove it)
    Target: Reference to the Inventory Actor
    Index: The 0-based(First item is at Pos: 0) Index in the Item Array
    Amount: How many you want to remove

    Result = Same as above

    [B]Reorder Inventory:[B] This functions combines all items/stacks wich can be combined.
    Target: Reference to the Inventory Actor

    Split Stack: Splits a certain Stack into two
    Target: Reference to the Inventory Actor
    Index: The 0-based(First item is at Pos: 0) Index in the Item Array
    Split At: If you Split a Stack of 15 at 7 the first stack will have 7 Items and the second one will have 8. Must be > 0 and smaller < than the stacks maximum

    Result: False if there is not enough space in the inventory to split

    [b]Combine Stacks:[b] Combines/Merges two Stacks into one. Or fills the target stack to the maximum.
    Item Max Stack: 15
    StackA: 5 Items
    StackB: 12 Items
    = StackA = 15, StackB = 2

    Item Max Stack: 15
    StackA: 5 Items
    StackB: 10 Items
    = StackA = 15, StackB = gets removed from the Inventory

    Target: Reference to the Inventory Actor
    IndexA: The 0-based(First item is at Pos: 0) Index of the Target Stack in the Item Array
    IndexB: The 0-based(First item is at Pos: 0) Index of the Source Stack in the Item Array

    There are also some Helper functions wich can be called.

    Get Item Data from Class: Get the data wich is stored in the Item Actors.
    You can modify this one to retrieve other data you specified in the Item_Master actor. (Ill explain this later)

    Target: Reference to the Inventory Actor
    Class: The Item wich holds the Data you want

    (See function nodes and Item_Master BP to understand the returned values)

    Get Item Count: Returns you the Amount of all Items of a certain Class in your Inventory.
    Target: Reference to the Inventory Actor
    Class: The Item of wich you want to grab the Amount.

    Result: False if no Item of the class could be found.
    Amount: The Amount of the speciefied Item in your Inventory.

    Customize & Add Items
    If you need any more Item Specific Properties edit the "Item_Master" Blueprint and add the Variables of the desired Datatype to the Blueprint (Graph Tab). You will also have to modify the "Get Item Data from Class" Function inside of the "Inventory_Actor" to be able to return those Values with the function.

    As for Adding Items you will create a Blueprint for every Item you want to create. IT IS IMPORTANT THAT YOU CREATE THAT BP OF THE "Item_Master" CLASS!
    Click image for larger version

Name:	3.png
Views:	1
Size:	73.0 KB
ID:	1140848

    After you are done with that. Open the created Blueprint and edit its default Values. Those should be self explanary.

    Thats it now you have a new Item you can add to your inventory.

    The Master_Item BP also has a Event "Use" wich you can override in every single Item to create a custom behaviour for every item. To use the "Use" event you would spawn an item of the desired Item Class (not the Master_Item Actor) and then simple call the "Use" event on that freshly spawned item.




    If you have any Questions feel free to ask them, i tried to document the BP-Nodes as good as posible. Ill try to help you as good as i can.
    If you find any Bugs please Contact me so i can remove them from the script.

    I did my best to design this thing so you dont have to deal with stuff like checking if there is space in the inventory and so on. You just add/remove etc and check if the action was successfull thats all.

    And lastly this thing is free as i said, but if you feel genereous you could tip at paypalxD.


    Oh... The Download =)
    https://www.dropbox.com/s/0jeyx8jaf9...ntory.zip?dl=0

    C++ Version!
    https://github.com/ruohki/Inventory
    Last edited by ruohki; 03-27-2017, 03:57 AM. Reason: fixed links
    Free Inventory System (BP AND C++ Version): Clicky Clicky
    Player Structure System (Houses!) (BP): Pew Pew Marketplace Version: Yoink!
    Howto: Create Dragable UMG Windows: Zoom Zoom

    #2
    How to use: An example.

    This is how you would spawn the Inventory and access its functions. You can also use the "Inventory Reference" Variable to access the inventory.

    The lower BP Stuff shows how you could access the inventory from any other blueprint (Cast the Player Pawn/Controller to the correct actor, asuming that the inventory is spawned & managed by the player character/controller/pawn)
    Click image for larger version

Name:	1.jpg
Views:	1
Size:	721.2 KB
ID:	1061262

    As i wrote above this thing is JUST a BACKEND. There is no Visual representation of the Inventory exept in the Scene Outliner
    Click image for larger version

Name:	2.png
Views:	1
Size:	188.5 KB
ID:	1061263

    Hope this helps to get ppl started
    Last edited by ruohki; 11-20-2014, 10:07 AM.
    Free Inventory System (BP AND C++ Version): Clicky Clicky
    Player Structure System (Houses!) (BP): Pew Pew Marketplace Version: Yoink!
    Howto: Create Dragable UMG Windows: Zoom Zoom

    Comment


      #3
      Thank you very much, this is great

      I'm getting a compile error however.
      I dropped the "rInventory" folder into my "Content" folder:
      Click image for larger version

Name:	explorer.JPG
Views:	1
Size:	59.2 KB
ID:	1061097

      Opened the project and tried to compile the IventoryActor blueprint:
      Click image for larger version

Name:	Nullfunction.JPG
Views:	1
Size:	157.0 KB
ID:	1061098

      Perhaps I'm overlooking something in the instructions?

      Thanks again.

      Comment


        #4
        aaaaah yes its the NullTransform node :S i did this in a C++ project. just remove the NullTransform node and replace that with a make transform

        or create a function lib bp and add a function "NullTransform" wich simply outputs a blank transform

        The Dropbox Download has been updated.
        Last edited by ruohki; 11-16-2014, 04:38 PM.
        Free Inventory System (BP AND C++ Version): Clicky Clicky
        Player Structure System (Houses!) (BP): Pew Pew Marketplace Version: Yoink!
        Howto: Create Dragable UMG Windows: Zoom Zoom

        Comment


          #5
          Originally posted by ruohki View Post
          just remove the NullTransform node and replace that with a make transform
          Great, that fixed the issue. Thanks!

          Originally posted by ruohki View Post
          The Dropbox Download has been updated.
          Hah, well I hate to keep being the bearer of bad news, but I'm afraid the updated version is worse off then the original.
          I downloaded the updated version, just see the difference and...:
          Click image for larger version

Name:	error.JPG
Views:	1
Size:	22.0 KB
ID:	1061103
          Click image for larger version

Name:	BP1.JPG
Views:	1
Size:	71.1 KB
ID:	1061104

          This may save you a few minutes if you want to use it to update your dropbox version:
          https://drive.google.com/file/d/0B0e...o0ZjQ0Ulk/view

          Comment


            #6
            This is weird the "Bad cast node " should be a "Cast to Item_Master" node and those 2 open wires should be conntected to it.

            I cant reproduce the bad cast node thing. Not in 4.6 not in 4.5 (I did use the Actor from the current dropbox file)

            Try to cast the Spawned actor to "Item_Master"

            this is what it should look like:
            Click image for larger version

Name:	Unbenannt-2.png
Views:	1
Size:	137.5 KB
ID:	1061105
            Free Inventory System (BP AND C++ Version): Clicky Clicky
            Player Structure System (Houses!) (BP): Pew Pew Marketplace Version: Yoink!
            Howto: Create Dragable UMG Windows: Zoom Zoom

            Comment


              #7
              Little update to show of whats doable. In this video iam useing the current Inventory System, just added some UMG Voodoo

              Free Inventory System (BP AND C++ Version): Clicky Clicky
              Player Structure System (Houses!) (BP): Pew Pew Marketplace Version: Yoink!
              Howto: Create Dragable UMG Windows: Zoom Zoom

              Comment


                #8
                Originally posted by ruohki View Post
                Little update to show of whats doable. In this video iam useing the current Inventory System, just added some UMG Voodoo

                That's an awesome use of widgets, feel like sharing the project to show how you achieved that?

                Comment


                  #9
                  I will include a very basic version of this ui in the free inventory thing. There will also be a pro version on the marketplace wich will include a whole ui for games. (Mostly rpg)
                  I plan on Making a game menu itself, unit frames, inventory, customizeable hotbars, buff/debuff frames, character screen including equiping of items, quest & dialog system and much more. I try to keep it all blueprint but maybe i need to include some custom c++ stuff for wich se source also be included
                  Free Inventory System (BP AND C++ Version): Clicky Clicky
                  Player Structure System (Houses!) (BP): Pew Pew Marketplace Version: Yoink!
                  Howto: Create Dragable UMG Windows: Zoom Zoom

                  Comment


                    #10
                    Originally posted by ruohki View Post
                    There will also be a pro version on the marketplace wich will include a whole ui for games. (Mostly rpg)
                    ...
                    I try to keep it all blueprint but maybe i need to include some custom c++ stuff for wich se source also be included
                    Just keep in mind that at the moment, if you want to sell anything on marketplace, it can't have any C++ code included. So either not go that way, or you would need to wait for Epic to open that up.

                    Comment


                      #11
                      Wow, thank you for sharing this it's awesome!
                      Trevor Lee

                      Comment


                        #12
                        Originally posted by Hyperloop View Post
                        Wow, thank you for sharing this it's awesome!
                        thank you very much. Please dont hesitate to report any bugs you might occur... Or feature requests

                        Originally posted by Farshad12 View Post
                        Just keep in mind that at the moment, if you want to sell anything on marketplace, it can't have any C++ code included. So either not go that way, or you would need to wait for Epic to open that up.
                        I wasnt talking about precompiled stuff
                        Last edited by ruohki; 11-19-2014, 01:24 PM.
                        Free Inventory System (BP AND C++ Version): Clicky Clicky
                        Player Structure System (Houses!) (BP): Pew Pew Marketplace Version: Yoink!
                        Howto: Create Dragable UMG Windows: Zoom Zoom

                        Comment


                          #13
                          Well done! I will test it with an easy HTML Front-End using the VaQuoleUI Plugin. Maybe I can post it as an easy example.

                          Game Design - Photogrammetry - Programming
                          Tutorials · Twitter · Twitch

                          Comment


                            #14
                            Originally posted by SchnitzelDude View Post
                            Well done! I will test it with an easy HTML Front-End using the VaQuoleUI Plugin. Maybe I can post it as an easy example.
                            Thats nice iam curently working on a UMG Frontend for this inventory. Iam also changeing some stuff "under the hood" in the next 2 days, to make it easier to work with frontends.

                            I added a little Tutorial in the Second post because i got asked how to actually use this thing.
                            Free Inventory System (BP AND C++ Version): Clicky Clicky
                            Player Structure System (Houses!) (BP): Pew Pew Marketplace Version: Yoink!
                            Howto: Create Dragable UMG Windows: Zoom Zoom

                            Comment


                              #15


                              little update. Ill upload the latest Inventory Blueprint this evening. Want to prepare a little UMG Integration to showcase how this will work with umg
                              Free Inventory System (BP AND C++ Version): Clicky Clicky
                              Player Structure System (Houses!) (BP): Pew Pew Marketplace Version: Yoink!
                              Howto: Create Dragable UMG Windows: Zoom Zoom

                              Comment

                              Working...
                              X