Regretfully I did not take into account one situation in which an item is dragged on top of itself. This result in items disappearing from the inventory. I address this in the next tutorial at the specific timestamp included in this link: kzbin.info/www/bejne/l3XTqIWQoM2Hq5o
@darkhunter777Ай бұрын
Мущина, исправь ошибку в моём коде plzz, я выложил исходник на cyberforum. Там проблема с удалением итема, при перетаскивании в ячейку для треша картинка пропадает, а реальный элемент не удаляется. Drag and drop я нормально прописал
@HarbingerSh2 жыл бұрын
if you want to add a limit to a specific item all you have to do is to add a stack limit to the item data in your database 0:35 first in your inventory slot script in the get_drag_data function you need also to define a new data value 4:18 instead of adding 2 more lines now we need also one more data['origin_stack_limit'] = GameData.item_data[str(PlayerData.inv_data[inv_slot]['Item'])]['Stacklimit'] ---> "Stacklimit" is what I called it in my database 0:35 feel free to change it then you can add this if statement to your inventory slot script after we calculate the new stack amount line 88 11:15 if newStack > data['origin_stack_limit']: var split = newStack - data['origin_stack_limit'] newStack = newStack - split data['origin_node'].texture = texture PlayerData.inv_data[origin_slot]['Item'] = data['origin_item_id'] PlayerData.inv_data[originSlot]['Stack'] = split if split > 1: data['origin_node'].get_node('../Stack').set_text(str(split)) do not delete anything from the video just add this statement to line 88 after you calculate the new stack amount
@IkaNine Жыл бұрын
Thank you very much for this brilliant series of tutorials
@hermez26463 жыл бұрын
Thank you for your tutorials, they are AWESOME! And Congrats to 10k Subscribers!!!
@GameDevelopmentCenter3 жыл бұрын
Glad you like them! And yes, the 10k milestone. Still need some time to process that :)
@GameDevelopmentCenter3 жыл бұрын
I will also include an episode after the splitting-stacks tutorial to make use of the inventory SFX from the 80% discounted pack that is on GameDevMarket during the month March. Check it out if you haven't already. It has over 2000 SFX and a lot of them are very useful for multiple projects. www.gamedevmarket.net/asset/featured-creator-bundle-potionaudio/?ally=tkznLbwI
@mrvladimir37953 жыл бұрын
Thank you for your work. I look your tutorial and write inventory plugin for Godot on github ;)
@USNTM23 жыл бұрын
I want to say that I am continuing to support you and plug you every chance I get, GDC! Love your work. I have a question about design decisions: Why have a column that is "Stackable" as a boolean? Why not use the "MaxStackSize" column as go-to column and anything you don't want to stack, have set to a value of "1"?
@USNTM23 жыл бұрын
I saw the answer below. Please ignore this question, GDC! I love your work.
@GameDevelopmentCenter3 жыл бұрын
Thx Kevin, that is awesome to hear and thank you so much for spreading word :) It will definitely help reach more people and in turn help them to express their creativity :)
@chushkatapiperkov7493 жыл бұрын
thank you my guru
@Jonislaus3 жыл бұрын
But what if I am one of those unscrupulous devs and want to make projectiles, like arrows, as a limited stackable equipment. Should I just make a special script for that one slot that allows stacking and moving items from inventory?
@GameDevelopmentCenter3 жыл бұрын
Change the logic to accomodate. With the code from the inventory slot and the code of the equipmentslot it shouldn't be hard to come up with the lines you need to accommodate arrows/ammo. :)
@Jonislaus3 жыл бұрын
@@GameDevelopmentCenter Yea, I sort of found a way, just need to make it work so that it doesn't screw the rest of the functionality. Cheers!
@NarZeL73 жыл бұрын
Thank you so much
@GameDevelopmentCenter3 жыл бұрын
My pleasure :)
@1ncrement2 жыл бұрын
holy shit that cool, tnx u rly
@ZephraMonocure Жыл бұрын
I know this is an outdated tutorial, but how would you go about "hiding" the origin slot while moving the item around? Similar to how Runescape does their item dragging. I'm able to hide it with this code... var default_texture = null data["origin_node"].texture = default_texture data["origin_node"].get_node("../MC/Stack").set_text("") ...placed after the set_drag_preview, but im not sure how to bring it back when you drag somewhere that isnt handled by the can_drop_data function.
@GameDevelopmentCenter Жыл бұрын
You have the origin node, with that you should be able to retrieve the data that you haven't set to null or switched yet. That should be enough to drop the item back in (visually)
@ZephraMonocure Жыл бұрын
@@GameDevelopmentCenter Thank you! I have that working for the drop_data condition for when you drag to the origin node ie self, but im not sure how to do it for when you drop outside the inventory or equipment slots.
@GameDevelopmentCenter Жыл бұрын
Please join Discord, I don't have enough context with these type of snippets.
@ZephraMonocure Жыл бұрын
Sure thing!@@GameDevelopmentCenter
@mars31423 жыл бұрын
A pro feature would be not stackable equals true/false. It should be a number between 1 and infinity, to show what the max stack limit should be ;)
@GameDevelopmentCenter3 жыл бұрын
Yeah, that would only require minimal change in code and it would add that little extra touch, great idea!