NoScript Slot Machine

DorkLord

10th Level Google Mage
Veteran
Joined
Aug 1, 2013
Messages
47
Reaction score
26
First Language
English
Primarily Uses
N/A
DorkLord's (aka BossGalaga) VX Ace NoScript Slot Machine
(...or Fun With Variables)​
 ​
Download the Fully Editable Project File from:
*In case Thread Attach doesn't work*

**If anyone has questions about this or using this in their own project, feel free to drop me a PM**​
 ​
 ​
A video showing off the Slot Machine from my recent game, Cliche Quest.


 ​
FEATURES:

Fully commented event code
3 Reel Slot Machine, Fully animated!
Spins are randomized on each reel.
Controlled by one event, about 20 pages worth of event code but easier than it looks.
Fully configurable prize combinations, side prizes and random prizes.
Unique (one time) prizes! (prizes that can only be won once)
Configurable odds/payout rate by adding custom
Addicting!
*Now Ralph has a gambling problem*

WHAT IS IT?
This is a sample project showing off a no script 3 reel Slot Machine that I created for my new episodic game Cliche Quest.  This Slot Machine was fully evented from scratch.  Would it have been easier to script it instead?  Probably...a little but still would have used the same method.

HOW IT WORKS

To understand how this works you should have at least a basic understanding of using switches, variables, labels and conditional branching.  The slot machine uses 9 variables, 5 switches and 3 events.

Switches: FreePullUsed, SlotPrizeWon, UniquePrize1, 2 and 3.

Variables: Slot1position, 2, 3, Slot1random, 2, 3, Slot1spintime, 2, 3

1 event serves to reset the slot position variables when a player enters the room/map.

3 events are used to display the reels on the slot machine.  These are empty events that only serve to display a graphic.  1 event controls the prize chest, which opens up and gives the player a prize if they've won a main prize and finally, the event attached to the lever is what controls the entire slot machine.  1 additional event is called animation-placeholder. This is an empty event that we use as a target for a Show Animation effect if the player gets a jackpot or 2 or 3 skulls in a row.

The machine uses an edited charset with the 8 slot symbols copy&pasted in each character set, that way when using Set Move Route to change the graphic, we don't have to use the Turn command to set it to a specific frame. 

So our goal is to have a slot machine, with 3 reels with 8 symbols on each reel, that spin around and then stop at a random position and see if we won a prize or not.  This is all done inside a loop until the machine has finished spinning and checking to see if a prize was won.

The machine starts by using Control Variable to set slot1/2/3random variables to a random number between 0 and 15.

Then those variables are set to equal our Slot1/2/3 spintime variables, which are used to determine how long to spin the reels for.

Since we want to spin the reels for more than 0-15 frames we also add 128, 144 and 160 extra spintime to each variable.  This gives us a healthy amount of spin on the reels and also makes it so the first reel will countdown to 0 first, followed by the second and then the third.

Conditional Branching which checks the Slot1/2/3position variables is used to update the graphics displayed on the reels.  Then an increasing Wait time is added after the graphics update phase so the reels appear to slow down the closer they get to finishing their spins.

As long as the slotXspintime doesn't = 0, we increment the slot position.  If it was at position 7, we add +1 and move it to position 8.  If the position has reached 9 (remember we have 8 symbols) then we use Control Variable again and set that slotposition to 1, because it has completed a full revolution.

Finally, we -1 from each spintime variable.

After this is done, we enter the prize checking phase and use Conditional Branches to see if Slot1, 2 and 3 match any of the prize combinations that we have previously set.  For instance, in this example 2, 2, 2 is 3 coins which is a jackpot.

If the player has won a main prize, I set the slotprize variable to the prize I want them to win, set the SlotPrizeWon switch to on and then tell the player they have won and can get their prize from the chest, then use a Jump to Label command to send them to the end of the event code and avoid checking for any other matches or side prizes.  It's not necessary to use the chest to dole out prizes but that's just how I chose to make it.  If you don't want to use the chest you can delete it and make some slight edits to the prize checking part of the event code.

I also have "side prizes" enabled on the machine.  If the player doesn't have a winning combination from the set of main prize combinations then I check to see if they at least a side by side pair.  If they do they get either a small prize or a random prize.

And that's basically it.  I encourage you, if you're interested to download the project, check it out, play with it and study the event coding.  The concepts used in this project can be applied to various other projects as well.

Extra Challenges: 2/2

Control the Reel Stops: By adding a conditional branch that checks for a keypress by the player, we can make it so the player has to press a key to stop each reel.  After a keypress has been detected we can decide on how much longer that reel should spin and then stop it after that set amount of spintime.

Vegas Odds: By "rolling" a weighted random variable at the beginning we can increase the player's odds of getting a specific symbol on each reel.  So for example, I would roll a random variable between 1 and 8.  If it's a 1 or 2 then Slot X will be set to stop on a Skull. If it's a 3, 4 or 5 Slot X will be set to stop on a Potion.  If it's a 6, 7, 8, 9 or 10 then slot X will be rolled again (1-8) and set to any random symbol.  This way, the player will have a higher chance of getting either a skull or a potion on any given reel.  This could increase the rate of smaller prizes won but also increase the danger of getting skulls.  After we have predetermined what slotposition we want each reel to stop at we would simply add or subtract from the spintimer for each reel so it will end on that predetermined reel, after which we would enter into the actual reel spinning loop.

Think you can do better? imProve it!

Yes, there are some things here that could have been done more efficiently.  Feel free to tinker with it, share back or post comments, suggestions and other feedback.

Terms of Use:
Free to use/modify/improve in Commercial/Non-Commercial Projects.
Give Credit to Richard Colletta aka DorkLord @ RPGMaker.Net/RPGMakerWeb
Do not redistribute as your own work.
 
Last edited by a moderator:

Laptopdancer

Gaymerz Rock!
Veteran
Joined
Oct 22, 2012
Messages
158
Reaction score
20
First Language
English
Primarily Uses
Just Wow!
 
Last edited by a moderator:

slaapmuts

Warper
Member
Joined
Jun 17, 2015
Messages
4
Reaction score
0
First Language
English
Primarily Uses
Works great! Although it took me 1hour to import it into my map  :p

I had to set different switches/variables since I already have first 10 in use.

Noticed one small mistake:

Your Slotpull event (ID: 02) when you have all slots on position 3 (little below pricecheck) you set variable 62 to 5. It has to be variable number 10 (Slotprize).

Thanks for sharing!
 

Rain29

Villager
Member
Joined
Jul 22, 2015
Messages
18
Reaction score
0
First Language
English
Primarily Uses
can i see your event pages
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,523
Reaction score
6,870
First Language
German
Primarily Uses
RMMV
can i see your event pages
You have to download the project to see them in the editor - the OP isn't active anymore (check the last active date, it's 1.5 years in the past)
 

Rain29

Villager
Member
Joined
Jul 22, 2015
Messages
18
Reaction score
0
First Language
English
Primarily Uses
You have to download the project to see them in the editor - the OP isn't active anymore (check the last active date, it's 1.5 years in the past)
oh my bad, didn't notice
 
Joined
Aug 30, 2015
Messages
2
Reaction score
0
First Language
english
Primarily Uses
has anyone tinkered with this at all?
 

ACECORP

Founder & Entrepreneur
Veteran
Joined
Apr 6, 2016
Messages
253
Reaction score
38
First Language
English
Primarily Uses
RMMV
Tried downloading from both links you posted but it's an .exe not a .zip/project file. 


Is is the exe self extracting or is it an excutable version of the mini game? I am looking for the actual project file so I can edit and see more details of what exactly you did to get this working.
 

DorkLord

10th Level Google Mage
Veteran
Joined
Aug 1, 2013
Messages
47
Reaction score
26
First Language
English
Primarily Uses
N/A
Tried downloading from both links you posted but it's an .exe not a .zip/project file. 


Is is the exe self extracting or is it an excutable version of the mini game? I am looking for the actual project file so I can edit and see more details of what exactly you did to get this working.


Sorry for the late reply (a couple months) but the exe is a self-extracting module, which contains the actual source/example project for VX Ace. If you want to include this in one of your own projects, it will take some time to import the variables and switches into your project and make sure they match the event coding, which will be a pain in the butt. This was more of a proof of concept type thing. The event coding was absolutely tedious.


Although it looks fancy, I would suggest creating an animated sprite with a 2 tile slot machine with an animated spin that doles out random prizes. I mean, there are tons of simpler alternatives that you could use. I'm planning on re-creating this in RPG Maker MV but much simpler and it won't require half an hour of setting up variables if you want to port it into your own project.
 
Last edited by a moderator:

ACECORP

Founder & Entrepreneur
Veteran
Joined
Apr 6, 2016
Messages
253
Reaction score
38
First Language
English
Primarily Uses
RMMV
Thanks. I may just wait for that MV version. Been tied up with other aspects of my game, and am eyeball deep in those at the moment. I'll eventually circle back to this, lol and with how fast I move, RpgMaker MVXXI may be out but then LOL. 
 

Ellisvox

Villager
Member
Joined
Mar 2, 2014
Messages
9
Reaction score
1
First Language
Dutch
Primarily Uses
so has anyone made a MV version yet?
 

Jenova

Because you are...a puppet!
Veteran
Joined
Nov 29, 2017
Messages
246
Reaction score
127
First Language
English
Primarily Uses
RMMV
Thanks. I may just wait for that MV version. Been tied up with other aspects of my game, and am eyeball deep in those at the moment. I'll eventually circle back to this, lol and with how fast I move, RpgMaker MVXXI may be out but then LOL.
so has anyone made a MV version yet?

 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I got tired of not having an avatar image. Couldn't think of anything cool. So I'm just using my game's antagonist instead... How original. At least both of our names start with C?
Expectation: Design/dev a game for the game jam | Reality: "These codes suck, why did I do it this way? lemme fix this. Also what if I add feature xyz because... well, I can."
Did my first script call in an event! :kaopride: It's completely useless and just because I thought it'd be cute if looking at clocks in-game made the character say the real-world time, but it's fully functional scripting and I did it all by myself!
Stream will be going live shortly! I will be playing Resident Evil 3 Remake, and then I will be switching to a session of the Interactive Text Adventure! Feel free to drop by!
Spent all day working on something that ultimately has nothing "flashy" to show at the end of it. But that sense of achievement...

Forum statistics

Threads
95,633
Messages
930,575
Members
125,945
Latest member
pineappletopcake
Top