Announcement

Collapse
No announcement yet.

Have a BP be a child of two parents?

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

    Have a BP be a child of two parents?

    Hello everyone, I will be making my own custom inventory system, and I will be having a struct of item properties. I would like to have one struct that has universal things, like:

    •Item Name
    •Item ID
    •Item Description

    And then I would like to have other seperate structs for categories of items, like this:

    Food:
    •Heal Amount
    •Heal Rate

    Weapons:
    •Damage
    •Durability

    So what is the best approach to having it so that my food item blueprints have the universal struct, + the food category struct? Same goes for weapons.

    Let me just explain one more time. I want my blueprints to have a universal struct, and also a struct that corresponds with their category.
    This is my first time ever dealing with structs or inventories, so go easy on me
    Last edited by Jamendxman3; 06-12-2015, 05:56 PM.
    Marketplace Assets

    Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
    Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
    Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

    #2
    Hi,

    Think of it as one parent, two children

    Parent BP has universal struct, so all children will also have it.

    Then you add the custom structs to the children.

    So InventoryItem.bp -> InventoryItem_Child_Food.bp

    and InventoryItem.bp -> InventoryItem_Child_Weapon.bp


    Also you could add an Enum/String/Type variable to the parent blueprint, so you can take any item, identify it with a switch on itemtype, and then do actions corresponding to the item's type

    EDIT: I am also working on an inventory system, coincidentally, and the problem I've run into is that there is no way to instantiate an object of a class in blueprint without first spawning it in the world, just a heads up if you were planning on making an inventory system based on data tables.

    Comment


      #3
      Originally posted by Teatime View Post
      Hi,

      Think of it as one parent, two children

      Parent BP has universal struct, so all children will also have it.

      Then you add the custom structs to the children.

      So InventoryItem.bp -> InventoryItem_Child_Food.bp

      and InventoryItem.bp -> InventoryItem_Child_Weapon.bp


      Also you could add an Enum/String/Type variable to the parent blueprint, so you can take any item, identify it with a switch on itemtype, and then do actions corresponding to the item's type

      EDIT: I am also working on an inventory system, coincidentally, and the problem I've run into is that there is no way to instantiate an object of a class in blueprint without first spawning it in the world, just a heads up if you were planning on making an inventory system based on data tables.
      So if I had UniveralStruct.Bp, then I would make another struct FoodStruct.bp, and then any food items would be a child of FoodStruct, and a grandchild of UniversalStruct?
      Marketplace Assets

      Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
      Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
      Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

      Comment


        #4
        Yes, that's right. I'm not too sure if it's the best way to make the inventory though, I went down the same path as you but got stuck when I had to initialize objects to reference them in order to store them, let me know how it turns out !

        Comment


          #5
          Originally posted by Teatime View Post
          Yes, that's right. I'm not too sure if it's the best way to make the inventory though, I went down the same path as you but got stuck when I had to initialize objects to reference them in order to store them, let me know how it turns out !
          Alright, will do, thanks for the help!
          Marketplace Assets

          Advanced Mobile Input: Marketplace Page | Support Thread ――― Easy Input Remapping: Marketplace Page | Support Thread
          Multiplayer Blueprint Chat System: Marketplace Page | Support Thread ――― Closing Credits System: Marketplace Page | Support Thread
          Minesweeper Template: Marketplace Page | Support Thread ――― Maze Creator: Marketplace Page | Support Thread

          Comment


            #6
            I would definitely be giving datasets a look at rather than creating all of those stats on each individual blueprint and then on the blueprint when you drop it in the level or spawn it you would just select the row name and it would grab all the details to generate the item.

            For the categories to make it easier you could create an enum and then on your item choose whether it is food,weapon,etc. You could even add in the static mesh that you want and texture,colour etc etc straight in the dataset.

            Comment

            Working...
            X