Working on casino slot machines and I want to kick up the randomness a bit for a particular machine, I need help setting this one up.

MoltresRider

Moltres Rider/Dragon Whisperer
Regular
Joined
Apr 16, 2023
Messages
356
Reaction score
44
First Language
English
Primarily Uses
RMVXA
I have made several others using randomly generated variables and conditional branches, which each branch being a certain result.

The thing is, I can only go so far with that and the indentation got so bad that some machines I had to use self switches and autorun the next page to continue the branches.

I was wondering, what if I could generate the reel results themselves using randomly generated variables. I kinda have an idea how this may work, but I need help putting it into action.
Here is the payout table that I am using:
1695075670487.png
The way I see this is perhaps reel 1, reel 2, and reel 3 will all be there own separate variable that generates a random number. and then I could use conditional branches to check if things line up. say value 25-30 are Dragon ♀ (and I am just throwing numbers out there, this is not likely going to be Dragon ♀ in the game), I could have a conditional branches that checks if the first two reels are 25-30 and have a third check if it is either dragon ♀ (25-30) or dragon ♂ (a different range). If the third is something else, no payout. same for the second. Each main conditional branch will check the first reel and then go from there.

I feel I can get this but I just need a push in the right direction.

Also, I want my results to be displayed like:
1695076219582.png

I know about the \V[x] command but I would also need somehow to convert the variable to a string. Like a returned 25 would need to display: Dragon ♀

That I do not know how to do.

Can anybody give me some pointers on how I can get this going?
 

SpyroFan67

Regular
Regular
Joined
Apr 27, 2023
Messages
958
Reaction score
587
First Language
English
Primarily Uses
RMMV
I have made several others using randomly generated variables and conditional branches, which each branch being a certain result.
Wouldn't it be a lot easier just to use a slot machine plugin? They have those for MV; I'm pretty sure they have them for VX and VX Ace-right?

(Hopefully this comment was helpful and not useless.)
 

MoltresRider

Moltres Rider/Dragon Whisperer
Regular
Joined
Apr 16, 2023
Messages
356
Reaction score
44
First Language
English
Primarily Uses
RMVXA
There are no slot machine scripts out there for VX Ace. I already looked. I could only find them for MV.

I am surprised nobody else said anything
 

Poryg

Dark Lord of the Castle of Javascreeps
Regular
Joined
Mar 23, 2017
Messages
4,233
Reaction score
11,316
First Language
Czech
Primarily Uses
RMMV
Ruby is a weakly typed language, so it should be possible to save strings inside variables using the Script event command and typing the code to set variable's value by hand.
 

Elhijei

Regular
Regular
Joined
Jul 17, 2020
Messages
36
Reaction score
73
First Language
French
Primarily Uses
RMMV
I have no idea why I got so obsessed with this post, I really wanted to find a solution, saw it this morning, thought about it the entire day, I even downloaded the VX Ace demo just to test it... Hello!

Here's my go at it. It's no where near perfect, I'm not a programmer and there's a lot of ways to improve it, but I tried to keep it somewhat eventing friendly.

Here's the steps we're going to follow :
1. Roll 3 variables
2. Give each option an ID
3. Set the future textboxes
4. Check what is the actual result is
5. You won!
6. You lost...

STEP 1
Each reel will be a variable generated at random from 1 to 8 (because you have 8 items in your excel sheet). This is what you're going to do through an event:

Set variable REEL1 between 1..8
Set variable REEL2 between 1..8
Set variable REEL3 between 1..8

Now we have a suite of numbers, let's say 4-4-7 for our example. Now how's that going to help us...

STEP 2
Let's set the ID of each item, this will help the game show the textboxes, it will also help know what the results are. Through a script :

Ruby:
table_id = {
    1 => "Diamond",
    2 => "Gold",
    3 => "Dragon ♀",
    4 => "Dragon ♂",
    5 => "Phoenix",
    6 => "Bird",
    7 => "Cat",
    8 => "Foqqy",
    }

STEP 3
In the SAME SCRIPT window, we're going to run this

Ruby:
$game_variables[X] = table_id[$game_variables[REEL1]]
    $game_variables[Y] = table_id[$game_variables[REEL2]]
    $game_variables[Z] = table_id[$game_variables[REEL3]]

That way the game will remember what to show the player in the text windows through the \v[X] \v[Y] \v[Z] command. We'll get back to this later.

STEP 4
Calculate the result. Now we know 4-4-7 is Dragon ♂ - Dragon ♂ - Cat, but the game still has no idea. What we're going to do is turn these into a full number, to make it easy...

Multiply variable REEL1 *100
Multiply variable REEL2 *10
Set variable RESULT = (REEL1 + REEL2+ REEL3)

Now our result is the number 447, stored in the RESULT variable.

1695151803165.png

STEP 5
We can easily check for conditions now! Because there's only 15 possibilities, let's do this the easy/tedious way for simplicity's sake, through evented if conditions.

We run into a problem though, the player looses if none of the conditions are met, which would mean we'd have to stack several ifs within each other, it'd be hell. To prevent that, whenever the player wins, we'll set a JACKPOT switch, so when we get to the loosing part, the game knows whether the player has lost.

If variable RESULT = 111
Textbox "\v[X] \v[Y] \v[Z]"
Gold +200000
Switch Jackpot = ON

If variable RESULT = 222
Textbox "\v[X] \v[Y] \v[Z]
Gold +100000
Switch Jackpot = ON

If variable RESULT = 444
Textbox "\v[X] \v[Y] \v[Z]"
Gold +50000
Switch Jackpot = ON
else if variable RESULT = [441; 448]
Textbox "\v[X] \v[Y] \v[Z]"
Gold +50000
Switch Jackpot = ON

If variable RESULT = 666
Textbox "\v[X] \v[Y] \v[Z]"
Gold +10000
Switch Jackpot = ON
else if variable RESULT = [661; 668]
Textbox "\v[X] \v[Y] \v[Z]"
Gold +50000
Switch Jackpot = ON

...and so on and so forth. They're not imbricated, the're just one after the other.

STEP 6
And then we're putting the final condition, loosing only plays if they didn't win.

If switch JACKPOT = OFF
Textbox "\v[X] \v[Y] \v[Z]"

And finally, don't forget to turn off that JACKPOT switch at the end of the code (or at the beginig), so as to not jinx the next game.



There you go! Now there's probably an infinite amount of ways to improve it, but oh well, I don't know Ruby... Thanks ChatGPT for the table ID hahaha.

RESTRICTIONS :
  1. Won't work if there's more than 9 possible icons per reel.
  2. 447 will win but 744 won't. I think that's how slot machines work IRL too though? I'm not actually sure.
  3. The odds of getting 111 (jackpot) and 888 (meh) are theoritically the same.

Below a preview of how things would look like in RMVXAce (apologies for being french):

index.php


1695151812489.png

1695151822724.png
(I didn't include all the rewards)

1695151830035.png

Hope this at the very least inspired you, if not oh well I had fun at least :D
 

Attachments

  • 1695151817268.png
    1695151817268.png
    10 KB · Views: 0

Andar

Regular
Regular
Joined
Mar 5, 2013
Messages
39,307
Reaction score
11,486
First Language
German
Primarily Uses
RMMV
Independently of anything else and whatever solution you choose,
this:
I have made several others using randomly generated variables and conditional branches, which each branch being a certain result.

The thing is, I can only go so far with that and the indentation got so bad
This indicates that you're using a bad logical construct for your event structure.
because the only way to get there is to use the else branch for main structure checks

If you use conditional branches to check lists, then you should disable the else branches and and sort the conditions, that makes your event much more readable - and you don't need the indents at all.
 

Latest Threads

Latest Posts

Latest Profile Posts

I keep thinkin' that someday I'll be a real girl. I dunno, maybe today is the day.:kaopride:

alice_curved_citadel.png
Hello everyone, I inform you that you can now freely try my new Plugin: Dynamic Switch for RPG MAKER MZ.

You can see the official post in the forum: https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mz-plugin-dynamic-switches.161525/

I hope you like it and I'm looking forward to your comments and suggestions! :)
Right, finally responded to everyone who had an open commission query with me. If I've missed anyone, please let me know.
Okay, so it looks like I've bamboozled by that dastardly placebo effect again. Still taking the meds, which seemed to help at first, but yesterday evening my chest got this odd numbness, which didn't last long, but still. AND its still difficult to breathe. Guess I'll go spend the money I was saving for homebuying costs on another doctor visit :\

Forum statistics

Threads
134,851
Messages
1,251,190
Members
177,643
Latest member
Aviraa
Top