How do I fix inventory items not snapping to new inventory slots?

0 favourites
  • 5 posts
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • Hi,

    I have been developing a survival island game and have recently decided to change my inventory system around to get rid of bugs and have all the events flow better. Unfortunately, I have run into some problems as now the items will not snap to new slots when moved there, instead they will snap to their old spot instead. Here is the code:

    Here are some functions that I have created to fill data in the slots better:

    Can anyone help?

    Tagged:

  • It's because you're using system to pick, which won't pick instances. Instead use item overlapping inv slot like you did in the second event... get into the habit of using the object and not system. Try changing that and then testing it with a slot that is not occupied to see if it's fixed.

  • Unfortunately this didn't fix the problem. After playing around with it for a bit I realized that when I remove the "InvSlot is occupied" on the second sub event, all items stick to their slots, but can overlap each other can share slots. I want the items to realized a slot is full and then choose another slot. Is there a way to get this to work?

  • Shouldn't the bottom event send the item back to their assigned slot not a random slot? Otherwise what's the point in assigning the item's ID to the inventory slot?

    Also what I mentioned above will not fix all the bugs but it will at least get the function to work. If the function doesn't work then it doesn't set a slot to occupied which is part of your logic.

    You could also share the file and I can fix it, just tell me what the problem is.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The whole point of ID, Categorey, and Properties is so when I go to create a save system, the game will places all of this information into an array and when the game is loaded in, it can create all of the items where they are suppose to go. As for the problem, I was playing around with it for a bit and learned that if the item that was dragging didn't stop touching any slot, the initial slot wouldn't set itself to unoccupied. I added an event saying that on item drag start and item is overlapping slot set that slot to unoccupied. this seemed to do the trick. Thanks for response and help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)