How to Make an Inventory System in Godot - Looting Items (#3)

Поділитися
Вставка

КОМЕНТАРІ • 152

  • @Crisisdarkness
    @Crisisdarkness 4 роки тому +19

    Thank you friend, your channel is very valuable, the inventory system that you have been advancing is something that impresses me, I'm sure that your channel in the near future will have many subscribers, you are doing very well, thank you for making this kind of content

    • @Arkeve
      @Arkeve  4 роки тому +4

      Thank you so much! I appreciate the very kind words!

  • @Allyourmonkeys
    @Allyourmonkeys 4 роки тому +7

    Wow, this is an amazing series of tutorials. A bit fast for someone like me without deeper knowledge of coding but the gist is easy to get and the potential is amazing. Thanks and please keep up the good work! You deserve a bigger audience and I'm glad I found your channel!

    • @Arkeve
      @Arkeve  4 роки тому +1

      Great to hear!

  • @Snafuey
    @Snafuey 4 роки тому +8

    Please don't stop making tutorials. You are very good at it. Thank you!

  • @benchampagne5266
    @benchampagne5266 4 роки тому +7

    This is brilliant. Just amazing I can’t believe how efficient this is. Thanks so much!!

    • @Arkeve
      @Arkeve  4 роки тому +2

      No problem! I'm happy you found it helpful!!

  • @coolbarryo1852
    @coolbarryo1852 4 роки тому +44

    in the initialize inventory function, you need to put a [1]) at the end of the last line of the function shown in the video. took me a few hours to find that bug

    • @GamerReborn1979
      @GamerReborn1979 4 роки тому

      What does this fixes?

    • @ahmadzaenunfaiz4700
      @ahmadzaenunfaiz4700 4 роки тому +3

      Omg, i fix my problem by seeing this comment. Thanks

    • @jenilamansalapus9782
      @jenilamansalapus9782 4 роки тому

      thanks bro! I've been solving that problem for almost a month then I saw your comment

    • @jomarllamas7890
      @jomarllamas7890 4 роки тому

      @@jenilamansalapus9782 hey how did u fix it

    • @KaceyTime
      @KaceyTime 3 роки тому

      Perfect, thank you!

  • @slowik1986
    @slowik1986 4 роки тому +4

    Greetings from Poland! Cant wait for next part :) I want to use your method not to build inventory system(not for now) but to create team management system in my game. Instead of drag n' dropping items I want to move heroes between slots. There is no Godot tutorial for this(or at least I could not find it, it looks like no one is creating any sim game with deep team management in Godot). So hope that in next parts you will be covering hero equipment slots, making use of item stats and also removing items from inventory etc. Just keep on making those vids, they are really great.

  • @willaxesawian9242
    @willaxesawian9242 4 роки тому +1

    oh my god dude thaaaannnnk you!!! I've been figuring out how best to implement a inventory systen for the pass month and this is literally the best one I've seen so far

  • @arithmetic1938
    @arithmetic1938 4 роки тому +5

    Good video, glad to see more Godot tutorials are being created. :D

  • @ginoleeswan1454
    @ginoleeswan1454 4 роки тому +9

    Thank you!! Now we need removing and using the items 🙏🙏

  • @paulwingbermuehle4872
    @paulwingbermuehle4872 4 роки тому +1

    Better then everything else I've seen. Please continue this series. Maybe equipping different weapons or using consumables next? Thanks again! Subbed!

    • @Arkeve
      @Arkeve  4 роки тому

      Thanks for the kind words :)

  • @mattn64
    @mattn64 4 роки тому +1

    Great tutorials! Glad to find a quality new Godot channel.

  • @GamerReborn1979
    @GamerReborn1979 4 роки тому +3

    am ready for the next tutorial. Next to fix the duplicated items when dragging and reopen the inventory and the most important is equipping the character the items from inventory. I hope you continue giving this tutorials and thanks

  • @futilefoxx6512
    @futilefoxx6512 4 роки тому +30

    Here is a modified script for people who are trying to make more of a top-down rather than just left and right.
    Item Drop Script:
    const acceleration = 460
    const max_speed = 225
    var velocity = Vector2.ZERO
    var item_name
    var player = null
    var being_picked_up = false
    func _ready():
    item_name = "Example Product"

    func _physics_process(delta):
    if being_picked_up == true:
    var direction = global_position.direction_to(player.global_position)
    velocity = velocity.move_toward(direction * max_speed, acceleration * delta)

    var distance = global_position.distance_to(player.global_position)
    if distance < 10:
    queue_free()
    velocity = move_and_slide(velocity)

    func pick_up_item(body):
    player = body
    being_picked_up = true

    • @Roberto_Liao
      @Roberto_Liao 4 роки тому

      you know how to drop item when enemy dies?

    • @futilefoxx6512
      @futilefoxx6512 3 роки тому +3

      @@Roberto_Liao sorry for doing this 3 months after you asked this question, but my guess would be to go into your enemy script create a new function called DropItem() or something and call the instance function to instance the item to the parent of the enemy. it might look like this:
      DropItem():
      var dropitem = get_node("ItemDrop")
      var DROPitem = dropitem.instance()
      self.get_parent().DROPitem
      btw I wouldn't use my code, this is just off the top of my head and I havent tested it before. This was just for an explanation. Sorry couldn't get a really good answer, im in a bit of a rush at the moment of typing this.

    • @baconator2391
      @baconator2391 2 роки тому

      i can only make it move left and right

    • @alessandragaspar3335
      @alessandragaspar3335 7 місяців тому

      hi, do you have an updated version for godot 4?

  • @rl_ledge9284
    @rl_ledge9284 4 роки тому +3

    YES I WAITED SO LONG, thank you mate :)

    • @Arkeve
      @Arkeve  4 роки тому +1

      No problem!! Hope you find it helpful

    • @enriquemateo9364
      @enriquemateo9364 4 роки тому

      Heyy can someone help me? I have an issue while loading my proyect, because It says that the función pick_up_item doesnt exist in muy charakter node. Can anyone paste his Code so that i can find a solución please it would be really helpfull @rl_ledge

    • @rl_ledge9284
      @rl_ledge9284 4 роки тому

      @@enriquemateo9364 did you actually make the function? no typing mistakes? did you put the function in the right node?

    • @enriquemateo9364
      @enriquemateo9364 4 роки тому

      @@rl_ledge9284 hey men thanks for answering, everithing os right It was only a tipping mistake

  • @hamzailer
    @hamzailer 4 роки тому +2

    great job I'll be waiting for the next one! :D

  • @crashannburnFPV
    @crashannburnFPV 4 роки тому +1

    This is just what I needed! Been fighting with unreal engine for far too long now. And all the incomplete tutorials out there is just draining the fun out of even trying.
    This is just pure joy! Thank you so much for making this!
    Will you continue this tutorial with things like a chest and a hotbar?

    • @Arkeve
      @Arkeve  4 роки тому +2

      I plan to do a hotbar within the series, and maybe a chest as well later on!

    • @crashannburnFPV
      @crashannburnFPV 4 роки тому

      @@Arkeve What a marvellous news! I'm looking forward to that. :)

  • @Forgetkt
    @Forgetkt 3 роки тому

    Your a live saver my friend trying to make a bit of a Zelda might make devlogs, thank you man

  • @jomarllamas7890
    @jomarllamas7890 4 роки тому +6

    Can someone help im stuck at 12:13 it keeps on telling me that nonexistent function in kinematic body

    • @paltzis7295
      @paltzis7295 2 роки тому

      OMG I JUST FIXED IT!
      My PickupZone was on the World layer in Collision settings
      It should be on no layers and mask should be ItemDrops

    • @thebluemarshmallow7644
      @thebluemarshmallow7644 2 роки тому

      @@paltzis7295 I hate when that stuff happens HAHA

    • @spellcards
      @spellcards Рік тому

      needed this

  • @bigcheesetaste
    @bigcheesetaste 3 роки тому +1

    I think it makes more sense for the player to have a dependancy on itemdrop than itemdrop to have a dependancy on player. If you wanted items to get picked up by things other than the player, or the pickup magnet logic to change, I could see this being an issue. It also makes more sense semantically that a player picks up an item, rather an item places itself into the player's inventory.

  • @adamwhittome3563
    @adamwhittome3563 4 роки тому +1

    can't wait for part 4!!!!!

  • @MrMutluOne
    @MrMutluOne 4 роки тому

    Woah straight up what i wanted, nice vid man

    • @Arkeve
      @Arkeve  4 роки тому

      Thanks! Hope its useful :)

  • @mrsentixy8196
    @mrsentixy8196 4 роки тому +2

    why mine already has a name in inventory? I did all he did, all my script is correct, but when I open my inventory, the name is already showing up

  • @darkhunter777
    @darkhunter777 6 місяців тому

    Why in 18:46 4 items drop more 4 ? 😁How delete item from bug ? Demolish value + texture ?

  • @coolbarryo1852
    @coolbarryo1852 4 роки тому +1

    also PLEASE make a part 4 that fixes the inventory not updating

  • @MinecraftxPigs
    @MinecraftxPigs 4 роки тому

    Thanks for all! keep up the good work

    • @Arkeve
      @Arkeve  4 роки тому

      Thank you!

  • @IustinNitza
    @IustinNitza 4 роки тому

    Thank you for these videos !

  • @SKtheMage
    @SKtheMage 4 роки тому +1

    Thanks! if you could, could you also do a tutorial on how to make inventory that is always visible?

    • @Arkeve
      @Arkeve  4 роки тому +1

      There wouldnt be much change. I guess you would remove the button to toggle the inventory and move the inventory to the side. Unless you are talking about a hot bar, which ill implement in later videos

    • @SKtheMage
      @SKtheMage 4 роки тому

      @@Arkeve oh lmao i didnt know that its called hotbar. Thanks!

  • @zerotohero6402
    @zerotohero6402 4 роки тому +1

    Waiting for the next serie

  • @puppymagnet8269
    @puppymagnet8269 3 роки тому +2

    for some reason my labels are displaying the name along with the quantity, like, instead of just saying "3" it says "[Wood Log, 3]"

    • @IvanCamposOfficial
      @IvanCamposOfficial 3 роки тому +4

      just happened to me but luckily just found the fix!
      so in the initialize_inventory function you need to add a [1] at the end of the second PlayerInventory.inventory
      so that line of code would look like this.
      slots[i].initialize_item(PlayerInventory.inventory[i][0], PlayerInventory.inventory[i][1])
      when before it looked like this:
      slots[i].initialize_item(PlayerInventory.inventory[i][0], PlayerInventory.inventory[i])
      hope this helps!

    • @smai697
      @smai697 3 роки тому +1

      @@IvanCamposOfficial Thanks bro you're a life saver

    • @Miltyism
      @Miltyism 3 роки тому +1

      @@IvanCamposOfficial perfect, thank you!

  • @fakename7423
    @fakename7423 4 роки тому +1

    Where’s the next one? How do you fix the problems at the end of the video?

  • @samumusic1552
    @samumusic1552 3 роки тому +2

    Nonexistent function 'pick_up_item' in base (player.gd). Please help me

    • @paltzis7295
      @paltzis7295 2 роки тому +2

      OMG I JUST FIXED IT!
      My PickupZone was on the World layer in Collision settings
      It should be on no layers and mask should be ItemDrops

    • @miklas37
      @miklas37 2 роки тому

      @@paltzis7295 Thank you so much! It really worked and I couldn't figure it out on my own

  • @jvstAsYouAre
    @jvstAsYouAre 4 роки тому +1

    For some reason, the item name also gets displayed on the label for me. Any help?

    • @jvstAsYouAre
      @jvstAsYouAre 4 роки тому +3

      Ok, the explanation is that in the initialize inventory function you could not see that it ended on inventory[i][1] and not just inventory[i]. I'm sure that I could have deducted that, but if you just following a tutorial it is pretty hard to come to that realization.

    • @Fr0styIsHere
      @Fr0styIsHere 4 роки тому +1

      @@jvstAsYouAre thx man I was wondering that, ur a genius

    • @phunq_
      @phunq_ 3 роки тому +1

      Thanks a lot, had the same problem and spent half an hour trying to find the bug haha

  • @Vexatious00111000
    @Vexatious00111000 Рік тому

    Strange, i dont get any errors but the items following you when I press the pickup key doesnt work at all. Im wondering if its because im using a newer version of godot

  • @RC-qz9ye
    @RC-qz9ye 11 місяців тому

    Hey I don't know if anybody has seen this video lately but I am having some trouble with the code. I keep getting an erorr saying that the set_item func command doesn't work. Anytime I pick up an object and then attempt to open the inventory. I am really hoping somebody can respond with some help :)

  • @Yoni123
    @Yoni123 3 роки тому +1

    how to do this so it works with gamepad not mouse?

  • @DinomaxProductions
    @DinomaxProductions 11 місяців тому

    When i pick up items, the item quantity is not increasing, anyone know how to fix this?

  • @RamHomier
    @RamHomier 4 роки тому

    Ha nice I just learned what canvas layers are for. I never used them and wondered why many demos I saw have them. I understand now I don't use them because I don't have a 2d world. My game is only an interface.

  • @kuroshiro9234
    @kuroshiro9234 4 роки тому

    It's been a while since you posted the last tutorial video... Still wait for the next video and I hope all goes well with you.

  • @jvstAsYouAre
    @jvstAsYouAre 4 роки тому +1

    Breh you doing me dirty af holding out on me with that part 4 tho, just sayin

  • @come1836
    @come1836 Рік тому

    Hello, are you still active? because I have a problem and I want to know if I will have an answer

  • @alzioo
    @alzioo 4 роки тому +1

    How to check if slot is full in inventory?

  • @ThePansGames
    @ThePansGames 2 роки тому

    hello, I love your tutorials, recently I was following this saga to learn how to make my inventory but my game is for android, until now I had no problem, until this tuto, it turns out that caundo I run it from the PC everything works perfectly, but when I do it from the phone it does not do what I should do, for example on the PC the sword (axe in my case) does not appear the number of items q has in the stack but on the phone the stack comes out, the same happens with the potions q I put in the world, I pick them up, and when I am going to join them the stack changes the text and says null in the two without q can be put together, can you help me ?

  • @bradenschmidt3588
    @bradenschmidt3588 2 роки тому

    My slot1 works and updates, but none of the other slots do. Even if I manually code in some items in other slots, they do not appear. Does anyone know what might be causing this?

  • @lars_99
    @lars_99 4 роки тому +2

    is a part 4 coming?

    • @Arkeve
      @Arkeve  4 роки тому

      Yeah, just been busy with some other stuff. I'll try to get it out soon.

    • @lars_99
      @lars_99 4 роки тому

      @@Arkeve okay

    • @fakename7423
      @fakename7423 4 роки тому

      @@Arkeve , it’s been 4 weeks... you still good?

  • @seemarajput779
    @seemarajput779 4 роки тому +1

    plzzz make more parts.....we need that...plzzzzz🙏

  • @ragnarhagberg6716
    @ragnarhagberg6716 3 роки тому

    This does not work for me when exported to windows. I think my code cannot access the JSON file

  • @SilentFire08
    @SilentFire08 4 роки тому

    If i Wanted it so you only had to stand above it how would i do it i guess changing the if "pickup" is pressed but what would i change it to

    • @Arkeve
      @Arkeve  4 роки тому

      So kind of like auto pickup? You would just remove the check to see if the pickup button was pressed. Remove the if statement

    • @SilentFire08
      @SilentFire08 4 роки тому

      @@Arkeve Sadly when i try to run it says that "Invalid call. Nonexistent function 'pick_up_item' in base 'KinematicBody2D (Player.gd)'."

    • @HOOETAUnReaL
      @HOOETAUnReaL 4 роки тому

      @@SilentFire08 for me it actually starter working when I had every single collission layer was set on the right place

  • @ernestomercado8176
    @ernestomercado8176 4 роки тому

    sir, it seems that your code has a bug, everytime that i put the sword or the slimepotion out of his original position it generates more elements, i have a solution for this, can i fix the bug?

    • @Arkeve
      @Arkeve  4 роки тому

      Yup it does, i mentioned at the end of the video that ill go over fixing this in the upcoming tutorials. If you know what to change feel free to do so in your project!

    • @ernestomercado8176
      @ernestomercado8176 4 роки тому +1

      @@Arkeve ok, thanks!

  • @teresamartinez2357
    @teresamartinez2357 3 роки тому

    What is the "Dictionary" in the tutorial? Can you explain me?

  • @blackmoon1534
    @blackmoon1534 4 роки тому +1

    part 4 pls

  • @tridra5714
    @tridra5714 4 роки тому

    can you make a way to use the items in an inventory

  • @davenvideosxd
    @davenvideosxd 2 роки тому

    i deleted my last comment coz i thought that the problem was fixed, well it kinda was fixed but theres still one problem left.
    the SCRIPT ERROR: Invalid get index 'Empty Bottle' (on base: 'Dictionary'). thing shows up everytime i export the game, and dropped items picked up dont come up to the inventory again. can anyone help me?

  • @alessandragaspar3335
    @alessandragaspar3335 7 місяців тому +1

    for godot 4, i used the following script for the item drop (modified version from @futilefoxx6512).
    extends CharacterBody2D
    const acceleration = 460
    const max_speed = 225
    var item_name
    var player = null
    var being_picked_up = false
    func _ready():
    item_name = "Egg"
    func _physics_process(delta):
    var velocity = Vector2.ZERO

    if being_picked_up == true:
    var dir = global_position.direction_to(player.global_position)
    velocity = velocity.move_toward(dir * max_speed, acceleration * delta)

    var distance = global_position.direction_to(player.global_position)
    if distance.x or distance.y < 10:
    queue_free()

    velocity = move_and_slide()
    func pick_up_item(body):
    player = body
    being_picked_up = true
    if anyone has a better version please comment it below since im sure some of the code here is old/unused/unoptimized.

  • @faridrifai2166
    @faridrifai2166 4 роки тому

    Thanks for this great tutorial
    There is a bug, when i move the sword to another slot and open inventory again, the sword doubled on first slot, how to fix it?

    • @Arkeve
      @Arkeve  4 роки тому +2

      I mentioned it at the end of the tutorial that it isn't complete yet. This is happening because we aren't updating the Inventory variable whenever we move an item. I'll cover this in the next part of this tutorial series. But if you want to try to fix it you have to update the Inventory dictionary in the PlayerInventory.gd script when you move an item.

    • @faridrifai2166
      @faridrifai2166 4 роки тому

      @@Arkeve thanks you answer so fast 😁, can't wait for your next eps

    • @coolbarryo1852
      @coolbarryo1852 4 роки тому

      @@faridrifai2166 did you ever find a solution?

    • @faridrifai2166
      @faridrifai2166 4 роки тому

      @@coolbarryo1852 not yet, I still wait for next upload

    • @GamerReborn1979
      @GamerReborn1979 4 роки тому

      Arkeve have mercy and upload next tutorial 😉

  • @futilefoxx6512
    @futilefoxx6512 4 роки тому

    I watched the whole video and im in a bit of a pickle, It work correctly but I get "Orange Potion, 1" its because in the ItemDrop script it says item_name, 1 but if I try to change anything a get errors. Does anyone know a workaround?

    • @flashflatliner
      @flashflatliner 4 роки тому

      I'm having the same issue. Has anyone found an answer to this?

    • @BasilHerb
      @BasilHerb 3 роки тому

      I suppose nobody has an answer still? :/

  • @smartntboy2474
    @smartntboy2474 2 роки тому

    i can pick up items but they wont stack automatically like yours

  • @Eleven11x7
    @Eleven11x7 2 роки тому

    he is set conter [Sword: 2 ] why he is not int?

  • @noahgranger6749
    @noahgranger6749 3 роки тому

    will these tutorials work for 3d?

  • @owaisahmed7252
    @owaisahmed7252 4 роки тому

    my item is moving and moving it is not coming to player and it is not destroying

  • @rl_ledge9284
    @rl_ledge9284 4 роки тому

    Could you also make an equipment menu?

    • @Arkeve
      @Arkeve  4 роки тому +1

      In later tutorials I'll try to go over it!

    • @rl_ledge9284
      @rl_ledge9284 4 роки тому

      @@Arkeve Thank you!

  • @damonsteward8609
    @damonsteward8609 4 роки тому

    very cool!

  • @evohollywood303
    @evohollywood303 4 роки тому

    How to make working health potion

  • @hamzailer
    @hamzailer 4 роки тому

    Any eta on part 4?

  • @AgriasOaks99
    @AgriasOaks99 4 роки тому

    I couldn't find part 1 and 2...

    • @Arkeve
      @Arkeve  4 роки тому

      Check description, its part of inventory system tutorials

    • @AgriasOaks99
      @AgriasOaks99 4 роки тому

      @@Arkeve ok

  • @ILoveWatchingTy
    @ILoveWatchingTy 4 роки тому

    Can this be translated to 3d?

    • @Arkeve
      @Arkeve  4 роки тому

      I assume the idea would be the same, detect collision with an item drop scene and then trigger some function to pick it up.

  • @kamos2216
    @kamos2216 4 роки тому

    when i dont have 2D game but 2,5D game the gravitation makes it fall of the map becouse i dont have collision shape like 2D games have

    • @kamos2216
      @kamos2216 4 роки тому

      is for that solution?

  • @quissy5641
    @quissy5641 3 роки тому +3

    copy paste, copy paste, copy paste, copy paste, copy paste, copy paste

  • @Dianruakrhakakks
    @Dianruakrhakakks Рік тому

    this tutorial is a jumbled mess

  • @eduardoroth5048
    @eduardoroth5048 Рік тому +1

    If someone have some problem in:
    if event.is_action_pressed("pickup"):
    if $PickupZone.items_in_range.size() > 0:
    var pickup_item = $PickupZone.items_in_range.values()[0]
    pickup_item.pick_up_item(self)
    $PickupZone.items_in_range.erase(pickup_item)
    just change te range size to 1:
    if event.is_action_pressed("pickup"):
    if $PickupZone.items_in_range.size() > 1:
    var pickup_item = $PickupZone.items_in_range.values()[1]
    pickup_item.pick_up_item(self)
    $PickupZone.items_in_range.erase(pickup_item)

  • @bluezyonleavell8601
    @bluezyonleavell8601 Рік тому

    everything works other than the pickup_item.pick_up_item(self) part someone please help me