Charas-Project

Game Creation => Requests => RPG Maker Programming => Topic started by: elementalhero76 on January 04, 2007, 07:35:18 PM

Title: Banking
Post by: elementalhero76 on January 04, 2007, 07:35:18 PM
Its a varable event but how do you do it?
Title:
Post by: Daetyrnis on January 04, 2007, 08:03:40 PM
Making a Bank system is pretty simple.

You need
-variable for money
-variable for current money in bank
-variable for bank actions
-bankkeeper or some such event for doing this.

for the scripting, I'm not going to post a step by step, just an overview.
Show a message that displays your current money (with \$) and the money in the bank (with \v[####]).  Then give the player a choice bewteen
-Withdraw
-Deposit
-Nothing

Withdraw
Input number processing or something, make it return the value to the bank actions variable.

Then, check to see if the bank actions variable is equal to or less than the current money in bank variable.

If it is, subtract the banks actions variable from the bank money variable, and add that much money to the party.

Deposit
Again, input number processing, making it return the value to the bank actions variable.

Set the party's money to the money variable.

Check to see if the bank actions variable is equal to or less than the money variable.

If it is, subtract the bank actions variable from the party's actual money, and add it to the bank money variable.
Title:
Post by: elementalhero76 on January 05, 2007, 02:53:36 AM
Thanks for the overview! :p I'll refer to this for I unstand a little bit about varibles   ;)
Title:
Post by: elementalhero76 on January 05, 2007, 05:19:14 AM
Um someone show a more step by step? I had it then I messed up.
Title: Help me I scrwed up. I had it for a bit.
Post by: elementalhero76 on January 05, 2007, 05:26:08 AM
The image: :(
Title:
Post by: ffmaster6 on January 05, 2007, 05:33:18 PM
I didn't recreate the whole event but I think i found a couple of mistakes. If anyone with more posts(and "experience") wants to back this up you're welcome.

First of all, i'm sure you thought about it but you should really put some forks to prevent the user from depositing more money than he has. Also it's always a good idea to create this event as a loop and make a loop exit in the "nothing" choice.

Now for the functionality:

first of all, for your deposited amount of money

in your event you add the amount in your bank to the deposited amount. That only changes the variable containing the deposited amount(var11). You should add the deposited amount to the amount in your bank(v9+v11, not v11+v9 in rpg maker there is a difference)

for the withdrawal

it's a similar problem. You add to your current money the amount left in your bank instead of adding the amount you withdrew. you should add v10 to your money, not v12. v12 is useless.

By the way, if you want to reduce the number of variables used you can just have 2. One for the current amount of money in your bank and one for the amount entered in the input.(for a withdraw you remove this amount from the bank, opposite for the input)

You'll thank me when you're making your 999th variable.

Anyway hope this helps!
Title:
Post by: elementalhero76 on January 05, 2007, 07:20:20 PM
Thanks! I guess I am not too good at this yet but i have basic unstandiung of varibles so that should help. I must have had the varables the right way the first time.