How to grant a custom amount of an item

Have you ever felt that its too time consuming to purchase something from a vending machine but if you add more vending machines with more options it takes up too much space. This tutorial will fix all of these problems! Thanks to @Blizzy for the help and code!

Items (Step 1)

What you will need:
x 1 inventory item manager
x 1 notification
x 1 counter
x 2 item granter
x 3 properties
x 3 triggers or buttons (Not Both)

Getting Started (Step 2)

If you have triggers set them all to visible in game and collision on

Screenshot 2023-12-22 3.00.25 PM
Now name all three properties to these and have them all be numbers
Screenshot 2023-12-22 3.02.10 PM
Screenshot 2023-12-22 3.02.52 PM
Now in the inventory item manager set the item it tracks to the item you want to pay with


Then set update properties to the cash amount property

For the counter set the property to update counter

Lastly set the item granters to the items you want to receive when you purchase it and what you want to use to pay

Channels (Step 3)

Set ONE trigger/button when triggered/pressed transmit on add to counter


Set another (ONE) trigger/button when triggered/pressed minus counter

And for the last trigger/button set it to when triggered/pressed give item

For the notification make the channel the same but just something similar to the context

Set the checker to

Blocks (Hardest part, step 4)

For the trigger / button that transmits on give item make a block that says When Triggered…
Screenshot 2023-12-22 3.37.06 PM

Extended part

Screenshot 2023-12-22 3.37.12 PM
For the item granter that gives you the item you want to obtain Make a block. “When receiving on channel Purchase Success”


For the item granter that contains the currency you want to use make a block. “When receiving on channel Purchase Success.”

Bonus (Show amount you will purchase & cost)

What you will need:
x 2 text
set both texts to any font, stroke width, or size
Amount you will purchase:
Make 2 blocks like this
Screenshot 2023-12-22 4.27.13 PM
Code both of the blocks like this
Screenshot 2023-12-22 4.28.21 PM
Cost:
Make 2 blocks like this… Again Screenshot 2023-12-22 4.27.13 PM
Now code both blocks like this
Screenshot 2023-12-22 4.39.31 PM

How difficult is this tutorial
  • 0/10
  • 1/10
  • 2/10
  • 3/10
  • 4/10
  • 5/10
  • 6/10
  • 7/10
  • 8/10
  • 9/10
  • 10/10
0 voters

Comment if there are any bugs
End Result:
Screenshot 2023-12-22 4.54.29 PM

5 Likes

Uh you can do that without this theres an option where it will grant custom amount of items

1 Like

i’m sorry for this.
image

3 Likes

I think the guide is supposed to see the amount of money you have then adapt it so you get a certain amount of items that match the amount of money you have. Something along those lines.

5 Likes

Yes thats exactly what it does and if you cant afford it, it wont go through (kinda breaks if you put it in the negatives)

2 Likes

So it’s like the fishtopia selling system? That’s pretty cool.

3 Likes

Yeah pretty much I made the fishtopia selling system, it just multiplies the cost of the fish by the amount you have then adds all the fish together and gives you the result but this multiplies the amount you want by the cost changes it to negative and subtracts that from you/how much you have while it gives you the amount you want

1 Like

Isn’t this basically the thing I told you how to do?

yea but with a lot more devices. Also from your fishtopia tutorial I was able to learn how to code in Gimkit. So thanks a lot

2 Likes

You’re welcome! No problem!

3 Likes

you should credit @Blizzy in your guide

2 Likes

To avoid that, make the property the counter updates transmit on “checkifneg” when the value is changed. Have a trigger receive on “checkifneg”, and have a block in that trigger like this:
If PROPERTY < 0:
Do: transmit on Reset

Make the Counter RESET when receiving on “Reset”

3 Likes

Nice guide! It’s a little hard to understand, but your explanation in the comments sums it up nicely!

1 Like

Or just have a target of -1 and make it increment the counter.

2 Likes

Yeah, that work much better!

Good idea, @getrithekd .