| Tutorial: | Bank System |
| Difficulty: | Intermediate |
| RPG Maker: | 2000/2003 |
| Author: | Kiran |
Start by creating a Common Event and labeling it "Bank System" then set the Trigger to Call.
<>Variable Oper: [0001:Money Held]Set,Money
Next create three Variables, naming them "Money Held", "Money in Bank", and "Transaction".
To avoid confusion in the following Event Commands, the Variable ID's will belong to the following: "Money Held" = 0001, "Money in Bank" = 0002, "Transaction" = 0003. Now the Event Commands should look like this:
<>Message: You are currently holding $\v[1],
: and you have $\v[2] in the bank.
<>Message: Choose a transaction.
<>Show Choices: Withdraw/Deposit
:[Withdraw]Handler
<>Branch if Var [0002:Money in Bank]is 0
<>Message: You have no money in the bank.
<>
:Else Handler
<>Message: How much would you like to withdraw?
<>Input Number:7 Digit,[0003: Transaction]
<>Branch if Var [0003:Transaction] is V[0002]Less/Equal
<>Variable Oper: [0002:Money in Bank]-, Var [0003]'s Value
<>Change Money: V[0003]Add
<>Variable Oper: [0003:Transaction]Set,0
<>Message: Transaction complete.
<>
:Else Handler
<>Message: You don't have that much money in the bank.
<>
:End
<>
:End
<>
:[Deposit]Handler
<>Branch if Var [0001:Money Held]is 1 Less
<>Message: I'm sorry but you don't have any money
: to deposit.
<>
:Else Handler
<>Message: How much would you like to deposit?
<>Input Number:7 Digit,[0003:Transaction]
<>Branch if Var [0003:Transaction] is V[0001]Less/Equal
<>Variable Oper: [0002:Money in Bank]+, Var [0003]'s Value
<>Change Money: V[0003]Remove
<>Variable Oper: [0003:Transaction]Set,0
<>Message: Transaction complete.
<>
:Else Handler
<>Message: You don't have that much money.
<>
:End
<>
:End
<>
:Cancel Handler
<>
In order to activate this Event, simply use Event Command, Call Event. And select the Common Event "Bank System".
Click to Return to the Tutorials Page