Loot Crates/Mystery Item Boxes

Hi all! This is my design on how to make a random Loot Crate thing where you purchase from a vending machine and it gives you a random item. I know that this has been done before but I wanted to take a stab at making one myself, so here’s what I made:
Screenshot 2023-10-19 11.08.07

Tutorial
Step 1: Place a Vending Machine and set your settings however you like (stock, funding, price, etc). If you want, set it to “Grant Item” but leave the “Granted Item” blank for a Question Mark icon – I thought this was a nice touch.

Step 2: Place a Trigger and set “Visible In-Game” and “Trigger by Player Collision” to No. Create a custom “When triggered…” block with the following code (it won’t let me put in a second image):

  • Create a variable called “Random”.

set Random to [ random integer from [1] to [4] ]
Broadcast Message on Channel [ create text with [“RAND_”] [Random] ]

If you would like more or less items to be randomly given, change the maximum random integer. Leave the minimum random integer as 1. An image of the code will be in the replies.

Step 3: Connect a wire leading from the Vending Machine to the Trigger when “Item Purchased” => “Trigger”

Step 4: Place Item Granters. The quantity will depend on how many separate items you want. In my case, because my maximum was 4, I have 4 Item Granters. In each Item Granter, change your settings however you like, and set “Grant item when receiving on” to “RAND_” and then consecutive numbers for each, 1, 2, 3, 4…

Step 5 (optional): Place Notification devices that respond to “RAND_#” as well and set their information how you like. This will send a message with the random item granted.

That should be it. If you have any other questions, please let me know, and I can try to answer them. Thank you!

7 Likes

Here’s the code for the trigger:

1 Like

Nice guide on mystery boxes! This will help others make this item!

1 Like

This is a great guide! I would just say that you should edit your guide to put the picture in, unless you have a picture limit.

1 Like

Yeah, I’m still new to the forum so it will only let me put in one image per post. I put the image in the replies.

Nice guide and welcome to the forum, @arc5030 !!

1 Like

Welcome to the community @arc5030 ! Make sure to read the community Guidelines and fill out your Description! And to learn a bit more about the community, check out post and guides that are under the new-user-must-read.

2 Likes

It’s great! A lot of new users would really like this, like a lottery system! Another great guide like this is How to make a Lucky Block/ Loot Box! [ 2/10 or 🟩 ] overall, this is a great guide!

Nice guide! And welcome to this community! Also, at the beginning you said, “Hi all.” Would I be correct in presuming that you meant, “Hi y’all”?

Nice first guide and welcome to the forum, @arc5030!

Difficulty
  • 1/10
  • 2/10
  • 3/10
  • 4/10
  • 5/10
  • 6/10
  • 7/10
  • 8/10
  • 9/10
  • 10/10
  • 11/10
0 voters

I use either Hi All or Hi Y’all :person_shrugging:

3/10 because it uses blocks and some less-easy mechanics IMO

Nice guide!

1 Like

Welcome to the forum, @arc5030!

1 Like

why do i get two items instead of one

You could only get two items if the trigger activates twice somehow. The vending machine only runs once when you purchase from it so something else triggers it.
Alternatively, two of the item granters may have the same number. For example, the fish and the slingshot could activate on “RAND_2”, which would give both. Take a look at the item granters and make sure they’re all separate numbers.

Ok. Thanks!!!

1 Like