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
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!
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
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.
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
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
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 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.
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
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?
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.
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
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!
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.
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
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 :)
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.
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 ?
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?
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?
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!
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?
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.
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?
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.
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?
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)
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
Thank you so much! I appreciate the very kind words!
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!
Great to hear!
Please don't stop making tutorials. You are very good at it. Thank you!
This is brilliant. Just amazing I can’t believe how efficient this is. Thanks so much!!
No problem! I'm happy you found it helpful!!
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
What does this fixes?
Omg, i fix my problem by seeing this comment. Thanks
thanks bro! I've been solving that problem for almost a month then I saw your comment
@@jenilamansalapus9782 hey how did u fix it
Perfect, thank you!
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.
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
Good video, glad to see more Godot tutorials are being created. :D
Thank you!! Now we need removing and using the items 🙏🙏
Better then everything else I've seen. Please continue this series. Maybe equipping different weapons or using consumables next? Thanks again! Subbed!
Thanks for the kind words :)
Great tutorials! Glad to find a quality new Godot channel.
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
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
you know how to drop item when enemy dies?
@@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.
i can only make it move left and right
hi, do you have an updated version for godot 4?
YES I WAITED SO LONG, thank you mate :)
No problem!! Hope you find it helpful
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
@@enriquemateo9364 did you actually make the function? no typing mistakes? did you put the function in the right node?
@@rl_ledge9284 hey men thanks for answering, everithing os right It was only a tipping mistake
great job I'll be waiting for the next one! :D
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?
I plan to do a hotbar within the series, and maybe a chest as well later on!
@@Arkeve What a marvellous news! I'm looking forward to that. :)
Your a live saver my friend trying to make a bit of a Zelda might make devlogs, thank you man
Can someone help im stuck at 12:13 it keeps on telling me that nonexistent function in kinematic body
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
@@paltzis7295 I hate when that stuff happens HAHA
needed this
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.
can't wait for part 4!!!!!
Woah straight up what i wanted, nice vid man
Thanks! Hope its useful :)
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
Why in 18:46 4 items drop more 4 ? 😁How delete item from bug ? Demolish value + texture ?
also PLEASE make a part 4 that fixes the inventory not updating
Agree
Thanks for all! keep up the good work
Thank you!
Thank you for these videos !
Thanks! if you could, could you also do a tutorial on how to make inventory that is always visible?
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
@@Arkeve oh lmao i didnt know that its called hotbar. Thanks!
Waiting for the next serie
for some reason my labels are displaying the name along with the quantity, like, instead of just saying "3" it says "[Wood Log, 3]"
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!
@@IvanCamposOfficial Thanks bro you're a life saver
@@IvanCamposOfficial perfect, thank you!
Where’s the next one? How do you fix the problems at the end of the video?
Nonexistent function 'pick_up_item' in base (player.gd). Please help me
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
@@paltzis7295 Thank you so much! It really worked and I couldn't figure it out on my own
For some reason, the item name also gets displayed on the label for me. Any help?
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.
@@jvstAsYouAre thx man I was wondering that, ur a genius
Thanks a lot, had the same problem and spent half an hour trying to find the bug haha
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
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 :)
how to do this so it works with gamepad not mouse?
When i pick up items, the item quantity is not increasing, anyone know how to fix this?
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.
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.
Breh you doing me dirty af holding out on me with that part 4 tho, just sayin
:( releasing soon
@@Arkeve Epic
Hello, are you still active? because I have a problem and I want to know if I will have an answer
How to check if slot is full in inventory?
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 ?
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?
is a part 4 coming?
Yeah, just been busy with some other stuff. I'll try to get it out soon.
@@Arkeve okay
@@Arkeve , it’s been 4 weeks... you still good?
plzzz make more parts.....we need that...plzzzzz🙏
This does not work for me when exported to windows. I think my code cannot access the JSON file
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
So kind of like auto pickup? You would just remove the check to see if the pickup button was pressed. Remove the if statement
@@Arkeve Sadly when i try to run it says that "Invalid call. Nonexistent function 'pick_up_item' in base 'KinematicBody2D (Player.gd)'."
@@SilentFire08 for me it actually starter working when I had every single collission layer was set on the right place
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?
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!
@@Arkeve ok, thanks!
What is the "Dictionary" in the tutorial? Can you explain me?
part 4 pls
can you make a way to use the items in an inventory
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?
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.
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?
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.
@@Arkeve thanks you answer so fast 😁, can't wait for your next eps
@@faridrifai2166 did you ever find a solution?
@@coolbarryo1852 not yet, I still wait for next upload
Arkeve have mercy and upload next tutorial 😉
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?
I'm having the same issue. Has anyone found an answer to this?
I suppose nobody has an answer still? :/
i can pick up items but they wont stack automatically like yours
he is set conter [Sword: 2 ] why he is not int?
will these tutorials work for 3d?
my item is moving and moving it is not coming to player and it is not destroying
Could you also make an equipment menu?
In later tutorials I'll try to go over it!
@@Arkeve Thank you!
very cool!
How to make working health potion
Any eta on part 4?
I couldn't find part 1 and 2...
Check description, its part of inventory system tutorials
@@Arkeve ok
Can this be translated to 3d?
I assume the idea would be the same, detect collision with an item drop scene and then trigger some function to pick it up.
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
is for that solution?
copy paste, copy paste, copy paste, copy paste, copy paste, copy paste
this tutorial is a jumbled mess
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)
everything works other than the pickup_item.pick_up_item(self) part someone please help me