So, you want to give your players a crippling gambling addiction? Look no further than this ‘simple’ box!
Today, I’ll be teaching you how to create a slots machine, because after all, it can’t hurt to spin it one more time, right?
The Devices
The Devices you’ll need for this tutorial are as follows:
- 1 property manager
- 1 popup device
- 1 game overlay
- 1 wire repeater
- 1 item granter
- 1 starting inventory device
- 1 button
- 1 checker
The Randomizer
In order for your player to truly be “lucky”, your slots should be left up entirely to chance. To do that, we first have to set up a “randomizer”.
For this, we’ll use:
- 1 property manager
- 1 popup device
- 1 wire repeater
- 1 button
Firstly, we should set up the wires. Connect the button to the repeater (set the repeater delay to 0.1), and connect that to the Popup. Also, connect the button to the popup, and set it to
Button Pressed --> Run Wire Pulse Block
Also, create a property manager, called spin, or something similar, set the type to number. Set the property scope to player, if you plan on making your casino multiplayer. Do the same with the popup, and the button.
Now to focus on the actual code of the randomizer.
Enter the settings for the popup menu, and enter the blocks menu. Then create a new block on wire pulse.
Enter the following code, but if the name of your property is different, make sure your code is too.
Now your randomization system is complete! But we still need to add the ‘gambling’ aspect, so the player takes a chance of gains or losses.
The Gamble
“Take a chance!” - Any casino owner ever
The thrill of gambling can be summarized in 3 words: “Double Or Nothing!”
In this case, this is pretty much literally true.
The devices we’ll use in this step are as follows:
- 2 item granters
- 1 starting inventory device
- 1 game overlay
- 1 property manager (the same as before)
- 1 button (the same as before)
- 1 checker
We’ll only need a couple wires for this step; communication is almost entirely based on channels this time.
Since we want our player to spend money on our machine, we’ll need to give them some in the first place. Simply set the starting inventory item type to cash, and set it to however much you want the player to start with.
Now that the player has money to spend, we’ll need to hook our button up to a checker with a wire, so that they have to have a certain amount of money to spend it. Have the checker run 2 separate checks. One check should check if the player has greater than 50 cash, and the other should check if they have equal to it. Since the player only needs greater than or equal to 50 dollars to use the machine, we only need 1 check to pass.
It might be frustrating, but now you’ll need to remove the previous wires you set for the randomizer, and rewire them like so.
Now set the item granter’s settings to this:
Now that the player can spend their money, let’s work on the best and last part, the winnings.
The only device you’ll need for this is an item granter. NOT the one you used previously, a different one. Go into the settings and set the item to cash, and then go into the block coding menu. Add a new block when receiving from channel 'update'
Set the code to this:
And finally, the slot machine is COMPLETE. Happy gambling!!!
Thanks for reading my guide! Please tell me what you thought and vote on a difficulty below!
- 1/10
- 2/10
- 3/10
- 4/10
- 5/10
- 6/10
- 7/10
- 8/10
- 9/10
- 10/10