Tutorials:Bank Tutorial
From Charas Project
(Updated with Code Template) |
m (Reverted edit of Lord Foil1212, changed back to last version by Daetyrnis) |
||
(2 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | + | <font style="font-size: 28px; font-weight:italic;">Bank Tutorial</font><br> | |
- | + | <p><font style="font-size: 16px;">Written By: [[Daetyrnis]]<br></font> | |
+ | [[Tutorials:Difficulty Rating|Difficulty]]: *****<br><br> | ||
This tutorial outlines and explains how you can implement a bank system into your game. | This tutorial outlines and explains how you can implement a bank system into your game. | ||
Line 116: | Line 117: | ||
There are more things that you can add to spice up your bank, as these are only the basics. | There are more things that you can add to spice up your bank, as these are only the basics. | ||
+ | |||
+ | [[Category:Tutorials]] |
Current revision as of 04:17, 6 September 2007
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?
|
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] |
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?
...
...
|
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? |
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]
|
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 |
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?
ELSE case
|
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?
ELSE case
|
All together...
RPGM Code: |
Event: {{{evntname}}} <> Show Message: Welcome to the bank. What would you like to do?
|
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 |
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)