Gw Temp

Menu

Tutorial - 'RM2K Banking System' by Rhynir

An item about RPGMaker 2000 posted on

Blurb

Read Rhynir's tutorial on creating simple, efficient banking systems for your RPGMaker 2000 games.

Body

This is just a basic bank system, no interest, but it does work!

First, create 4 variables; Current money, Current Account, Withdraw, and Deposit.

The Variable Current Money should have the MONEY Operand.

(*:Acutal Code)

First, a message of the bank.

*Mess: Welcome to Bank!

Then we need some choices, withdraw, deposit, and none.

*ShowChoice: Withdraw/Deposit/None

First, we'll do the Withdraw case.

*Withdraw Case:

Then we'll need to know how much money we have in the bank, so, we'll make a message for it.

*Mess: You have v\[Current Account Variable] in the bank, how much do you want to withdraw?

Then we'll have another message with an input number. The input number is your choice, I use five slots. And store the number into the variable Withdraw

*Mess: \v[Current Account Variable]

*Input number:[5 digits] Variable:[Withdraw]

Now, we're gonna fork the conditions to make sure we don't take out more money than we have in the bank.

*Fork Conditions:

*IF Variable[Withdraw] is equal to or less than Variable[Current Account]:

So if it works, then we'll have to add the withdraw to our account. So, we'll do so. Instead of a set amount, just have it set to variable[withdraw]

*Change Money:Variable[Withdraw] [Add]

Then we'll have to subract the money from the account.

*Change Variable[Current Account] Minus Variable[Withdraw]

Then we'll set withdraw back to zero.

*Change Variable[Withdraw] set (0)

Then a message is optional.

*Mess: Thank you, have a nice day.

Now, we'll do the Deposit Case.

First, we'll have another message.

*Deposit Case:.

First, make the variable Current Money set to the Money Operand.

*Change Variable[Current Money] Set = Money

*Mess: How much do you want to deposit?

Then we'll have another message showing how much money you have and the input number. Store the input number into the variable[Deposit]. Make the input number have 5 or so digits.

*Mess: \v[Current Money]
*Input Number [5 digits] Variable [Deposit]

Now we gotta make sure that you aren't putting more money into the bank than you have. Make a fork conditions where Variable[Deposit] is Equal to or less than Variable[Current Money].

*Fork Conditions: IF Variable[Deposit] is equal to or less than Variable[Current Money]

Then we subtract it from your current money. Instead of a set amount, make it minus variable[Deposit].

*Change Money: Variable[Deposit] Minus

Then we need to add the Deposit to our account.

*Change Variable[Current Account] ADD Varaible[Deposit]

Then set Deposit to zero.

*Change Variable[Deposit] Set 0

And the optional Message.

*Mess: Thank you, have a nice day.

For the two ELSE conditions for the forks, you can have messages that say stuff like "You don't have the money." or something like that. And that's that tutorial!

Actual Code: (V1 = Current Money, V2 = Current Account, V3 = Withdraw, V4 = Deposit Currency = Your unit of money)

*Message: Welcome to the bank.
*Message: What do you want to do?
*Show Choice: Withdraw/Deposit/None
*Withdraw Case:
*Message: You have \v[2] "currency" in the bank, how much do you want to withdraw?
*Input Number (Digits: 5) Store into V3
*IF Variable V3 is EQUAL TO OR LESS THAN <= Varialbe V2
*Change Money $Variable V3, ADD
*Change Variable V2 Minus Variable V3
*Change Variable Variable V3 = 0
*Message: Thank you, have a nice day.
*Else Case:
*Message: You don't have that much.
*Deposit Case:
*Change Variable[V1] Set = Money
*Message: How much do you want to deposit?
*Input Number (Digits=5) Store into V4
*IF V1 is EQUAL TO OR LESS THAN <= V4
*Change Money $Variable V4, MINUS
*Change Varialbe V1 MINUS Varialbe V4
*Change Varialbe V2 ADD Variable V4
*Change Varialbe V4 = 0
*Message: Thank you, have a nice day.
*Else Case:
*Message: You don't have that much money.
*End Case
*None Case:
*Message: Geez, you loser! Thanks for nothing! :)
*End Case

Questions? Email me: Rhynir@yahoo.com
www.freewebs.com/rhynir/