How to Make a Zone for Items! [🟩 3/10]

Zones for Items?!

Normally, zones cannot detect items, but today, I will show you how you can use properties and inventory managers to make a zone that detects a specific item!
I really enjoyed making a waiting room tutorial, so I decided to make another one! BIG credit to @some_kid as he is the one who helped me discover the way to do this. I’ve made a couple optimizations since then. It uses a lot less memory and is a bit more complex. Here is the original setup.

Here is the setup:

We will be using the items to open a door (the stone wall). You can use whatever items you want and use whatever mechanics you want to grant the items.
Make sure that the properties and the 2 counters next to the zones are configured for the player only. Make the counter near the wall global.
Lets setup the first zone mechanics. Add broadcasts to the zone:

Now setup the counter like this:

Make the counter set the “player in zone 1?” property:

Now for the hard part, the code! Setup the code in the inventory manager like this:

The “Previous amount” variable will allow us to differentiate dropping an item from picking one up. As long as the player only has one of the item, this should work. To make sure that the player can only get one of the item, set a maximum amount in the behavior of the inventory manager:

Now you have all of the info you need to make as many of these as you want! But what if you want to make them run a task, like opening our door? We can use another counter for that! What we do is increment it when we receive the “item dropped” broadcast, and decrement it when we receive “item picked up”!

Then we add a target. In my case, the target is 2. Then when the target is reached, we can do a broadcast that runs a task!

Hope you liked this guide!

What was the difficulty of this guide?
  • 1/10
  • 2/10
  • 3/10
  • 4/10
  • 5/10
  • 6/10
  • 7/10
  • 8/10
  • 9/10
  • 10/10
0 voters

nice job @Fulcrum-19 This could be useful to a few maps! keep up the good work

1 Like

Nice Guide @Fulcrum-19!
For me the difficulty is 10/10 because I’m not good with blocks.

1 Like

Nice! I am way too lazy to make an actual guide on this kind of thing, so I’m glad to see you decided to make one!