How to tackle inventory items?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I thought I had the perfect solution for an inventory interface but things haven't gone as expected.

    I have 14 identical looking active objects which span across my screen (they are empty boxes) - these are the slots for my inventory's interface. I have a loop which counts the number of items in the inventory and works out how many pages it needs and populates them accurately with item descriptions which are inherited from a save file in the build directory.

    For the icons, I created an active object called Inventory and I have made dozens of icons showing different items in which each item is displayed in a frame of animation. (Eg: Frame 1 is empty (no item in slot), Frame 2 is item 1, Frame 3 is item 2 etc...). In the loop, I create an icon for each slot and assign the item ID + 1 to the animation frame of that object... HOWEVER, every single icon is stuck on frame 1.

    Is this because all instances of an object will display the same frame once one item is changed? I ran a condition which says "If icon overlaps Slot 1 then change to frame 2) etc... but none of them are showing anything other than frame 1.

    Is there a way to solve this??

    I really thought this would work because if you create 20 enemies from the same object and a bullet collides with it and you say "destroy", only that enemy is destroyed and not all of them, why can't I call an animation frame using the same principal? I know the collision with the slot is being detected because I logged an event in a list box every time it happened, yet the animation frame isn't changing, or they all change at once, I'm not sure which.

  • The condition by itself (icon is overlapping slot>force animation frame of icon to 1) works as intended for me, so there must be something else going on that's changing the frame of all the duplicates of the icon object, most likely an event that doesn't reference the icon object in its conditions.

    Can you post your .mfa so we can see what the other events are?

  • Did you set the animation speed of the icons to 0? That often throws me for a loop for a minute when my frames aren't loading.

    Not sure why all of them are showing the same thing though.

  • Since you are using ID+1, I assume you are setting the ID variable to something? Might seem silly, but you probably aren't setting it to anything and it is using a default value of 0. Just change the default to another value (for instance, 4) and see if all of the inventory icons are using frame 4. If this is the problem, make sure you set the ID to the proper value.

    EDIT: Out of curiosity, are your slot active objects all unique? Or are they instances of a single slot object? If they are unique, your overlap condition should work. If they are instances, then you need to run a loop to check which icon overlaps which slot. I generally just set the image on the loop I used to create the inventory, so I'm not running constant overlap checks.

    Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!