Leakoo
__ess__ from patreon
__ess__ patreon

Drag & Drop Inventory Tutorial, Completed Series, Now Available On Youtube! [OUTDATED - NO LONGER UPDATED]

🕑 Added 2022-03-23 17:44:35 +0000 UTC
Drag & Drop Inventory Tutorial, Completed Series, Now Available On Youtube! [OUTDATED - NO LONGER UPDATED]

Comments

Sara

Hello! Thanks for becoming a patron and welcome.😊 I first want to mention, in case you're not aware, that I'm working on a new and improved inventory system that will be much easier to work with. It wont have drag & drop however. I reckon it wont be too long until it's completed, but I also have to create a video tutorial for it to explain how to use it. So I don't have a release date for it yet. You can read the post for it here: https://www.patreon.com/posts/new-inventory-in-78009711 But, if you're still set on using the drag & drop one, I think I'll have to see how your code looks like to be able to help you spot the problem as I don't know how you've set it up. If you wish, you can upload your project to for example dropbox or google drive and send me a link via PM if you don't want to share it here in the public comments.

Nampot

Hi _ess_! Thank you for making such great tutorial which I was able to follow and complete even though my basic python knowledge is very limited. I was able to learn quite a bit from this. My script works fine as far as the tutorial goes, but I have a couple of issues which I was wondering if you could help me with. 1. I understand that we use a custom say screen to make sure that no interactions can happen on buttons or items while the dialogue is showing, but can we still use the default say screen elsewhere in the game? Currently I have this inventory system set up as a demo within the game in an "inventory.rpy" label which the player can jump to to try out, but when I jump back to my original script, I get an exception as soon as a character talks: [code] I'm sorry, but an uncaught exception occurred. While running game code: File "game/inventory.rpy", line 1087, in script t "This is a test." TypeError: __call__() got an unexpected keyword argument 'interact' -- Full Traceback ------------------------------------------------------------ Full traceback: File "game/inventory.rpy", line 1087, in script t "This is a test." File "renpy/ast.py", line 721, in execute renpy.exports.say(who, what, *args, **kwargs) File "renpy/exports.py", line 1419, in say who(what, *args, **kwargs) TypeError: __call__() got an unexpected keyword argument 'interact' Windows-10-10.0.22621 Ren'Py 7.4.11.2266 Feed My Affection 0.26.0 Mon Feb 20 11:37:22 2023 [/code] This is fixed as soon as I go back to the main menu and start the game again though. What is happening here and how can I prevent it? 2. The second problem I am having is with the snap-back. If I fill the inventory with items, click the right arrow to slide the items across, drag an item and then allow it to snap back to the inventory, it snaps back to wrong slot, often on top of another item. For example, if click the right arrow then drag and release the item from slot 2, it still snaps back to the second slot even though it should snap to first now, as all the items have shifted to the left. If I then click the left arrow and drag it, it will return to its original position in slot 2. I'm thinking I must have missed a line or made a mistake somewhere with item.original_x?

Sara

To use it in a label you would need to create a for loop (in a python block for example) that loops through the "environment_sprites" or "inventory_sprites" list depending on from where you want to remove an item. Then you have to compare each item in the for loop to see if it's the item you're looking for and remove it. Example: python: for item in environment_sprites: if item.type == "shoe": removeEnvironmentItem(item) The name that you put in the if statement (shoe) should be the name that exists in the "environment_items list". To add an item, you could use one line of code: $addToInventory(["hat"])

BladeGrip

I haven't thanked you for your recent replies, so let me thank you here. But now I have another question. Using this work of yours as the baseline, how to remove an item from inventory or environment while in the middle of a label? Like this for example. label cutscene1: Character: "blahblah yadda yadda." "Something happens." **[item] is removed from inventory** Character: "oh noes I just lost the [item]." "Something else happens." **[item2] is removed from environment** Character: "What, where did that [item2] go when I wasn't looking?" inserting removeInventoryItem or removeEnvironmentItem function into the label throws "not defined" error so I guess it's not that simple unless I messed up somewhere. In relation to that matter, how to instead add items in both cases?


More Creators