Sistema De Banco Para O RM2K

3 de janeiro de 2012

Mais um tutorial que ensina a fazer um sistema de banco num jogo ou projeto de RPG Maker 2000 (provavelmente compatível com o 2003 também). Não apresenta nada muito complicado, mas é longo e mais completo que os outros sistemas de banco para RM2k que postamos antes. É recomendável ter um conhecimento razoável de variáveis do RM2k/2k3 também.

O texto está em inglês, e é de autoria de Gauntlet Wizard, e ele disse que embora você possa usar o seu sistema livremente, não esqueça de dar os devidos créditos para ele… Custa nada né?

RM2K Tutorial:  Excellent Bank System
  by Gauntlet Wizard

I read a couple other bank tutorials and didn't like 'em, so I wrote my own.
This tutorial will tell you how to make an effective bank or ATM like the one
in the Earthbound video game. 
Note:  You need to have a thorough understanding of variables if you want
to attempt this.  We'll be using several variables and you probably won't
understand the whole thing if you don't know they work.
Okay, let's get on with it.  To make an ATM like the one in Earthbound:

First, you need an introduction message.  Something like, "Welcome to
the Automatic Teller Machine.  Please select a transaction:"
Then give a choice between Withdrawal and Deposit.
It should look much like this now:

<>Messg:Welcome to the Automatic Teller Machine.
:  :Please select a transaction:
<>Show Choice: Withdrawal/Deposit
:[Withdrawal] Case
  <>
:[Deposit] Case
  <>
:CANCEL Case
  <>
:END Case
<>

But we haven't gotten to the hard part yet.
Go assign these titles to variables:  Current Money, Account Money,
 Withdraw Money, Deposit Money.  In this tutorial, I'll assume 
Variable 1 is "Current Money", Variable 2 is "Account Money", and so on.

In the withdrawal case, insert a label numbered 1.
You'll know what it's for soon.
Next in the withdrawal case, you need to tell them how much money is 
in their account.  Using the \v[?] command in a message displays the
 value of the variable numbered "?".  \v[1] would show the value of
 variable 1, etc.  Then you need to ask how much they wish to withdraw.
That whole paragraph looks something like this:

:[Withdrawal] Case
  <>LABEL:  1No
  <>Messg:Your account currently shows a balance of
 :   :\v[2] dollars.  Please enter the amount
 :   :of the withdrawal.

We use \v[2] because variable 2 is the one we assigned for "Account Money."
Now we're getting to the tough part.
You need to have the player input the amount (s)he wishes to withdraw,
then give the player that much money and take that much out of the bank
account.  You also need to make sure that the player cannot take more
money than is in the account.

:[Withdrawal] Case
  <>LABEL:  1No
  <>Messg:Your account currently shows a balance of
 :   :\v[2] dollars.  Please enter the amount
 :   :of the withdrawal.
  <>Input Number: 6 Dg.[0003:Withdraw Money]
  <>FORK Optn: Varbl[0003:Withdraw Money]-V[0002]less
    <>Messg:Your account has been debited
   :   :\v[3] dollars.  Please take your cash.
    <>Change Money: Money V[0003] Incr.
    <>Variable Ch:[0002: Account Money]-, Var.[0003]val.
  :ELSE Case
  <>Messg:The amount you entered is in excess of
  :  :your current bank balance.
  <>GOTOLabel:  1No
  <>
  :END Case
  <>

Phew.  That might have been too much to absorb.  Here's what that does:
-Sets Label #1.
-Shows the message:  Your account currently...
-Lets the player input the amount of money to withdraw.
->If that amount is less than or equal to the amount of money in their account:
  -Shows the message:  Your account has been debited...
  -Gives the player the amount of money he/she entered.
  -Removes that much money from the bank account.
->If the amount entered is greater than the amount in the bank:
  -Shows the message:  The amount you entered is in excess...
  -Goes back to Label #1.

Simple enough, no?  Now for the next part, deposit.
I'll show you the event commands then tell you what they do.

:[Deposit] Case
  <>LABEL:  2No
  <>Variable Ch:[0001:Current Money] Set, Money#
  <>Messg:Your account currently shows a balance
 :   :of \v[2] dollars.  Please enter the amount
 :   :that you wish to deposit.
  <>Input Number: 6 Dg.[0004:Deposit Money]
  <>FORK Optn: Varbl[0004:Deposit]-V[0001]less
    <>Messg:Thank you.  Your account has been credited
   :   :\v[4] dollars.
    <>Change Money: Money V[0004] Decr.
    <>Variable Ch:[0002: Account Money]+, Var.[0004]val.
    <>
  :ELSE Case
    <>Messg:The amount that you wish to deposit is in
   :   :excess of the amount that you a currently holding.
    <>GOTOLabel: 2No.

What it does:
-Sets Label #2.
-Sets variable #1 to have the same value as the amount of money that
 you  are carrying.
-Shows the message: Your account currently shows...
-Lets the player input the amount of money he/she wishes to deposit.
->IF the amount to deposit is less than the amount that the player is
 currently holding:
 -Shows the message: Thank you.  Your account has been credited...
 -Takes away from the hero the amount of money that is being deposited.
 -Adds the deposit amount to the Account Balance.
->IF the amount to deposit is greater than the amount that the player
 is currently holding:
 -Shows the message: The amount that you wish to deposit...
 -Goes back to label #2

Catch all that?  Good.  Here's what the entire event should look like:

<>Messg:Welcome to the Automatic Teller Machine.
:  :Please select a transaction:
<>Show Choice: Withdrawal/Deposit
:[Withdrawal] Case
  <>LABEL:  1No
  <>Messg:Your account currently shows a balance of
 :   :\v[2] dollars.  Please enter the amount
 :   :of the withdrawal.
  <>Input Number: 6 Dg.[0003:Withdraw Money]
  <>FORK Optn: Varbl[0003:Withdraw Money]-V[0002]less
    <>Messg:Your account has been debited
   :   :\v[3] dollars.  Please take your cash.
    <>Change Money: Money V[0003] Incr.
    <>Variable Ch:[0002: Account Money]-, Var.[0003]val.
  :ELSE Case
  <>Messg:The amount you entered is in excess of
  :  :your current bank balance.
  <>GOTOLabel:  1No
  <>
  :END Case
  <>
:[Deposit] Case
  <>LABEL:  2No
  <>Variable Ch:[0001:Current Money] Set, Money#
  <>Messg:Your account currently shows a balance
 :   :of \v[2] dollars.  Please enter the amount
 :   :that you wish to deposit.
  <>Input Number: 6 Dg.[0004:Deposit Money]
  <>FORK Optn: Varbl[0004:Deposit]-V[0001]less
    <>Messg:Thank you.  Your account has been credited
   :   :\v[4] dollars.
    <>Change Money: Money V[0004] Decr.
    <>Variable Ch:[0002: Account Money]+, Var.[0004]val.
    <>
  :ELSE Case
    <>Messg:The amount that you wish to deposit is in
   :   :excess of the amount that you a currently holding.
    <>GOTOLabel: 2No.
    <>
:CANCEL Case
  <>
:END Case
<>

Well, there you have it.  The excellent bank tutorial.
You might want to alter the text to make it more fit for a fantasy
or sci-fi type game.  If you read this tutorial and then use this
bank system in your game, please make sure you give me credit and
don't call it your own idea.  When you take credit for somebody
else's work, it's called plagiarism.

Contact me:
  E-mail - gauntletwizard at yahoo dot com
  AOL IM - gauntletjackal

That's all for now.
 ~Gauntlet Wizard  ^_^

Observação: se você gostou deste post ou ele lhe foi útil de alguma forma, por favor considere apoiar financeiramente a Gaming Room. Fico feliz só de ajudar, mas a contribuição do visitante é muito importante para que este site continua existindo e para que eu possa continuar provendo este tipo de conteúdo e melhorar cada vez mais. Clique aqui e saiba como. Obrigado!

Deixe um comentário

Inscreva-se na nossa newsletter!