public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers

RMMV Picture Based Poker / Blackjack / High N Low

BMM Archive · July 16, 2026

Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: RMMV Picture Based Poker / Blackjack / High N Low
  • Original author: xabileug
  • Original date: May 20, 2020
  • Source thread: https://forums.rpgmakerweb.com/threads/rmmv-picture-based-poker-blackjack-high-n-low.121822/
  • Source forum path: Game Development Engines > RPG Maker Tutorials > RMMV Tutorials

Summary

I have not found a tutorial for these gambling mini games , probably because they are too easy. I want to share my method. You will be needing 2 scripts by tomoaky (link to his google drive in my signature): 1)TMBtnPicture -> run common events when you click on the picture (you can use Triacontane PictureCallCommon ) 2)TMSimpleWindow -> displays upto 8 message windows simultaneously with custom size and position

Archived First Post

I have not found a tutorial for these gambling mini games , probably because they are too easy. I want to share my method.

You will be needing 2 scripts by tomoaky (link to his google drive in my signature):
1)TMBtnPicture -> run common events when you click on the picture (you can use Triacontane PictureCallCommon )
2)TMSimpleWindow -> displays upto 8 message windows simultaneously with custom size and position

script call for displaying cards:
JavaScript:
//var1 = suit var2 = value
$gameScreen.showPicture(ID, var1 + var2, origin, x, y, width, height, opacity, blend);
// example
$gameScreen.showPicture(6, $gameVariables.value(166) + $gameVariables.value(176), 0, 176, 180, -20, 20, 0, 0);
In the example gameVarID 166 will store the suit name gameVarID 176 will store the card value. This is snapped to upper left origin with a horizontal flip at 20% the original size and at opacity = 0 (transparent)
Remember to assign picture ID with the overlap in mind. Higher ID are displayed on top of the lower ID

script call for randomizing suit and value:
IMPORTANT !!
You should assign first a value to the suit and value before using the show picture
JavaScript:
const suit = ["d", "h", "c", "s"];
var randomsuit = suit[Math.floor(Math.random() * suit.length)];
$gameVariables.setValue(166, randomsuit);
$gameVariables.setValue(176, Math.floor(Math.random() * 12) + 2);
We setup the array for the suit and get a random value based on the array size. Next, we randomize the value from 2 to 14 ( range is 12) then add the min which is 2.

script call for combining 2 arrays into 1:
JavaScript:
const dia = [1,2,3,4,5];
const hea = [6,7,8,9,10];
var deck = dia.concat(hea);
for (var i=0; i<10; i++){
var roll = deck[i];
$gameVariables.setValue(191+i, roll);
}
Here we utilize the function concat. This will combine the array dia and hea into a new array deck and automatically assign the elements of array deck to 10 game variables from 191 to 200.

script call for Fisher Yates Shuffle:
JavaScript:
const dia = [1,2,3,4,5];
const hea = [6,7,8,9,10];
var deck = dia.concat(hea);
var i = deck.length, j, temp;
while (--i > 0){
     j = Math.floor(Math.random() * (i+1));
     temp = deck[j];     deck[j] = deck[i];     deck[i] = temp;}
for (var i=0; i<10; i++){
var roll = deck[i];
$gameVariables.setValue(191+i, roll);
}
This is the modern shuffle and fairest giving equal chances to all possible combinations. This is very useful for the deck shuffle.

script call for card dealing no repeat:
JavaScript:
const dia = [1,2,3,4,5];
const hea = [6,7,8,9,10];
var deck = dia.concat(hea);
deck.sort();
for (var i=0; i<11; i++){
var roll = Math.floor(Math.random() * deck.length);
$gameVariables.setValue(191+i, deck.splice(roll,1));
}
Here we utilize the function splice which can add/remove elements of that value from the array. So every time we roll a random number from 0 to the last element of that array, it will automatically be removed.


All pictures in the save file must be named according to how you defined the array for the suit. for example as : h1, h2...,h14 ; c1,c2,...c14, d1,d2,...d14, s1,s2,...s14,
You can spell out the names as diamond, heart, spade, club.. or anything you like
The values you can start from 1 to 13, or from 2 to 14. I use 2 to 14, as most card games have the ACE as the highest.
Don't forget to have a back card display too!

In case suit is not important in your game design, just name your pictures from 1 to 52. As a standard deck has 52 cards.

Flip effect using move picture: (horizontal)
1. show back side at 255 opacity, positive width
2. show front side at 0 opacity, negative width , assign x coor : origin + image width
3. move back side to 0 opacity, negative width , assign x coor : origin + image width
4. move front side to 255 opacity, positive width
5. Erase back side
**If you want the vertical flip, use height and y coor instead **

script call Quick Erase All Pictures:
JavaScript:
for (var i =1; i<max+1; i++){
$gameScreen.erasePicture(i);}
If you have 20 pictures used, let max = 20. This is very helpful to remove all pictures at once to conserve lines.

Extra Game Feels:
1. Assign a background picture
2. Assign a BGM
3. Create a dramatic entrance for the Dealing of Cards
4. Assign SE when certain conditions are met (Use voice Actors!)
5. Use items in possession, skills, class, etc. for conditional branches for randomization of values
6. Keep a statistics

Things you should not forget:
1. Reset variables to zero during initialization
2. Use photoshop pixel coordination information when designing the layout of the cards
3. When first designing the mechanics, create a flowchart, then use the show text (message display) every step. When things seems to be buggy, you will know write away which part of the coding / eventing went wrong
4. Use the comment often so that you know what your idea was

GAME 1: POKER (Difficulty : ★ ★ ★ ★ ★ )


Poker is card game where the player with the best combination wins. To make things simpler for this tutorial, I will focus on the Solo Draw 5. The important part here is the checking of combinations. Here is my method:
1. Get 5 pairs of variables. 1st set of 5 will be the that of the player's.. The other set will be for the sort array.
1589983158704.png
2. Use insertion Method to sort the 2nd set in ascending order. By insertion method, for example your array is [A, B, C, D, E], you will compare A and B, if A > B, you swap their position.. Then go with B and C, compare and swap, but since you swap B and C, you need to compare and swap A and B again. I only have a total of 10 comparisons (1-A, 2-A, 2-B, 3-A, 3-B, 3-C, 4-A, 4-B, 4-C, 4-D)
1589983379229.png

A faster way would be using the sort function:
JavaScript:
const dia = [1,2,3,4,5];
const hea = [6,7,8,9,10];
var deck = dia.concat(hea);
deck.sort();
for (var i=0; i<11; i++){
var roll = Math.floor(Math.random() * deck.length);
$gameVariables.setValue(191+i, deck.splice(roll,1));
}
In this example, the new array deck will have its element arranged in ascending order. Both method uses the same algorithm. This is just shorter.

3. After sorting them in ascending order, you will need to check if they are consecutive. Their difference with each other is 1. Because you have arranged them in ascending order, you will just have to check 4 times.
1589983664490.png
4. Checking all the other card combinations. This can be tricky, but since you have arranged them in ascending order, the possible combinations are greatly trimmed! Remember, the format is now A B C D E. So if you're checking for a 5 of a kind you just need to check if the card combination is A A A A A like in the image below:
1589983931939.png
if you are checking 4 of a kind : A A A A E or A B B B B
1590292265579.png
Full house will be : A A C C C or A A A D D
1590292307840.png
3 of a kind will be : A A A D E or A B B B E or A B C C C
1590292350878.png
2 Pairs will will be : A A C C E or A B B C C or A A C DD
1590292388650.png
1 Pair will be : A A C D E or A B B D E or A B C C E or A B C D D
1590292423197.png
High Card : E will always be the High Card, and it should be a Jack or better to win
1590292488422.png
5. Payout Rules: you can just check the internet for the basic, you can always make your own. I made it such that based on the 10 different combination results here's my multipliers [200,100,50,25,9,6,4,3,2,1]
1590291438342.png
Here you can see, the multipliers are arranged in increasing order. Since 5 of a kind is the highest, it is the 11th element of the array payout or payout[11]. Royal Flush is the 10th element or payout[10]. So when the variable ID 135 has a value of 11 it will multiply the value of the bet by 200!

6. Use the Bet to control the random. Higher bet could be lower chance of getting high cards or increase chance of getting doubles
7. EXTRA : You can change how cards are revealed.. All 5, 2 - 1 - 1 - 1, 2 - 2 - 1, or 2 - 1 - 2. You can also add the redraw or Keep / Hold. When a player gets an Ace, they can redraw the other cards maybe?

I will not be discussing 2 Player or Multiplayer Texas Holdem. Creating a smart AI can be very difficult.

GAME 2: BLACKJACK (Difficulty : ★ ★ ★ ☆ ☆ )


Blackjack is a game where you try to reach a sum of 21. A is 1 or 11, 10 and Face Cards have 10. the rest values are as is.
So here's my game design.
1. Player gets two cards. Gets up to 3 hits.
2. Dealer gets 2 cards, 1st card face up, 2nd card face down.
3. Dealer's turn, 2nd card reveal, Gets up to 3 hits.
Troubles Get Around:
A. One of the confusing thing here is how to sum with those A's? Just use 11 if the sum is less than 21, then subtract 10, so it becomes 1 if it exceeds.
B. Until when can the dealer Hit? The normal rule is dealers hit until their sum is at least 17. So they wont hit if the sum of their cards is 18 or up.
4. Possible Results. I found 9 possible results from the game.

  • Draw : LOSE
  • Player has Blackjack : WIN
  • Player Busts : LOSE
  • Dealer Busts while Player did not : WIN
  • Player has greater sum (NO BUST): WIN
  • Dealer has Blackjack : LOSE
  • Player has lesser sum (NO BUST) : LOSE
  • Player has more Differential : LOSE
  • Player has less Differential : WIN
5. Payout is 1.5 the bet if Blackjack, if just a normal win it's x1 your bet.
6. Use bet to control the random. Higher bet could be lower chance of getting a blackjack!



GAME 3: HIGH N LOW (Difficulty : ★ ☆ ☆ ☆ ☆ )


In HighNLow, you just need to predict if the next card will be higher or lower than the current card. Here's the flow.
1. Show Deck
2. Reveal Card 1.
3. Ask High or Low
4. Reveal Card 2. If correct call, next round, double bet, repeat #3. If wrong End Game.
Troubles Get Around:
A. What if it's a Draw? To eliminate this possibility, use a conditional branch to check if the random is equal to the current and re-randomize until its not equal. This is why you set the value before using the show picture.
B. How do you compare the call and the result? I prefer to use Strings
1589986439044.png
5. Counting Streaks. I think this is what is fun about HighNLow.. You only get your payout if you Win. If you call wrong, you lose it all. The bet doubles each time you are correct. It literally tests your greed and pushes your luck!
6. Use Streak to control the random.. As streak increases, your chances of calling correct slims.

I hope this was helpful so you can build your own card games.

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download
Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#rpg-maker-archive#mv-tutorials

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar