This probably should be in Submitted Scripts, but since I made it for the sole purpose of working with this banking system, I've put it here. I will also explain how to use it (this is still part of the tutorial).
This HUD will display (based on variables and switches) either the gold in your inventory, the gold in the bank, or the gold you owe the bank.
First of all, let's look at the beginning of the script:
GOLD_IN_BANK = 3 #Variable index where bank gold is kept (replace the "3" with the ID of [Gold in Bank])
GOLD_OWED = 6 #Variable index where owed gold is kept (replace the "6" with the ID of [Loan])
DRAW_GOLD= 9 #Variable index that decides which gold to draw (replace the "9" with whatever variable you would like. I will refer to this variable as Draw_Gold)
This refers to the value of Draw_Gold:
Value Display
# 0 : Display nothing
# 1 : Display party gold
# 2 : Display gold savings
# 3 : Display gold owed
So, if DRAW_GOLD is equal to 2, the amount of gold you have stored in the bank will be displayed.
Ok, got that? Now, this can be found toward the bottom of the script:
VISIBILITY_SWITCH = 1
The "1" is the switch ID. If the switch is off, the HUD is invisible. If the switch is on, the HUD will appear.
That's about all there is to configuring the HUD. Let's talk a little bit about implementing it in your banking system.
Basically, when you want to display the value, turn the switch above on along with setting the variable, DRAW_GOLD to either 1, 2, or 3. At the end of the event, just turn the switch off and set DRAW_GOLD to 0.
So, let's use deposit as an example. Right after to set [Gold in Inventory] to the player's gold, turn the switch on, and SET the variable DRAW_GOLD to 1.
At the very end of the event (after the last "Branch End"), turn the switch off, and SET DRAW_GOLD to 0. Just do that with all of the common events (Deposit, Withdraw, and Loan) and you have a completed system. Make sure to set the variable to the correct value or else it will display either the wrong amount of gold or a blank box.
Hope this will be of use to you! Here's the code:
#=================================================================================
#Bank HUD by AbyssalLord
#Version 1.0
#=================================================================================
#This is a simple HUD that is intended to be used with my evented bank system. It
#can display gold in the player's inventory, gold in the bank, and gold owed as a
#result of loans. All of these are based on activating switches and variables
#through my event system.
#=================================================================================
#Credits go to AbyssalLord, khmp, and Yeyinde
#I learned a lot from those two!
#=================================================================================
#**Window_GoldHUD
#---------------------------------------------------------------------------------
#This class is used to display amounts of gold.
#=================================================================================
class Window_GoldHUD < Window_Base
#--------------------------------------------------------------------------
# * @gold_draw
# 0 : Display nothing
# 1 : Display party gold
# 2 : Display gold savings
# 3 : Display gold owed
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Constant Variables
#--------------------------------------------------------------------------
GOLD_IN_BANK = 3 #Variable index where bank gold is kept
GOLD_OWED = 6 #Variable index where owed gold is kept
DRAW_GOLD= 9 #Variable index that decides which gold to draw
#==========================================================================
#Initialize
#==========================================================================
def initialize
super(440,0,200,60)
self.contents = Bitmap.new(width - 32, height - 32)
@gold_draw = 0
refresh
end
#==========================================================================
#Refresh
#==========================================================================
def refresh
#Clear the HUD
self.contents.clear
reset_gold
#Return if nothing is meant to be drawn
return if @gold_draw == 0
return if @gold_draw < 0
return if @gold_draw > 3
gold,amount = ","
case @gold_draw
when 1
gold = 'Gold'
amount = @gold.to_s
when 2
gold = 'Gold'
amount = @bank_gold.to_s
when 3
gold = 'Owed'
amount = @loan_gold.to_s
end
#Draw the contents
self.contents.draw_text(-60, 0, 150, 32, amount, 2)
self.contents.draw_text(100, 0, 150, 32, gold)
end
#=========================================================================
#Reset the values
#=========================================================================
def reset_gold
@gold = $game_party.gold
@bank_gold = $game_variables[GOLD_IN_BANK]
@loan_gold = $game_variables[GOLD_OWED]
@gold_draw = $game_variables[DRAW_GOLD]
end
#=========================================================================
#Update
#=========================================================================
def update
super()
refresh if ( @gold_draw != $game_variables[DRAW_GOLD] or
@gold != $game_party.gold or
@bank_gold != $game_variables[GOLD_IN_BANK] or
@loan_gold != $game_variables[GOLD_OWED] )
end
end
#=========================================================================
#**Scene_Map
#-------------------------------------------------------------------------
#This class performs map screem processing
#=========================================================================
class Scene_Map
#=========================================================================
#Alias Methods
#=========================================================================
alias goldhud_main main
alias goldhud_update update
#==========================================================================
#Contant Variables
#==========================================================================
VISIBILITY_SWITCH = 1 #The switch ID that determines the HUD's visibility
#==========================================================================
#Main Processing
#==========================================================================
def main
@goldhud = Window_GoldHUD.new
@goldhud.visible = $game_switches[VISIBILITY_SWITCH]
goldhud_main
@goldhud.dispose
end
#==========================================================================
#Update
#==========================================================================
def update
@goldhud.visible = $game_switches[VISIBILITY_SWITCH]
@goldhud.update
goldhud_update
end
end