Gw Temp

Menu

Tutorial - 'Betting Money' by Awesome

An item about RPGMaker 2000 posted on

Blurb

A tutorial on how to create gambling games for rm2k

Body

Hi, this is my first tutorial. I hope its informative and explains everything well. I tried to keep this detailed,
so a newbie wouldnt get lost.

Introduction:
Ok, basically this is a simple tutorial on how to be ANY amount of money in rm2k, and
then win it back, lose it, or whatever.
I think the main use of this would be for gambling games, such as Blackjack or such, however it has
more then the one use.

Knowledge you need:
An understanding of variables and forks, and a basic understanding of rm2k helps to understand it, but
isnt strictly necessery.


The actual nitty-gritty:

Alright, first of all create a new event. This can be set to whatever you want, for purposes of this
tutorial I am using a dealer in a gambling game who is set to push key. First of all place a label straight
away, this will be usefull for later.
Second of all, you might want to have the dealer ask you to place a bet.
After this, we use an input number command.

Code so far:

<>LABEL: 1No
<>Messg: Dealer
: Place your bet
<>Input Number: 3dg[0001:Bet]

The input number command, basically asks the player to put in a number which is a set number
of digits long. In this case it is 3 digits (3dg). This number is then stored into a variable. The
variable number is not important, Im using 1 for this tutorial. (Note: 0001 just equals 1 ;))

Now, we want to have a check, to see if the player can afford (or has) that amount of money.
First of all, we need to know how much money he has to do this we go to 'change variable'.
We pick a variable (I use 2), choose 'set', and then check 'other' and choose 'money' from the
drop box.
All this does is, store the amount of money you have in a variable (handy for other things too).

This next bit is straight forward. If the amount of money, is less then the amount betted
then he does not have that money. Therefore, we do a fork condition(uncheck the ELSE case).
If the players money (variable 2) is less then the amount betted (variable 1)... then do whatevever.
You can simply make the dealer say 'You dont have enough money' and go back to label 1 (the one
we created at the very start). This will make the player have to place a bet again.

Code so far:

<>LABEL: 1No
<>Messg: Dealer
Place your bet
<>Input Number: 3dg[0001:Bet]
<>Variable Ch:[0002:Money]Set,Money#
<>FORK Optn: Varb[0002:Money]-V[0001]less than
<>Messg: Dealer
: You dont have enough money to make that bet
<>GotoLabel: 6No
<>
:END Case

Now, to make it simpler for later, we take away the amount betted from the amount of money he has.
Use a 'change money' command, and decrease the money by the 1st (Amount bet) variable.
This is so that when the player loses, you dont have to decrease it then.

<>ChangeMoney: Money V[0001]Decr.

Now, we've got everything out of the way for the actual betting, now we need some commands for a draw,
win and a loss.
Next should probablly be the coding for your gambling game, or whatever.

Now, for a loss we dont need to do anything. You've already taken away the bet from his money, so all you
need to do is perhaps have a message telling him he lost.

For a draw, you either give him his money back, or you play again. If you play again, then use some labels.
As for giving him his money back, just do the opposite of the code where we took away the bet.(Increase his
money by the bet variable).

<>Change Money: Money V[0001]Incr.

As for winning, you get how much you betted + your original bet back. So basically 2x your original bet
(the amount won can be changed, this is just for this tutorial).
So we go to 'change variable', select the bet variable (how much he bet) and * it by 2.
Then we add this new variable onto his money, as above.

<>Variable Ch:[0001:Bet]*,2
<>Change Money: Money V[0001]Incr.


Thats all there is to it. I hope this tutorial helps you, and you understand it, or I hope I didnt detail it too much :-P

Here is the completed coding, but of course I couldnt everything in properlly as there's no gambling game going on.


<>LABEL: 1No
<>Messg: Dealer
Place your bet
<>Input Number: 3dg[0001:Bet]
<>Variable Ch:[0002:Money]Set,Money#
<>FORK Optn: Varb[0002:Money]-V[0001]less than
<>Messg: Dealer
: You dont have enough money to make that bet
<>GotoLabel: 6No
<>
:END Case
<>ChangeMoney: Money V[0001]Decr.
<>FORK Optn: (DRAW)
<>Messg: Dealer
: Its a draw! You win your money back
<>Change Money: Money V[0001]Incr.
:END Case
<>FORK Optn: (WIN)
<>Messg: Dealer
: You won! You win double your money
<>Variable Ch:[0001:Bet]*,2
<>Change Money: Money V[0001]Incr.
:END Case
<>FORK Optn: (LOSE)
<>Messg: Dealer
: You lose! I keep your money
:END Case