Greetings RPGMaker community,
I'm back with another question, This time regarding a pre-made script made by bigace360 for XP but adapted to VXa, apparently.
I've been encountering an issue with it.
My issue is when I'm using this script, "Load Game" files DO NOT load at all.
Instead it produces a buzzer sound.
Unfortunately I can't produce a public demo yet because I use copyright material 'whilst' the game is personal use only, I am working on changing these materials one by one, So bear with me for a demo.
Here is the script:
This script wasn't easy to find as two locations on his website for the VXa version will direct you to the XP version instead.
I also embedded it into a existing project with several popular/older scripts, I can provide script names and their authors if required. I haven't tested the script in a "new project".
RPG Maker provides no error either.
Thanks
IBB
I'm back with another question, This time regarding a pre-made script made by bigace360 for XP but adapted to VXa, apparently.
I've been encountering an issue with it.
My issue is when I'm using this script, "Load Game" files DO NOT load at all.
Instead it produces a buzzer sound.
Unfortunately I can't produce a public demo yet because I use copyright material 'whilst' the game is personal use only, I am working on changing these materials one by one, So bear with me for a demo.
Here is the script:
Code:
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ■ Bank System [RMVXA]
# ■ Author: Bigace360
# ■ Type: Custom Scene
# ■ Version: 1.00
# ■ Date: March 28, 2013
# ■ Blog: http://bigaceworld.wordpress.com/
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# VERSION HISTORY #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# 03.28.2013 (v1.00) - Finished Script
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# INTRODUCTION #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# The ACE Banking System allows players to deposit and withdraw money from the
# bank like in real life. As your money sits in the bank, the player can
# accumulate interest over time, increasing the amount of money in the bank.
# Savings bonds can also be purchase at the bank, to increase the players cash
# flow as well.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# FEATURES #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ▼ Interest Rates
# ● Let's your Account grow by a certain percent every gametime hour
# (But it updates every frame)
# ▼ Savings Bonds
# ● Lets You purchase bonds that mature over time (in hours) and give you a
# direct interest amount from the bond
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# INSTRUCTIONS #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# To install this script, open up your script editor and copy/paste this script
# to an open slot below Scene_Debug, but above Main. Remember to save.
#
# --------------------------------------
# ▼ Creating Savings Bonds
# --------------------------------------
# ● To Create you own Savings Bonds, go to the module and scroll down to
# Section IV and then read the instructions.
#
# --------------------------------------
# ▼ Creating Dynamic Banks
# --------------------------------------
# ● You can easily make every bank in your game different, and have it's own
# interest rates & available bonds.
#
# ● First, the template to call a bank is:
# call_bank(interest_rate, bonds)
#
# ● To change the interest rate for the bank, just change interest_rate to the
# interger amount of the interest. (5 = 5%) To leave the interest rate alone,
# set this value to 0. It will use the last interest rate used.
# ● For the savings bonds, bonds will be the bond ID used from the SAVINGS_BONDS
# hash in the script's module. Any items placed within the array assigned to
# the bond ID will be sold as savings bond.
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# SECTIONS #
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# ■ Game_Objects
# ** ACE Module
# ** Numeric
# ** DataManager Module
# ** Game_BankSystem
# ** Game_Interpreter
#
# ■ Windows
# ** Window_Base
# ** Window_BankHelp
# ** Window_BankCommand
# ** Window_Aval_BondCommand
# ** Window_Owned_BondCommand
# ** Window_BankSummary
# ** Window_BankNumber
# ** Window_Bond
#
# ■ Scenes
# ** Scene_Bank
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
# Credits/Thanks:
# - Bigace360, for the script.
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
# Script Conflicts and Compatability #
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# ● Alias methods
# class << DataManager
# def create_game_objects
# def make_save_contents
# def extract_save_contents(*args, &block)
#
# class Window_Base < Window
# def initialize(*args, &block)
#
#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Module ACE::CORE
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module ACE
module CORE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# ◆ Section I. Main Command Settings ◆
# -------------------------------------------------------------------------
# This array adjusts what options appear in the initial item command window
# before the items are split into separate categories. Add commands, remove
# commands, or rearrange them. Here's a list of which does what:
#
# -------------------------------------------------------------------------
# :command Description
# -------------------------------------------------------------------------
# :deposit Desposit Money Into Your Account
# :withdraw Withdraw Money From your Account
# :purchase Purchase a Savings Bond
# :mature Take Out Mature Savings Bond
# :exit Exit Bank
#
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This array arranges the order of which the commands appear in the Item
# Command window in the Item Scene.
BANK_COMMANDS =[
[:deposit, "Deposit"],
[:withdraw, "Withdraw"],
[:purchase, "Purchase Bond"],
[:mature, "Get Mature Bond"],
[:exit, "Exit"],
] # Do not remove this.
BANK_DESCRIPTION ={
:deposit => "Desposit Money Into Your Account",
:withdraw => "Withdraw Money From your Account",
:purchase => "Purchase a Savings Bond",
:mature => "Take Out Mature Savings Bond",
:exit => "Exit Bank",
} # Do not remove this.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# ◆ Section II. Bank Status Settings ◆
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# The item status window displays information about the players bank
# statement. Adjust the settings below to change the text that appears in
# the status window.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
BANK_VOCAB ={
:summary =>{
:header => "Activity Summary", # Header Text
:balance => "Account Balance:", # Account Balance Text
:owned => "Bonds Owned:", # Number of Savings Bond's Text
:value => "Bonds Value:", # Value of Savings Bond's Text
:interest => "Interest Rate:", # Current Interest Rate Text
}, # Do not remove this.
:bonds => {
:cost => "Bond Cost:", # Bond Cost Text
:value => "Mature Value:", # Bond Mature Value Text
:interest => "Interest Rate:", # Bond Interest Rate Text
:maturity => "Maturity Time:", # Length until Maturity Text
:bought => "Time Bought:", # Time Bought Text
:finished => "Time Finished:" # Time Finished Text
} # Do not remove this.
} # Do not remove this.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# ◆ Section III. Bank Savings Bond Settings ◆
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This section is for creating your own Savings Bonds. Go just right BELOW
# the Savings_Bond Class to customize your bank's savings bonds. PLEASE
# DO NOT TOUCH THE Savings_Bond Class UNLESS YOU KNOW WHAT YOUR DOING!!!
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# ■ Savings_Bond [DO NOT TOUCH THIS CLASS] END Configuration
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
class Savings_Bond
attr_accessor(:name, :cost, :interest_rate, :length, :time_bought,
:time_finished, :mature_value)
def initialize(name, cost, interest_rate, length)
@name = name
@cost = cost
@interest_rate = interest_rate
@length = length
@mature_value = (@cost * (1+ @interest_rate / 100.0)).to_i
end
# DO NOT TOUCH THIS CLASS
def set_times
@time_bought = Graphics.frame_count / Graphics.frame_rate
@time_finished = @time_bought + @length * 3600
end
# DO NOT TOUCH THIS CLASS
def return_time(time)
hours = time / 60 / 60
minutes = time / 60 % 60
seconds = time % 60
return sprintf("%02d:%02d:%02d", hours, minutes, seconds)
end
end
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# START Configurations
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Here you can configure your own savings bonds
#
# bond_id => Savings_Bond.new("name", cost, interest_rate, length),
#
# name : Savings Bond Name
# cost : Savings Bond Cost
# interest_rate : Savings Bond Interest Rate (In Percent)
# length : Length of Hours until Mature
#-------------------------------------------------------------------------
BANK_BOND_LIST ={
1 => Savings_Bond.new("CD-7", 100, 7.5, 0),
2 => Savings_Bond.new("CD-14", 500, 15, 14),
3 => Savings_Bond.new("CD-28", 2000, 20, 28),
4 => Savings_Bond.new("CD-1", 150, 2, 3),
5 => Savings_Bond.new("CD-2", 350, 3, 0),
}
# This hash adjusts the savings bond's sold in each of the bank ID's. Insert
# the savings bond you want sold inside of the arrays with the bank ID as
# the hash key. You can use number ranges to add common events quicker.
SAVINGS_BONDS ={
#ID => [BANK_BOND_LIST ID's],
0 => [], # Do not delete this line.
1 => [1..3, 5],
2 => [4],
}
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# END Configuration
#===========================================================================
# ▼ Warning
# Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death,
# and/or halitosis so edit at your own risk.
#===========================================================================
module_function
#--------------------------------------------------------------------------
# convert_integer_array
#--------------------------------------------------------------------------
def convert_integer_array(array)
result = []
array.each do |i|
case i
when Range then result |= i.to_a
when Integer then result |= [i]
end
end
return result
end
#--------------------------------------------------------------------------
# full_convert_hash
#--------------------------------------------------------------------------
def full_convert_hash(hash)
result = {}
hash.each {|key| result[key[0]] = convert_integer_array(key[1])}
return result
end
SAVINGS_BONDS = full_convert_hash(SAVINGS_BONDS)
end
end
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# ▼ Import to Global Hash ▼ #
($ace_script ||= {})[:bank_system] = 1.00
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ DataManager
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module DataManager
class << self
alias ace_bank_game_objects create_game_objects
alias ace_bank_save_contents make_save_contents
alias ace_bank_extract_save extract_save_contents
end
def self.create_game_objects
ace_bank_game_objects
$game_bank = Game_BankSystem.new
end
def self.make_save_contents
contents = ace_bank_save_contents
contents[:bank] = $game_bank
contents
end
def self.extract_save_contents(*args, &block)
ace_bank_extract_save(*args, &block)
$game_bank = contents[:bank]
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Game_BankSystem
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_BankSystem
attr_accessor(:account_balance, :interest_rate, :saving_bonds)
def initialize
@account_balance = 0
@interest_rate = 1
@saving_bonds = []
@last_interest_time = 0
end
def interest_time
(Graphics.frame_count / Graphics.frame_rate - @last_interest_time) / 3600.0
end
def interest_amount
(@account_balance * @interest_rate / 100.0 * interest_time).to_i
end
def update
# Updates Deposited Amount
if interest_amount > 0
@last_interest_time = Graphics.frame_count / Graphics.frame_rate
@account_balance += interest_amount
# Refreshes Data Windows
$scene.refresh_windows
end
end
def deposit(amount)
$game_party.lose_gold(amount)
@account_balance += amount
end
def withdraw(amount)
@account_balance -= amount
$game_party.gain_gold(amount)
end
def add_bond(bond)
@saving_bonds << bond
@saving_bonds.sort! {|a, b| a.name <=> b.name}
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Game_Interpreter
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_Interpreter
def call_bank(interest_rate = 1, savings_bond = 1)
return unless SceneManager.scene_is?(Scene_Map)
SceneManager.call(Scene_Bank)
bonds = ACE::CORE::SAVINGS_BONDS[savings_bond]
SceneManager.scene.prepare(interest_rate, bonds)
end
end # Game_Interpreter
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_Base
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_Base < Window
alias :ace_bankbase_initi :initialize unless $@
def initialize(*args, &block)
ace_bankbase_initi(*args, &block)
bank_opacity? if SceneManager.is_a?(Scene_Bank)
end
def bank_opacity?
bank_opacity = ACE::CORE::BANK_CONFIG[:bank_win]
self.back_opacity = bank_opacity[0]
self.opacity = bank_opacity[0] if bank_opacity[1]
end
def draw_horz_line(y, contents_width, x=0)
line_y = y + line_height / 2 - 1
contents.fill_rect(x, line_y, contents_width, 1, line_color)
end
def line_color
color = normal_color
color.alpha = 192
return color
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_BankHelp
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_BankHelp < Window_Base
def make_font_smaller
contents.font.size -= 9 if contents.font.size >= 16
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_BankCommand
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_BankCommand < Window_Command
def initialize(dy)
super(0, dy)
end
def window_width
return 196
end
def visible_line_number
return 6
end
def make_command_list
@help_descriptions = {}
ACE::CORE::BANK_COMMANDS.each do |command|
case command[0]
when :deposit, :withdraw, :purchase, :mature, :exit
add_command(command[1], command[0])
@help_descriptions[command[0]] = ACE::CORE::BANK_DESCRIPTION[command[0]]
else next
end
end
end
def update_help
text = @help_descriptions[current_symbol]
text = "" if text.nil?
@help_window.set_text(text)
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_Aval_BondCommand
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_Aval_BondCommand < Window_Command
def initialize(dy, bonds)
@save_bonds = bonds
super(0, dy)
deactivate
hide
end
def window_width
return 196
end
def visible_line_number
return 6
end
def make_command_list
@save_bonds.each do |x|
next if ACE::CORE::BANK_BOND_LIST[x].nil?
name = ACE::CORE::BANK_BOND_LIST[x].name
add_command(name, :bond, true, ACE::CORE::BANK_BOND_LIST[x])
end
add_command('Back', :exit)
end
def current_item_enabled?
current_ext.cost <= $game_party.gold
end
def process_ok
current_symbol == :exit ? process_cancel : super
end
def update_help
@help_window.set_text('Insufficent Funds!')
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_Owned_BondCommand
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_Owned_BondCommand < Window_Command
def initialize(dy)
super(0, dy)
deactivate
hide
refresh
end
def window_width
return 196
end
def visible_line_number
return 6
end
def make_command_list
$game_bank.saving_bonds.each {|x| add_command(x.name, :bond, true, x)}
add_command('Back', :exit)
end
def current_item_enabled?
current_ext.time_finished <= Graphics.frame_count / Graphics.frame_rate
end
def process_ok
current_symbol == :exit ? process_cancel : super
end
def process_handling
super
call_update_help
end
def update_help
if !current_item_enabled?
@help_window.set_text('Savings Bond Not Mature Yet!')
end
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_BankSummary
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_BankSummary < Window_Base
def initialize(dx, dy, dw)
super(dx, dy, dw, fitting_height(5.5))
refresh
end
def summary(sym)
ACE::CORE::BANK_VOCAB[:summary][sym]
end
def refresh
contents.clear
reset_font_settings
summary_header
contents.font.size = 22
2.times {|i| draw_horz_line(9+(i*48), contents.width)}
summary_gold
summary_balance
summary_bonds_owned
summary_bonds_value
summary_interest
end
def summary_header
change_color(normal_color)
draw_text(0, 0, contents.width, 24, summary(:header), 1)
end
def summary_gold
change_color(system_color)
draw_text(4, 22, contents.width, 24, "Current #{Vocab::currency_unit}:")
change_color(normal_color)
draw_text(-4, 22, contents.width, 24, $game_party.gold, 2)
end
def summary_balance
change_color(system_color)
draw_text(4, 44, contents.width, 24, summary(:balance))
change_color(normal_color)
draw_text(-4, 44, contents.width, 24, $game_bank.account_balance, 2)
end
def summary_bonds_owned
change_color(system_color)
draw_text(4, 68, contents.width, 24, summary(:owned))
change_color(normal_color)
draw_text(-4, 68, contents.width, 24, $game_bank.saving_bonds.size, 2)
end
def summary_bonds_value
value = 0
$game_bank.saving_bonds.each {|x| value += x.mature_value}
change_color(system_color)
draw_text(4, 90, contents.width, 24, summary(:value))
change_color(normal_color)
draw_text(-4, 90, contents.width, 24, value, 2)
end
def summary_interest
change_color(system_color)
draw_text(4, 112, contents.width, 24, summary(:interest))
change_color(normal_color)
draw_text(-4, 112, contents.width, 24, "#{$game_bank.interest_rate}%", 2)
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_BankNumber
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_BankNumber < Window_Selectable
attr_reader :amount # money entered
def initialize(dummy)
super(dummy.x, dummy.y, dummy.width, dummy.height)
@amount = 0
@currency_unit = Vocab::currency_unit
end
def set(type)
@type = type
@amount = 0
@currency_unit = Vocab::currency_unit
refresh
end
def refresh
contents.clear
reset_font_settings
draw_header
draw_balance
draw_transaction
draw_horz_line(88, contents.width)
draw_party_gold
draw_account_balance
end
def name
name = @type == :deposit ? "Deposit" : "Withdraw"
return name
end
def gold
money = $game_party.gold
money += @type == :deposit ? -@amount : @amount
return money
end
def account_balance
money = $game_bank.account_balance
money += @type == :deposit ? @amount : -@amount
return money
end
def max
max = @type == :deposit ? $game_party.gold : $game_bank.account_balance
return max
end
def draw_header
change_color(normal_color)
draw_text(0, 0, contents.width, 24, "Amount to #{name}", 1)
draw_horz_line(10, contents.width/2, contents.width/4)
end
def draw_balance
rect = Rect.new(4, 48, contents.width, 24)
change_color(system_color)
case @type
when :deposit
draw_text(rect, "Current #{@currency_unit}:")
change_color(normal_color)
rect.x -= 10
draw_text(rect, $game_party.gold, 2)
when :withdraw
draw_text(rect, "Account Balance:")
change_color(normal_color)
rect.x -= 10
draw_text(rect, $game_bank.account_balance, 2)
end
end
def draw_transaction
rect = Rect.new(4, 72, contents.width, 24)
change_color(system_color)
draw_text(rect, "#{name} Amount:")
change_color(normal_color)
rect.x -= 10
draw_text(rect, "- #{@amount}", 2)
end
def draw_party_gold
rect = Rect.new(4, 112, contents.width, 24)
change_color(system_color)
draw_text(rect, "#{@currency_unit} After:")
change_color(normal_color)
rect.x -= 10
draw_text(rect, gold, 2)
end
def draw_account_balance
rect = Rect.new(4, 136, contents.width, 24)
change_color(system_color)
draw_text(rect, "Balance After:")
change_color(normal_color)
rect.x -= 10
draw_text(rect, account_balance, 2)
end
def update
super
return unless self.active
last_number = @amount
update_number
return if @amount == last_number
Sound.play_cursor
refresh
end
def update_number
change_number(1) if Input.repeat?(:RIGHT)
change_number(-1) if Input.repeat?(:LEFT)
change_number(max) if Input.repeat?(:R)
change_number(-max) if Input.repeat?(:L)
call_update_help
end
def change_number(amount)
amount *= 10 if Input.press?(:SHIFT)
amount *= 100 if Input.press?(:CTRL)
amount *= 1000 if Input.press?(:ALT)
@amount = [[@amount + amount, max].min, 0].max
end
def process_ok
if current_item_enabled?
Sound.play_shop
Input.update
deactivate
call_ok_handler
else
Sound.play_buzzer
end
end
def update_help
@help_window.set_text("#{name} #{@amount} #{@currency_unit}")
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Window_Bond
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Window_Bond < Window_Base
def initialize(dummy, avaliable, owned)
super(dummy.x, dummy.y, dummy.width, dummy.height)
@avaliable = avaliable
@owned = owned
@bonds = active_bond
refresh
end
def active_bond
bonds = @avaliable.active ? @avaliable.current_ext : @owned.current_ext
return nil if [0, nil].include?(bonds)
return bonds
end
def update; super; refresh if @bonds != active_bond; end
def bonds(sym); ACE::CORE::BANK_VOCAB[:bonds][sym]; end
def refresh
contents.clear
reset_font_settings
@bonds = active_bond
return no_data if @bonds.nil?
bond = @bonds
rect = Rect.new(0, 0, contents.width, 24)
bond_header(bond, rect)
2.times {|i| draw_horz_line(9+(i*89), contents.width)}
bond_cost(bond, rect)
bond_mature_value(bond, rect)
bond_interest_rate(bond, rect)
bond_time(bond, rect)
return unless @owned.active # Display only if Purchased CD
bond_time_bought(bond, rect)
bond_time_finished(bond, rect)
end
def no_data
colour = Color.new(0, 0, 0, translucent_alpha/2)
rect = Rect.new(0, 0, contents.width, contents.height)
contents.fill_rect(rect, colour)
change_color(system_color); contents.font.size = 24
draw_text(rect, '[ Close ]', 1)
end
def bond_header(bond, rect)
change_color(normal_color)
draw_text(rect, bond.name, 1)
end
def bond_cost(bond, rect)
rect.y += 22
change_color(system_color)
draw_text(rect, bonds(:cost))
change_color(normal_color)
draw_text(rect, bond.cost, 2)
end
def bond_mature_value(bond, rect)
rect.y += 22
change_color(system_color)
draw_text(rect, bonds(:value))
change_color(normal_color)
draw_text(rect, "#{bond.mature_value}", 2)
end
def bond_interest_rate(bond, rect)
rect.y += 22
change_color(system_color)
draw_text(rect, bonds(:interest))
change_color(normal_color)
draw_text(rect, "#{bond.interest_rate}%", 2)
end
def bond_time(bond, rect)
rect.y += 22
change_color(system_color)
draw_text(rect, bonds(:maturity))
change_color(normal_color)
draw_text(rect, "#{bond.length} Hours", 2)
end
def bond_time_bought(bond, rect)
rect.y += 24
change_color(system_color)
draw_text(rect, bonds(:bought))
change_color(normal_color)
draw_text(rect, bond.return_time(bond.time_bought), 2)
end
def bond_time_finished(bond, rect)
rect.y += 22
change_color(system_color)
draw_text(rect, bonds(:finished))
change_color(normal_color)
draw_text(rect, bond.return_time(bond.time_finished), 2)
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# ■ Scene_Bank
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Scene_Bank < Scene_MenuBase
include ACE::CORE
def prepare(interest_rate = $game_bank.interest_rate, bonds = [])
$game_bank.interest_rate = interest_rate unless interest_rate == 0
@bonds = bonds
end
def start
super
create_help_window
#create_menu_layout
create_command_window
create_activity_summary_window
create_dummy_window
create_banknumber_window
create_avaliable_bond
create_owned_bond
create_bond_window
end
def create_help_window
@help_window = Window_Help.new(1)
@help_window.viewport = @viewport
wy = @help_window.height + 168
wh = Graphics.height - wy
@bankhelp_window = Window_BankHelp.new(0, wy, 196, wh)
@bankhelp_window.viewport = @viewport
@bankhelp_window.create_contents
end
def create_command_window
@dy = @help_window.height
@command_window = Window_BankCommand.new(@dy)
@command_window.viewport = @viewport
@command_window.help_window = @help_window
@command_window.set_handler(:deposit, method(:command_account))
@command_window.set_handler(:withdraw, method(:command_account))
@command_window.set_handler(:purchase, method(:command_purchase))
@command_window.set_handler(:mature, method(:command_mature))
@command_window.set_handler(:exit, method(:return_scene))
@command_window.set_handler(:cancel, method(:return_scene))
main_help
end
def create_activity_summary_window
dx = @command_window.width
dy = @command_window.y
dw = Graphics.width - dx
@activity_summary = Window_BankSummary.new(dx, dy, dw)
@activity_summary.x = dx = @command_window.width
@activity_summary.y = @command_window.y
end
def create_dummy_window
dx = @activity_summary.x
dy = @activity_summary.height + @help_window.height
dw = @activity_summary.width
dh = Graphics.height - (@activity_summary.height + @help_window.height)
@dummy_window = Window_Base.new(dx, dy, dw, dh)
@dummy_window.viewport = @viewport
@dummy_window.create_contents
rect = Rect.new(0, 0, @dummy_window.contents.width,
@dummy_window.contents.height)
@dummy_window.contents.fill_rect(rect, Color.new(0, 0, 0, 80))
@dummy_window.change_color(@dummy_window.system_color)
@dummy_window.draw_text(rect, '[ No Data ]', 1)
end
def create_bond_window
@bond_window = Window_Bond.new(@dummy_window, @av_bond_command,
@own_bond_command)
@bond_window.hide
end
#--------------------------------------------------------------------------
# * create_banknumber_window
#--------------------------------------------------------------------------
def create_banknumber_window
@number_window = Window_BankNumber.new(@dummy_window)
@number_window.hide.deactivate
@number_window.help_window = @help_window
@number_window.set_handler(:ok, method(:open_account))
@number_window.set_handler(:cancel, method(:exit_account))
end
def command_account
@dummy_window.hide
@number_window.set(@command_window.current_symbol)
@number_window.show.activate
refresh_windows
refresh_help_window
end
def exit_account
@command_window.activate
@dummy_window.show
@number_window.hide
@help_window.clear
@command_window.help_window = @help_window
main_help
end
def open_account
case @command_window.current_symbol
when :deposit then $game_bank.deposit(@number_window.amount)
when :withdraw then $game_bank.withdraw(@number_window.amount)
end
refresh_windows
exit_account
end
#--------------------------------------------------------------------------
# * create_avaliable_bond
#--------------------------------------------------------------------------
def create_avaliable_bond
@av_bond_command = Window_Aval_BondCommand.new(@dy, @bonds)
#@av_bond_command.help_window = @help_window
@av_bond_command.set_handler(:ok, method(:get_bond_open))
@av_bond_command.set_handler(:cancel, method(:get_bond_exit))
end
def command_purchase
@command_window.hide
@dummy_window.hide
@bond_window.show
@av_bond_command.show.activate
refresh_windows
refresh_help_window
end
def get_bond_exit
close_bond_selection(@av_bond_command)
end
def get_bond_open
if @av_bond_command.current_symbol == :exit
get_bond_exit
else
current_bond = @av_bond_command.current_ext
$game_party.lose_gold(current_bond.cost)
current_bond.set_times
$game_bank.add_bond(current_bond)
refresh_windows
get_bond_exit
end
end
#--------------------------------------------------------------------------
# * create_owned_bond
#--------------------------------------------------------------------------
def create_owned_bond
@own_bond_command = Window_Owned_BondCommand.new(@dy)
#@own_bond_command.help_window = @help_window
@own_bond_command.set_handler(:ok, method(:own_bond_open))
@own_bond_command.set_handler(:cancel, method(:own_bond_exit))
end
def command_mature
@command_window.hide
@dummy_window.hide
@bond_window.show
@own_bond_command.show.activate
refresh_windows
refresh_help_window
end
def own_bond_exit
close_bond_selection(@own_bond_command)
end
def own_bond_open
if @own_bond_command.current_symbol == :exit
own_bond_exit
else
current_bond = @own_bond_command.current_ext
$game_party.gain_gold(current_bond.mature_value)
$game_bank.saving_bonds.delete_at(@own_bond_command.index)
refresh_windows
own_bond_exit
end
end
def close_bond_selection(window)
@command_window.activate.show
@dummy_window.show
@bond_window.hide
window.hide
@help_window.clear
@command_window.help_window = @help_window
main_help
end
#--------------------------------------------------------------------------
# * refresh_help_window
#--------------------------------------------------------------------------
def refresh_help_window
if !@command_window.active
case @command_window.current_symbol
when :deposit, :withdraw
text = "Menu Selection\n\e}" +
"● Press Left / Right: ±1\n" +
"● Hold SHIFT: ±10\n" +
"● Hold CTRL: ±100\n" +
"● Hold ALT: ±1000\n" +
"● X / Enter: Confirm\n" +
"● B / Esc : Go Back"
when :purchase, :mature
text = "Menu Selection\n\e}" +
"● X / Enter: Select\n" +
"● B / Esc : Go Back"
else text = ""
end
else text = ""
end
@bankhelp_window.contents.clear
@bankhelp_window.draw_text_ex(0, 0, text)
end
def main_help
text = "Menu Selection\n\e}" +
"● B / Esc: Exit Bank\n" +
"● X / Enter: Select"
@bankhelp_window.contents.clear
@bankhelp_window.draw_text_ex(0, 0, text)
end
#--------------------------------------------------------------------------
# * Refresh Windows
#--------------------------------------------------------------------------
def refresh_windows
@activity_summary.refresh
@number_window.set(@command_window.current_symbol)
@bond_window.refresh
@av_bond_command.refresh
@own_bond_command.refresh
end
end
This script wasn't easy to find as two locations on his website for the VXa version will direct you to the XP version instead.
I also embedded it into a existing project with several popular/older scripts, I can provide script names and their authors if required. I haven't tested the script in a "new project".
RPG Maker provides no error either.
Thanks
IBB