I'm using RMMZ, is there a way to make a Bank System where i can deposit and withdraw Items and Gold? I'm not familiar with coding, so maybe with a plugin for MZ?
MZ Bank System (Items/Gold)
RPG Maker MZ SupportAs I said to you on Discord, I'm happy to help you with this once I take care of a couple of other things.
To deposit gold is actually rather easy. No coding needed at all.
I made my event like this:
To store items, that is a bit more complicated.
I made my event like this:
Code:
◆Text:AA-Vendor1-8(7), Window, Bottom
: :You have \v[18] gold in your account.\$
◆Show Choices:Deposit, Withdraw, \c[2]Cancel (Window, Right, #1, #3)
:When Deposit
◆Text:AA-Vendor1-8(7), Window, Bottom
: :How much?\$
◆Input Number:Self Var Count, 8 digits
◆Control Variables:#0010 Self Var Temp = Gold
◆If:Self Var Count ≤ Self Var Temp
◆Text:AA-Vendor1-8(7), Window, Bottom
: :Done!
◆Change Gold:- {Self Var Count}
◆Control Variables:#0018 Bank Account += Self Var Count
◆
:Else
◆Text:AA-Vendor1-8(7), Window, Bottom
: :You don't have enough gold on you.
◆
:End
◆
:When Withdraw
◆Text:AA-Vendor1-8(7), Window, Bottom
: :How much?\$
◆Input Number:Self Var Count, 8 digits
◆Control Variables:#0010 Self Var Temp = Gold
◆If:Self Var Count ≤ Bank Account
◆Text:AA-Vendor1-8(7), Window, Bottom
: :Done!
◆Change Gold:+ {Self Var Count}
◆Control Variables:#0018 Bank Account -= Self Var Count
◆
:Else
◆Text:AA-Vendor1-8(7), Window, Bottom
: :There is not enough gold in you account.
◆
:End
◆
:When \c[2]Cancel
◆
:End
To store items, that is a bit more complicated.
Here is an item storage event that I made for somebody a long time ago. It's just kinda a skeleton, based on that person's specified requirements, meant to demonstrate a few concepts, so it's not how I'd write one for my own game. But maybe it'll help give you some ideas.
Code:
◆Label:Initialize
◆Control Variables:#0003 Item ID = 0
◆Control Switches:#0001 Deposit = OFF
◆Control Switches:#0002 Withdraw = OFF
◆Control Switches:#0003 Dep/With Error = OFF
◆Control Variables:#0004 Dep/With Amnt = 0
◆Show Choices:Deposit, Withdraw, Cancel (Window, Right, #1, #2)
:When Deposit
◆Control Switches:#0001 Deposit = ON
◆
:When Withdraw
◆Control Switches:#0002 Withdraw = ON
◆
:When Cancel
◆Exit Event Processing
◆
:End
◆Show Choices:Potion, Super Potion, Full Potion, Cancel (Window, Right, #1, #4)
:When Potion
◆Control Variables:#0003 Item ID = 7
◆
:When Super Potion
◆Control Variables:#0003 Item ID = 8
◆
:When Full Potion
◆Control Variables:#0003 Item ID = 9
◆
:When Cancel
◆Jump to Label:Initialize
◆
:End
◆Input Number:Dep/With Amnt, 1 digit
◆If:Deposit is ON
◆Script:let itemID = $gameVariables.value(3);
: :let depAmnt = $gameVariables.value(4);
: :$gameParty.storageItems = $gameParty.storageItems || {};
: :$gameParty.storageItems[itemID] = $gameParty.storageItems[itemID] || 0;
: :
: :if ($gameParty.numItems($dataItems[itemID]) >= depAmnt) {
: : $gameParty.storageItems[itemID] += depAmnt;
: : $gameParty.loseItem($dataItems[itemID], depAmnt);
: :} else
: : $gameSwitches.setValue(3, true);
◆
:End
◆If:Withdraw is ON
◆Script:let itemID = $gameVariables.value(3);
: :let withAmnt = $gameVariables.value(4);
: :$gameParty.storageItems = $gameParty.storageItems || {};
: :$gameParty.storageItems[itemID] = $gameParty.storageItems[itemID] || 0;
: :
: :if ($gameParty.storageItems[itemID] >= withAmnt) {
: : $gameParty.storageItems[itemID] -= withAmnt;
: : $gameParty.gainItem($dataItems[itemID], withAmnt);
: :} else
: : $gameSwitches.setValue(3, true);
◆
:End
◆If:Dep/With Error is ON
◆Text:None, None, Window, Bottom
: :Invalid number of items.
◆
:Else
◆Text:None, None, Window, Bottom
: :Transaction successful!
◆
:End
Okay, I'm here with a similar request, but with 4 items instead of two. Will the code be the same?
If you're talking about my event, then yeah, you can add more items. You just have to add more choices to the
Show Choices command, and when they choose that choice, then set the Item ID variable to contain the ID of the item that you want to store. However, since Show Choices only allows 6 choices by default, and I'm using one choice for "Cancel", then you can only do 5 items. You can get around this by having multiple sets of choices (like have one choice be "Next Page", which then open up another set of choices), or using a plugin that expands the number of choices.Original thread: https://forums.rpgmakerweb.com/threads/mz-bank-system-items-gold.144886/