Tutorials:Bank Tutorial
From Charas Project
m (Reverted edit of Lord Foil1212, changed back to last version by Daetyrnis) |
|||
(3 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 8: | Line 9: | ||
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. | 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. | ||
- | + | {{code|code=<> Show Message: Welcome to the bank. Would you like to start an account?<br /> | |
- | <> Show Message: Welcome to the bank. Would you like to start an account?<br /> | + | |
<> Show Choices: Yes/No<br /> | <> Show Choices: Yes/No<br /> | ||
: [Yes] Handler<br /> | : [Yes] Handler<br /> | ||
- | <> Change Switch: [0001:Bank Account] - ON<br /> | + | ::<> Change Switch: [0001:Bank Account] - ON<br /> |
- | <> Show Message: Your account has been made<br /> | + | ::<> Show Message: Your account has been made<br /> |
- | : [No] Handler<br /> | + | : [No] Handler<br /> |
- | <> Show Message: Very well, good day to you. | + | ::<> 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. | 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. | ||
Line 22: | Line 21: | ||
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 | 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 | ||
- | + | {{code|code=Variable [0001: Current Money]<br /> | |
- | Variable [0001: Current Money]<br /> | + | |
Variable [0002: Bank Money]<br /> | Variable [0002: Bank Money]<br /> | ||
- | Variable [0003: Bank Input] | + | 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. | 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. | ||
Line 32: | Line 29: | ||
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. | 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. | ||
- | + | {{code|code=<> Show Message: Welcome to the bank. What would you like to do?<br /> | |
- | <> Show Message: Welcome to the bank. What would you like to do?<br /> | + | |
<> Show Message: \\$Your account currently has \\v[1] gold in it.<br /> | <> Show Message: \\$Your account currently has \\v[1] gold in it.<br /> | ||
<> Show Choices: Withdraw/Deposit/Nothing<br /> | <> Show Choices: Withdraw/Deposit/Nothing<br /> | ||
Line 41: | Line 37: | ||
... | ... | ||
: [Nothing] Handler<br /> | : [Nothing] Handler<br /> | ||
- | <> Show Message: Very well, good day to you. | + | <> 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. | 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. | ||
- | + | {{code|code=<> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to withdraw?<br /> | |
- | <> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to withdraw?<br /> | + | <> Input Number: 6 digits [0003: Bank Input]}} |
- | <> 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. | 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. | ||
- | + | {{code|code=<>Fork Option: Var[0003: Bank Input] equal to or less than Var[0002: Bank Money]<br /> | |
- | <>Fork Option: Var[0003: Bank Input] equal to or less than Var[0002: Bank Money]<br /> | + | ...<br /> |
- | ... | + | ELSE case<br /> |
- | + | :<> Show Message: Sorry, you don't have that much to withdraw.}} | |
- | <> 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. | If all is fine, then we subtract Bank Input from Bank Money and add Bank Input to the player's money. | ||
- | + | {{code|code=<> Change Variable: [0002: Bank Money] minus [0003: Bank Input] value<br /> | |
- | <> Change Variable: [0002: Bank Money] minus [0003: Bank Input] value<br /> | + | <> Change Money: Increase by [0003: Bank Input] value}} |
- | <> Change Money: Increase by [0003: Bank Input] value | + | |
- | + | ||
So all together, withdrawing will look like this. | So all together, withdrawing will look like this. | ||
- | + | {{code|code=<> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to withdraw?<br /> | |
- | <> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to withdraw?<br /> | + | |
<> Input Number: 6 digits [0003: Bank Input]<br /> | <> Input Number: 6 digits [0003: Bank Input]<br /> | ||
<>Fork Option: Var[0003: Bank Input] equal to or less than Var[0002: Bank Money]<br /> | <>Fork Option: Var[0003: Bank Input] equal to or less than Var[0002: Bank Money]<br /> | ||
:<> Change Variable: [0002: Bank Money] minus [0003: Bank Input] value<br /> | :<> Change Variable: [0002: Bank Money] minus [0003: Bank Input] value<br /> | ||
:<> Change Money: Increase by [0003: Bank Input] value<br /> | :<> Change Money: Increase by [0003: Bank Input] value<br /> | ||
- | + | ELSE case<br /> | |
- | <> Show Message: Sorry, you don't have that much to withdraw. | + | :<> 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. | 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. | ||
- | + | {{code|code=<> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to deposit?<br /> | |
- | <> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to deposit?<br /> | + | |
<> Input Number: 6 digits [0003: Bank Input]<br /> | <> Input Number: 6 digits [0003: Bank Input]<br /> | ||
'''<> Change Variable [0001: Current Money] set Money value'''<br /> | '''<> Change Variable [0001: Current Money] set Money value'''<br /> | ||
Line 88: | Line 74: | ||
:<> Change Variable: [0002: Bank Money] '''add''' [0003: Bank Input] value<br /> | :<> Change Variable: [0002: Bank Money] '''add''' [0003: Bank Input] value<br /> | ||
:<> Change Money: '''Decrease''' by [0003: Bank Input] value<br /> | :<> Change Money: '''Decrease''' by [0003: Bank Input] value<br /> | ||
- | + | ELSE case<br /> | |
- | <> Show Message: Sorry, you don't have that much to deposit. | + | :<> Show Message: Sorry, you don't have that much to deposit.}} |
- | + | ||
All together... | All together... | ||
- | + | {{code|code=<> Show Message: Welcome to the bank. What would you like to do?<br /> | |
- | <> Show Message: Welcome to the bank. What would you like to do?<br /> | + | |
<> Show Message: \\$Your account currently has \\v[1] gold in it.<br /> | <> Show Message: \\$Your account currently has \\v[1] gold in it.<br /> | ||
<> Show Choices: Withdraw/Deposit/Nothing<br /> | <> Show Choices: Withdraw/Deposit/Nothing<br /> | ||
: [Withdraw] Handler<br /> | : [Withdraw] Handler<br /> | ||
- | <> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to withdraw?<br /> | + | ::<> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to withdraw?<br /> |
- | <> Input Number: 6 digits [0003: Bank Input]<br /> | + | ::<> Input Number: 6 digits [0003: Bank Input]<br /> |
- | <>Fork Option: Var[0003: Bank Input] equal to or less than Var[0002: Bank Money]<br /> | + | ::<>Fork Option: Var[0003: Bank Input] equal to or less than Var[0002: Bank Money]<br /> |
- | :<> Change Variable: [0002: Bank Money] minus [0003: Bank Input] value<br /> | + | :::<> Change Variable: [0002: Bank Money] minus [0003: Bank Input] value<br /> |
- | :<> Change Money: Increase by [0003: Bank Input] value<br /> | + | :::<> Change Money: Increase by [0003: Bank Input] value<br /> |
- | : ELSE case<br /> | + | ::ELSE case<br /> |
- | <> Show Message: Sorry, you don't have that much to withdraw.<br /> | + | :::<> Show Message: Sorry, you don't have that much to withdraw.<br /> |
: [Deposit] Handler<br /> | : [Deposit] Handler<br /> | ||
- | <> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to deposit?<br /> | + | ::<> Show Message: \\$You have \\v[2] gold in the bank. How much do you wish to deposit?<br /> |
- | <> Input Number: 6 digits [0003: Bank Input]<br /> | + | ::<> Input Number: 6 digits [0003: Bank Input]<br /> |
- | <> Change Variable [0001: Current Money] set Money value<br /> | + | ::<> Change Variable [0001: Current Money] set Money value<br /> |
- | <>Fork Option: Var[0003: Bank Input] equal to or less than Var[0001: Current Money]<br /> | + | ::<>Fork Option: Var[0003: Bank Input] equal to or less than Var[0001: Current Money]<br /> |
- | :<> Change Variable: [0002: Bank Money] add [0003: Bank Input] value<br /> | + | :::<> Change Variable: [0002: Bank Money] add [0003: Bank Input] value<br /> |
- | :<> Change Money: Decrease by [0003: Bank Input] value<br /> | + | :::<> Change Money: Decrease by [0003: Bank Input] value<br /> |
- | : ELSE case<br /> | + | ::ELSE case<br /> |
- | <> Show Message: Sorry, you don't have that much to deposit.<br /> | + | :::<> Show Message: Sorry, you don't have that much to deposit.<br /> |
: [Nothing] Handler<br /> | : [Nothing] Handler<br /> | ||
- | <> Show Message: Very well, good day to you. | + | ::<> 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). | 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). | ||
- | + | {{code|code=<> Change Variable: [0004: Interest] set [0002: Bank Money] value<br /> | |
- | <> Change Variable: [0004: Interest] set [0002: Bank Money] value<br /> | + | |
<> Change Variable: [0004: Interest] divide by 100<br /> | <> Change Variable: [0004: Interest] divide by 100<br /> | ||
- | <> Change Variable: [0002: Bank Money] add [0004: Interest] value | + | <> 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. | 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. | ||
Line 136: | 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)