How to make a game of chance! 🟧

Hello there! Today/Tonight, I will be showing you how to make a game of chance.
What will this game of chance be about? Essentially, it will be where you can choose an amount of silver pieces to “bet” and you will get a chance to either double the amount, or to lose the amount you “bet”. Okay, let’s get started!

Materials:
Button x4
Counter x1
Inventory Item Manager x1
Property x2
Item Granter x1
Popup x1

Step 1. Place down two properties, each with a scope of player and property type number. Name one “SilverMachine” and the other one “SilverAmount”.
Step 2. Place down an inventory item manager, and set it to track silver seeds. Have it update the property “SilverAmount”
Step 3. Place down a counter. Set the scope to player, and have it update the property “SilverMachine”
Step 4. Place down 3 buttons. Name the first one Raise, the second one Lower, and the third one Reset. Connect button “Raise” to the counter. When button pressed-----increment counter
Step 5. Connect button “Lower” to the counter. When button pressed-----decrement counter
Step 6. Connect button “Reset” to the counter. When button pressed----reset counter.
Your build should now look like this:

Step 7: Place down another button. Lable this one Activate Device
Step 8. Place down a popup. Lable the call to actions Yes and No, respectively.
Step 9: Open up the block code for said popup and press “on wire pulse”
Copy down this code


This will display the amount of silver you are going to submit, as a final check. Now wire the button to the popup
On button press------run wire pulse
Then place down a wire repeater, and run the button to the wire repeater, and the wire repeater to the popup. On pulse received-------Open popup.
Step 10: Place down an item granter. Set it to grant silver seeds.
Step 11: Connect the popup to the item granter. On primary call to action pressed-----run wire pulse.
Step 12: Go into the code tab for the item granter, press the “on wire pulse option”, make a variable called “Chance”, and copy down the following code.

Essentially, what this does is check if the amount you are trying to place down is what you actually have, and if you are not trying to input a negative number into the machine. If the initial checks pass, it then chooses a random number between 1 and 2, making it a 50% 50% chance. If you get a 1, your amount of silver inserted doubles, if not, the silver inserted is lost.
Step 13: Place down three popups, one to open on Error, one to open on Fail, and one to open on success. Write something down on the one opening on Error telling them that something went wrong. For the fail one, write that they unfortunately did not win the 50% 50%. On the success popup, inform them that they won the 50/50 and the amount of silver inserted has doubled.
Final Product:

There you go! A basic machine to either double or take away the amount of silver you insert! You can decorate it if you like!

…But wait…there’s more…

Optional

You see, the point of these kinds of machines are for the owner of the machine to make money, and a 50/50 chance are just too good of a set of odds. The player can keep inserting singular pieces! So to spice things up a little, why don’t we make it so the more silver you insert, the higher your chances are of doubling it!

Step 14: Determine loot tables
So let’s say, if you insert only 1 piece of silver, there is a 5% chance that your silver will double. If you insert 10 pieces, there is a 10% chance of doubling. If you insert 25 pieces, there is a 20% chance of doubling it. Well, it will look like this! Make two more variables called ChanceI and ChanceII. Then copy the following code.


And there! You should have a higher risk, higher reward system now!

Anyways, this is WhoAmI, Master of Space and Time, the Endbringer and Reforger, Lord of Othic, and the Wielder of the Blade of Destiny, going out!

10 Likes

Great guide! This is very useful. I love how you added the option to make it high risk high reward.

2 Likes

Nice Guide @WhoAmI!

almost thought the title was how to make gambling without money

bump

Wow, great job, @WhoAmI!

(@Blackfox45666, you don’t need to bump a post that was made less than a day ago, bumps are for guides forgotten in time)

3 Likes

Like ones form at least over 3 weeks ago, because at least 30-40 topic post are made a day so they become hard to find.

Bump.

Nice guide!

This is really cool! I might use this in my Price is Right- style map.

Thanks for the guide. It was really helpful.

2 Likes

I don’t get it. Something is wrong. So whenever I press the activate device button and then press yes in the popup, the first time it works, but when I try it again and again, it keeps saying Error.

  1. Which version are you using, the 50/50 chance or the high risk high reward one?
  2. How much silver do you have in your inventory
  3. What is the value you are inputting into the machine?

Yeah I fixed it it was because I accidentally kept the
Set Chance to Random Integer from 1 to 2
in the block code(I used the optional part).

1 Like