Unreal Inventory System Course - #12 Shop Buying and Selling

Sdílet
Vložit
  • čas přidán 26. 04. 2024
  • Many of our games will require some sort of inventory system! And let me tell you, there are too many ways to count to make something like that but today, lets take a look at how you can get started on building your own inventory system!
    This episode's project files:
    / unreal-inventory-10282...
    / @thegamedevcave
    Full course :
    / inventory-series-10031...
    • Inventory FULL COURSE ...
    Bonus Episode:
    / intenvory-bonus-100356841
    • Inventory Course : Bon...
    Finished Course Project files :
    / inventory-course-99591435
    / @thegamedevcave
    Join the discord for any help you need! : / discord
    Join this channel to get access to perks:
    / @thegamedevcave
    support the channel and development over on patreon : / thegamingcaves
    Get personalized Coaching : www.fiverr.com/s/2P9GaN
  • Věda a technologie

Komentáře • 11

  • @Duskyberry
    @Duskyberry Před měsícem

    Phew I made it to the end and one last bug I found was that if the last item in a stack was bought or sold the slot stack size was set to 0. This is fine but the money wasn't updating correctly because it was then trying to access the data asset in the slot that was now empty. I fixed this by moving the subtract funtion to after the money was updated so the money was being updated before the slot was being emptied.
    I found this tutorial to be very very helpful thank you so much! I learned a lot even if I found it hard to follow/adapt at times. Thank you for sharing your knowledge ☺

  • @Duskyberry
    @Duskyberry Před měsícem

    So I renamed the component in the shop inventory wbp from chest inventory to shop inventory. I finished the next bit of code then went to bed. This morning I spent 2 hours trying to figure out why it was accessing none from the inventory componet I was sure I had plugged in. I tried all sorts of things using my limited knowledge including delays all over the place. Just at the point where I was about to punch my pillow I thought to check the actor bp I had for the shop.
    Right there STARING ME IN THE FACE on the begin play the create shop inventory widget had a RED pin where I hadn't refreshed it to read 'shop inventory' instead of 'chest inventory' and hadn't replugged in the inventory component.
    I grimaced and fixed it. I then went to get more coffee. During coffee I went back over ALL my wbp's to put right all the messing about I had done in my attempt to find the issue.
    Now I am golden (but still getting more coffee).

  • @kmtsvetanov
    @kmtsvetanov Před měsícem

    Hello. I've done this couple of times. I followed all the tutorial. I'm having a difficult time to add one more thing.
    I wish to add 3 slots for weapons. On each slot I can have 2 weapons.
    Think of it slot 1 is for melee weapons.
    Slot 2 - range
    Slot 3 - Books.
    It may be to late to add this is this series but can you give me a hint if it can be done with this Inventory System?

    • @thegamedevcave
      @thegamedevcave  Před měsícem

      i've had some more questions like this so in the future i do plan on making a smaller followup series going over things like this!
      but for now, what you can do here is make a seperate inventory with 3 slots and then whenever you try to drag an item into one of those slots, in the widget check if the type of item (weapon/book/etc) matches the type that you want to allow in that slot. there's a few ways you can do that, in the inventory widget, inside the slot or by making a child class of intventory component that's specifically meant for this. I'd probably choose the last option but it's highly dependent on your game and how many different variations of inventories you need.

    • @kmtsvetanov
      @kmtsvetanov Před měsícem

      @@thegamedevcave Thank you. I made a child class of intventory component. The main idea is you can buy a weapon and when you place it on the weapon slot you now have the option to equip it. I created the new inventory but adding it to the WBP_PlayerInv is the hard part. As long as I get to see the new inv populate with WBP_ItemGrid I'll be happy. For now I'm not :D
      Looks like the WBP_ItemGrid is not happy:
      Blueprint Runtime Error: "Accessed None trying to read property InventoryComponent". Node: Bind Event to On Inv Changed Graph: EventGraph Function: Execute Ubergraph WBP Item Grid Blueprint: WBP_ItemGrid

    • @kmtsvetanov
      @kmtsvetanov Před měsícem

      ​@@thegamedevcave I actuadly did it! Steps:
      1. create child of BP_InventoryComponent (BP_InventoryComponent_Weapons)
      2. Add it to the player.
      3. Add new "Get Weapon Inventory" to the BPI_Interaction and add the interface to the player. (Same as "Get Inventory")
      4. Add new WBP_ItemGrid to WBP_PlayerInv and in the Graph add "PlayerWeaponInv" (Same as "PlayerInv"). Add the same login to the Event Pre Construst and Event Construct for setting the inventory component and for updateing the itemgrid.
      5. Pass the BP_InventoryComponent_Weapons to the WBP Plater Inv Widget from the player blueprint (in Event Begin Play)
      One important thing:
      6. For WBP_DropItem when you drop all (Left mouse button) and need to Clear Inv Slot we need to get it from:
      "Cast to DDO_DragInvSlot->Source Inv Comp -> Get Class" and then check with "Class is Child Of" for the BP_InventoryComponent_Weapons first (The child) and then the BP_InventoryComponent . With Branches and the return Values we can find who is the target we need to set for the "Clear Inv Slot".
      Now I can have as many inventories as I want!

  • @RevolverShot
    @RevolverShot Před 2 měsíci

    R u in 5.4?

    • @thegamedevcave
      @thegamedevcave  Před 2 měsíci +1

      this is in 5.1 i'm pretty sure. all recorded and uploaded way before 5.4 was released

    • @RevolverShot
      @RevolverShot Před 2 měsíci

      @@thegamedevcave oh nvm i thought bcuz u uploaded it 4 days ago it could be in 5.4. thanks tho! Nice tutorial, implementing the way in a little farm game xD

  • @iibool
    @iibool Před 2 měsíci +1

    Thanks so much Game Dev Cave, I wonder how many people made it this far.

    • @Duskyberry
      @Duskyberry Před měsícem

      I just did! After quitting and coming back to it 2 or 3 times