How do I Make This Inventory System Work?

Just started using Construct 2? Post your questions here

Post » Sat Oct 21, 2017 1:06 pm

Okay guys, this is going to be a long one. Let me preemptively beg for patience and mercy. You WILL have to explain things like I'm 5 years old.

I'm trying to create an inventory system based off of this Construct 2 tutorial:
https://www.dropbox.com/s/a21t52ct6evtm69/Inventory%20Tutorial.capx?dl=0

Here is my game:
https://www.dropbox.com/s/lnmfbwosi59171v/MURDER%20CASTLE%20GAME%2010.21.capx?dl=0

The main difference is that my game does not use a mouse; it is keyboard only, which was the beginning of the problem.

There are collectibles spread around the floor in the "Foyer" layout. The goal is:
1) To have these items disappear from the layout and appear in the inventory
2) To be able to select these items from the inventory by positioning the Selector over them and pressing Enter
3) To be able to combine items in the inventory
4) To be able to compound certain items without taking up more space in the inventory. For example: the player will have to collect keys throughout the game. If they collect 3 keys, I don't want that to take up 3 inventory slots... I want one key in one slot with the text " You have Key 1, Key 2, Key 3" and have them be able to select from that list.

Let's begin with item 1: Upon collision with a collectible, the collectible disappears from the layout and appears in a slot in the inventory.

I have studied the tutorial for weeks and tried to copy it to the best of my ability (keep in mind, my ability is shit). Collectibles do not disappear when I collide with them, and they do not appear in the inventory.

Relevant Event Sheet items:
Line 49-51
Line 69-70

Thank you so much. Let's have fun today!
B
8
S
2
G
1
Posts: 89
Reputation: 1,230

Post » Mon Oct 23, 2017 2:45 am

First of all, your link doesn't work.

I've seen this tutorial before and frankly, I don't like it. I think it's overly complicated.
Search for "inventory" on this page, there are lots of other tutorials which may work better for you:
https://www.scirra.com/tutorials/all
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
127
Posts: 1,768
Reputation: 67,857

Post » Mon Oct 23, 2017 4:44 pm

@dop2000

Oh no! Let me try again:
https://www.dropbox.com/s/fzxehbacz1t8329/MURDER%20CASTLE%20GAME%2010.23.capx?dl=0

May I ask, why don't you like this particular inventory system? I think it looks super cool, and it does everything I would want my own inventory to do.

I did look at the Construct 2 FAQ list and saw a couple other options for an inventory, but they didn't have the "sophistication" of this one, lol. I will look again.

Please please please help me with this one though, ok? I really like it!
B
8
S
2
G
1
Posts: 89
Reputation: 1,230

Post » Tue Oct 24, 2017 4:01 am

Ok, for starters:
1) You have two PlaceInInventory functions. Delete the duplicate one in Logic group.
2) You need to add InvCell sprites to your layout. Don't forget to set correct value for Order instance variable for each cell.
3) In lines 42 and 44 change Item.animationFrame to Collectibles.animationFrame
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
127
Posts: 1,768
Reputation: 67,857

Post » Thu Oct 26, 2017 1:04 am

@dop2000

Okay, completed!
What should I look at next?

https://www.dropbox.com/s/5vvmyppiv3zmyxh/MCG10.25.capx?dl=0
B
8
S
2
G
1
Posts: 89
Reputation: 1,230

Post » Thu Oct 26, 2017 4:43 am

You tell me! :)
What is your next problem?
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
127
Posts: 1,768
Reputation: 67,857

Post » Thu Oct 26, 2017 11:19 am

@dop2000

Lol, sorry.

https://www.dropbox.com/s/zdt44j7soy6gy7v/MCG10.26.capx?dl=0

The collectibles are supposed to disappear and reappear in one of the Inv Cells, but they're still just sitting on the Level layer?
B
8
S
2
G
1
Posts: 89
Reputation: 1,230

Post » Thu Oct 26, 2017 11:48 am

Why did you remove 4 actions from the "DisplayINVContent" function? Restore them and your inventory will work.
Did you delete and then re-added invCell sprite or Collectibles family? You should be careful when you delete an object in C2, as all events and actions mentioning this objects are automatically removed from the event sheets.
I suggest you compare your code with the previous version (the one you uploaded a few days ago) to make sure nothing else is missing.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
127
Posts: 1,768
Reputation: 67,857

Post » Fri Oct 27, 2017 12:24 am

@dop2000

You're right, i didn't even notice that! Fixing now...
B
8
S
2
G
1
Posts: 89
Reputation: 1,230

Post » Sat Oct 28, 2017 7:01 pm

@dop2000

Hi again! I'm on a roll. I went through every line of the inventory example and tried to copy as much as I could. Just a few more bugs to work out!
1. 'Drop Item' doesn't work... the item remains in the inventory. (Line 108)
2. 'Delete After Use' is supposed to delete the item from the inventory after being used. If you get the note, go to the dude, press I to open the inventory, and use the note, you will see that it's still in the inventory after use. It's supposed to be gone! (Line 110)
3. If you get the note and select it from the inventory without going to the dude, the game is supposed to pause and let you read the note. But the game does not pause, and the Notes layer does not become visible as it should (Line 128).

Also, if you get the note before getting the handkerchief sometimes the note does not appear in the inventory?
What do you think, Dop2000?

My game:
https://www.dropbox.com/s/twtbcfklsi77asp/MCG10.28.capx?dl=0

Inventory Tutorial:
https://www.dropbox.com/s/a21t52ct6evtm69/Inventory%20Tutorial.capx?dl=0
B
8
S
2
G
1
Posts: 89
Reputation: 1,230

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest