Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

RMXP/VX Bank tutorial

Hey, there! This is my first tutorial, so tell me how I'm doing!

First off, I'm sure there are more tutorials for this that are probably better, but I'm gonna post this just in case.

1) You'll want to create a few variables. This is what I named them:
1 Deposit
2 Bank Gold
3 Hero Gold
4 Withdraw
5 Interest

I'll go over what each of those will do later.

2) Go into the database and create 2 new common events (If you want more than one bank) Name the first one deposit and the second one withdraw.

On the deposit event,
make it look like this:

bank_ce-1.jpg


The control variable in the beginning defines what that variable is, so it won't mess it up.
I always do 7 digits for my imput number, so I've never tried more or less. Make the imput number define the variable deposit.
Create a conditional branch and say if variable: deposit is less than or equal to variable: Hero Gold.

If so,

Control Variable: Bank Gold + Variable: Deposit
Control Gold: Decrease - Variable: Deposit
Control Variable: Deposit = 0

That will take the number the player put in and add it to the variable bank gold which keeps track of how much gold is in the account.

If Not,

Show text saying the player doesn't have that much. That's all that I did. You can make it different, but that's for you to decide.

Now, for the withdraw.

Make the common event look like this:
bank_ce2.jpg


Now, again make an imput number, this time defining the withdraw variable.
Create a conditional branch saying if variable: withdraw is less than or equal to variable: bank gold.

If so,

Control Variable: Bank gold - Variable: Withdraw
Control Gold: Increase = Variable: Withdraw
Control Variable: Withdraw= 0

basically it does the same thing as deposit only backwards. It checks if the player's account has enough in it, then gives that money to the player while taking money out of the account.

If not,

Say text saying the player's account doesn't have enough.

Activating the Bank

Activating it is easy:
bank_ev1.jpg


Create a new event. Make it have a choice, Deposit or Withdraw.
In each one, call that common event. It's that easy!

Interest

Interest is now added, thanks to the request by shuu.

Interest is a lot more complicated than the other 2. It's all about math. Everything has to be right or it won't work. You might want to follow the picture before trying to change the interest system.

Okay, let's get started. First, you're going to want to make another common event and another variable. I named them both Interest to make it easy to know what it is.

Here's what it'll look like:
bank_ce-3.jpg


Okay, it's very confusing, so follow along carefully. If you ever get lost, feel free to ask for help.

First, define what interest is. I just set it at 100.
Divide variable: Interest by variable: Bank Gold
Divide variable: Interest by 5 (Uneeded, but lowers the interest further to make it 1/2 less.)
Last step. Add variable: Bank Gold (Top selected variable) by variable interest (Bottom selected variable). The math in RMXP is backwards, but whatever.

To call interest, you'll want to call it whenever you think they should get it. If you have a Day/Night system, getting it every morning would make sense. Every week would too, but I'd do it every day. If you don't have a day/night system, them you could do it every time they deposit, but to make it where interest will only come in when you make a deposit over 0 is a bit harder.
You'll need another conditional branch in the conditional branch in the deposit event.
Inside the conditional, verify if deposit = 0

If so,

This is when the deposit is 0. Make it say something like 'You can't deposit nothing!' or something along those lines. DON'T call common event: interest.

If not,

This is when it's over 0. Cut the old deposit inside the conditional, and paste in here (Paste Control Variable: Bank Gold + Variable: Deposit Control Gold: Decrease - Variable: Deposit Control Variable: Deposit = 0 if you don't know what I'm talking about) NOW you call common event: interest.

Well, that's it for my tutorial. How did I do? I'd love to hear how it helped you and how it could be better!
If anyone wants it, I'm working on a loan system now as well.
 

Shuu

Member

Hey, very clear. I was planning to code a bank too - I guess you finished it before I did, though it would be better if you add interests in it...
 
Hey I'm currently adding this to my game with a small addon to it, (Making the banker go to a safe to grab the money seeing as i don't have a cash register tile or bank tileset.

Thanks for the tip on this one, I like this idea.

I'm not adding interest but In higher class banks I will be adding interest on a timer, based on a 24 hour game system. ;) no day/night system in the game but it'll be based on the in game clock.
 

Shuu

Member

Thanks man, harvest, this looks good. I'm gonna try it out.

well done. I guess we didn't need scripting for this to work. (that's what I thought I would need)
 
If I have more then one bank I want to make, will the money transfer from town to town with this, or do the characters need to withdraw prior to leaving and redeposit as they go from city to city....sorry for the noobish question.
 
If you use the same common events, it should transfer automatically.

If you use different common events it will not transfer from bank to bank.
 
I have one suggestion.

In the Withdraw section you should change it for new users to say this.

"You currently have \v[N] in the bank. How much would you like to withdraw?"

and Explain that they use \v[N] as the variable number of there BANK GOLD (in my case 2 so \v[2]) and it will show them how much money the bank is holding for them. ;)

Makes for a more secure and simple way to see what you have sitting in the bank, I had to ask how to use a variable in my "Show Text" because i'm still a noob :P
 

Shuu

Member

I suggest multiplying bank gold by a random number from 1-5 or so, then dividing by 100 so that you get a fractional interest rate. Add that to bank gold and you get a growing stash of cash. But, when is it best for you to activate that interest common event is still unknown...
 
I skipped the interest. Though it's a nifty idea, in the time of my game, there won't be bank interest needed, plus that's too much earned if u leave the game on overnight, Think of the days in game that go by. BOOM after 100 starting in bank with x interest u just made a ton.

If i added interest i'd put a 24 hour limit, if u don't pick your interest up within 24/48/72 hours, you can still get it, but it stops growing until you grab it. (granted the cheat would be add 1 gold every 23/47/71hours to make it count more days again) it still limits them to require the user to be around within x amount of time.
 

Jking

Member

i like events an all but banks are much better as scripts with a screen and all that they look much better then this would.
 
not really, It's not hard to make an event look decent. youtube and look up KDawg08 or Lost Legend, there is a small video to show a crap version of the bank (That's not a finished bank video) just a quick draft
 
I skipped interest, and it works by adding the gold but when you take it out you can't.It says you don't have enough money in the bank. Please help me.
 

Krysis

Member

Thanks for everything :D it was perfectly clear and i loved it. i have been looking so long for tutorials on banks, just too lazy to figure it out myself.. lol
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top