0 Favourites

Events related to inventory system not working

  • Hello guys,

    Once again I have hit a wall; I checked tutorial and previous posts in the forum and tried the solutions but it seems either I am doing something wrong (I bet I am!) or I am trying solutions not tailored for this problem.

    I have a level with a button called Inventory; when I click this button it stops the game and the invisible layer items would pop up. Then the player would have the option to buy the upgrades in the inventory.

    The inventory itself is just a sprite except for the Buy and Back buttons they are all buttons. Anything else, is just 1 sprite collected in Photoshop.

    Now the logic I had done as in below in an Event Sheet called Inventory:

    and here is the code for the Back button:

    I even tried to reverse the code for the Back button; where I would do the Pick UID first then the mouse click... nothing, nada.

    Then in the gameplay Event Sheet (the one used for this layout) I haded included as in below:

    I don't know what is wrong, but the game pauses OK, everything works until I try to click on any of the buttons. They don't respond at all.

    At first I thought it was because I used a literal implementation of each button's UID, so I deleted the part where it says "Pick by object UID" (thinking that if I click on a certain button, most likely the event triggered knows which button is clicked so the action will take place according to the button clicked). It still didn't work. I tried another method I found here in the forums (I can't remember the details but it used a Foreach loop, but it didn't work either).

    Any ideas how one can solve this?

    Thank you very much in advance

  • You need to use the 'Button: On clicked' trigger with buttons. Not the Mouse click trigger.

    Also when you have something like this:

    [quote:1lpgw5rp]

    The first condition will pick the button you clicked. In the sub-event you have only that button picked, so the 'pick by UID' will only pick that same button if the UIDs match, otherwise it can't pick anything. And again in the next sub-event, there can only be one button picked at this point so no need for a loop.

    If you have something picked already and you want to pick another instance in a sub-event then you need a 'System: Pick all' condition first.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • That actually worked, thank you very much!

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