Why my inventory work and why dosnt?

Not favoritedFavorited Favorited 0 favourites
  • 6 posts
From the Asset Store
Inventory Aid
$4.90 USD
Create grid-based game inventories and items easily.
  • Hello everyone,

    I have a problem with trying to modify the system for putting on/taking off and swapping items.

    I have created a system that works correctly: I click on an item and it is placed in the appropriate slot, I click on another item and the items swap places, I click on a worn item and it is taken off and placed in the first available slot:

    And now I'm trying to convert it to a button, not clicking on the item.

    The button is located on a different layer, “item description.” When you click on the item, this layer appears, a window pops up with a description of the item and a button.

    I created a global variable Selecte_ItemUID (because I think that somewhere in the game the itemUID record gets lost along the way) and reworked the code. I tried many ways, but it doesn't work properly as in the first option. Is the problem that this button is on a different layer?

    Any idea, what im doing wrong?

  • Where do you set the selected item variable? You are no longer clicking on an item so that variable is important.

    If I am understanding the design of this correctly that on clicking equip button you unequip the current weapon and equip the one marked as 'selected' then you should remove most of the logic from the equip button click event and just run unequip function then the equip function. All logic can take place inside those functions now. That should work if the item you want to equip has the variable set. Also move the nearest inv slot check for the moving inventory item to inside the equip function.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have a global variable and a record (not visible in the photo), but when I click on an item, the variable Selected_ItemUID = Item.UID

    So, should I move the entire "else" logic to the EquipeWeapon function? And when the “equipe button” is pressed, call the unEquipeWeapon and EquipeWeapon functions (ItemUID:ItemUID or set here my global var “Selected_Item.UID”)?

  • If I am understanding design correctly yep you can have for equip button click just very simply run unequip and then maybe a wait of 0.1 seconds and then run equip.

    Within unequip it looks like already if you have a weapon it will unequip it or skip if there is none which is fine.

    For equip this is also fine except you need to move the logic from the else about the inventory slot into the equip function to release that slot.

    Just a note you will probably encounter a future bug where if you try to equip a weapon and your inventory is full it will not unequip the weapon (expected) but it will still equip the item and move it to the slot so you have 2 in there. This is because the logic is really not a swap for swap logic but rather you are moving the weapon out to any slot then moving the item in. For a true swap you would need to edit the logic later maybe use the id of the inventory slot for item and move the weapon to it, then move the item to the weapon slot. As you know currently the weapon moves to the slot with lowest id and not the specific one the equipping item is in.

  • Considering that the button option will sooner or later cause problems with item replacement, I decided to do it a little differently.

    This time, with a single tap, I open the layout with the item description, and with a double tap, I put on/take off/replace the item.

    But here's the problem: when I double-tap an item, I still open the item description layer.

    Is there a way to block a single tap when using a double tap?

  • Ok i solve this :)

    I add object and call this "Timer" with Timer behavior, after i one tap item, i start Timer on 0,3s, if timer is end i got item description layer, if i double tap item, i stop timer, and this item description layer dosnt show

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