Tutorials:Bank Tutorial

From Charas Project

Revision as of 04:17, 6 September 2007 by FFL (Talk | contribs)
(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)

Bank Tutorial

Written By: Daetyrnis
Difficulty: *****

This tutorial outlines and explains how you can implement a bank system into your game. Because the nature of banks is that you can withdraw your money from anywhere, you'll need several bank event locations. You will be making only one event with this tutorial, but you will need to copy and paste it to other places to get the full effect of the system. We start by making an event that will be the actual bank system. Make it Same Level as Hero and give it the graphic of a bankteller. On the first page, we let the player decide whether they want to start an account. This is simple enough. Place a 'Show Message' command followed by a 'Show Choice' command to get this done. What we get is something like this.

RPGM Code:
Event: {{{evntname}}}

<> Show Message: Welcome to the bank. Would you like to start an account?
<> Show Choices: Yes/No

[Yes] Handler
<> Change Switch: [0001:Bank Account] - ON
<> Show Message: Your account has been made
[No] Handler
<> Show Message: Very well, good day to you.


You can add to this later, but for now, it fits our purposes. Remember that along with the following code, this should be included in every bank event. The player could decide to start an account at any given time.

Now we need the player to be able to withdraw and deposit their money. For this we will need a total of 3 variables. We'll call them

RPGM Code:
Event: {{{evntname}}}

Variable [0001: Current Money]
Variable [0002: Bank Money]

Variable [0003: Bank Input]


Current Money will store the amount of money that the player currently has. Bank Money will be the running total of money stored in the bank system. And Bank Input will be what we use for the player to decide how much money to withdraw or deposit.

Now, lets make the actual bank system: the part that allows the player to withdraw and deposit their money at will. Make a new page in the event, giving it the prerequisite of Switch[0001:Bank Account] - ON. We start with a choice of withdrawing, depositing, or doing nothing. A good thing to do is show the player how much money they currently have by using '\\$'. We also show the amount of money in the bank by using '\\v[2]' to show the current value of the second variable: Bank Money.

RPGM Code:
Event: {{{evntname}}}

<> Show Message: Welcome to the bank. What would you like to do?
<> Show Message: \\$Your account currently has \\v[1] gold in it.
<> Show Choices: Withdraw/Deposit/Nothing

[Withdraw] Handler

...

[Deposit] Handler

...

[Nothing] Handler
<> Show Message: Very well, good day to you.


Let's begin with what happens upon choosing Withdraw. First, show a message asking how much to withdraw, along with showing the player's current money and bank money. Then we use a a'Input Number' command so the player can choose the amount.

RPGM Code:
Event: {{{evntname}}}

<> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to withdraw?

<> Input Number: 6 digits [0003: Bank Input]


Next, we have to make sure the player isn't withdrawing more money than they have in the bank. We do this with a simple conditional fork.

RPGM Code:
Event: {{{evntname}}}

<>Fork Option: Var[0003: Bank Input] equal to or less than Var[0002: Bank Money]
...
ELSE case

<> Show Message: Sorry, you don't have that much to withdraw.


If all is fine, then we subtract Bank Input from Bank Money and add Bank Input to the player's money.

RPGM Code:
Event: {{{evntname}}}

<> Change Variable: [0002: Bank Money] minus [0003: Bank Input] value

<> Change Money: Increase by [0003: Bank Input] value


So all together, withdrawing will look like this.

RPGM Code:
Event: {{{evntname}}}

<> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to withdraw?
<> Input Number: 6 digits [0003: Bank Input]
<>Fork Option: Var[0003: Bank Input] equal to or less than Var[0002: Bank Money]

<> Change Variable: [0002: Bank Money] minus [0003: Bank Input] value
<> Change Money: Increase by [0003: Bank Input] value

ELSE case

<> Show Message: Sorry, you don't have that much to withdraw.


Depositing is very similar. The only differences are that you have to assign the player's money to a variable, and check that the input is lower than that. And of course how it affects the player's money.

RPGM Code:
Event: {{{evntname}}}

<> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to deposit?
<> Input Number: 6 digits [0003: Bank Input]
<> Change Variable [0001: Current Money] set Money value
<>Fork Option: Var[0003: Bank Input] equal to or less than Var[0001: Current Money]

<> Change Variable: [0002: Bank Money] add [0003: Bank Input] value
<> Change Money: Decrease by [0003: Bank Input] value

ELSE case

<> Show Message: Sorry, you don't have that much to deposit.


All together...

RPGM Code:
Event: {{{evntname}}}

<> Show Message: Welcome to the bank. What would you like to do?
<> Show Message: \\$Your account currently has \\v[1] gold in it.
<> Show Choices: Withdraw/Deposit/Nothing

[Withdraw] Handler
<> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to withdraw?
<> Input Number: 6 digits [0003: Bank Input]
<>Fork Option: Var[0003: Bank Input] equal to or less than Var[0002: Bank Money]
<> Change Variable: [0002: Bank Money] minus [0003: Bank Input] value
<> Change Money: Increase by [0003: Bank Input] value
ELSE case
<> Show Message: Sorry, you don't have that much to withdraw.
[Deposit] Handler
<> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to deposit?
<> Input Number: 6 digits [0003: Bank Input]
<> Change Variable [0001: Current Money] set Money value
<>Fork Option: Var[0003: Bank Input] equal to or less than Var[0001: Current Money]
<> Change Variable: [0002: Bank Money] add [0003: Bank Input] value
<> Change Money: Decrease by [0003: Bank Input] value
ELSE case
<> Show Message: Sorry, you don't have that much to deposit.
[Nothing] Handler
<> Show Message: Very well, good day to you.


There are a few things that you can do to add to the system. You can add interest so that the player's money grows. You do this by doing the following (adds 1% to Bank Money).

RPGM Code:
Event: {{{evntname}}}

<> Change Variable: [0004: Interest] set [0002: Bank Money] value
<> Change Variable: [0004: Interest] divide by 100

<> Change Variable: [0002: Bank Money] add [0004: Interest] value


Do this at the end of every battle, at the end of every day (if you're using a day/night system), or any other time you see fit.


Also, you can give the player certain benefits in the form of items. These items can range from common potions to rare items only obtainable with the bank. Examples of times to give items are

  • Upon starting an account
  • Reaching certain levels of deposited money (such as 1000, 5000, 10000, 20000, etc.)
  • Being a member of the bank for a long time (usually requires day/night system)
There are more things that you can add to spice up your bank, as these are only the basics.

Personal tools