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.

HBGames

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:



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:


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:


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:


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.

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