To call the shopping interface (Changed in V 2.0!):
CODE
#-------------------------------------------------------------------------------
#
# IMPORTANT CUSOMIZATION INFORMATION:
# There are 2 ways to call the shopping interface. Both are demonstrated
# in the attached demo game.
#
# Method #1: Built-in Shop Proccessing (easiest for non-scripters)
#
# METHOD #1 ONLY WORKS FOR BASIC SHOPS!
#
# In order to use the preexisting shop interface call from an event, you
# must first provide values to the following fields:
#
# $game_shopping.currentShopID:
# Integer representing the ID number of the shop (starts at 0)
#
# $game_shopping.currentDiscountRate
# Float point representing the discount on used items. (e.g.if the shop
# sells used items at 80% of cost, the value is 0.8 )
#
# $game_shopping.currentSellRate
# Float point representing the percentage of the value the shopkeeper pays
# the player for items. (e.g. If the shopkeeper pays 50% of the item's
# worth, the value is 0.5)
#
# $game_shopping.currentMarkupRate
# Float point representing the shopkeeper's markup (or markdown) of the
# selling prices. For example, If the shopkeeper is greedy and wants to
# markup his items 20% (120% of the item's price in the DB) then the value
# is 1.2. If he is generous and sells his items 10% under cost (90% of the
# item's price in the DB) then the value is 0.9
#
# $game_shopping.currentTaxRate
# Float point representing the tax rate of the shop. (e.g. if the shop has
# a 3% tax rate, the value is 0.03)
#
# $game_shopping.currentInflationRate
# Float point representing the price increase given to items in high demand.
# (e.g. if the shop keeper marks up items 20% when the stock runs low, the
# value is 0.2)
#
# After you have set these variables, you can then use the shop processing
# button from the event wizard.
#
# Method #2: Calling the shopping scene manually (easiest for scripters)
#
# METHOD #2 IS REQUIRED FOR ADVANCED SHOPS!
#
# You can call the shopping scene manually by passing all the above values
# in the constructor. You MUST first define the values of the items in the
# shop before making the shop call!
#
# The format for the shop_goods are:
# $game_temp.shop_goods = [ [ITEM_TYPE1, ITEM_ID1, ITEM_LIMIT1],
# [ITEM_TYPE2, ITEM_ID2, ITEM_LIMIT2],
# etc...]
# ITEM_TYPE: 0 for RPG::Item
# 1 for RPG::Weapon
# 2 for RPG::Armor
# 3 for RPG::Skill <----advanced shops only
# 4 for RPG::Class <----advanced shops only
# 5 for RPG::Actor <----advanced shops only
# ITEM_ID: The ID number of the item in the DB
# ITEM_LIMIT: The max the shop can sell to the player. Set to -1 for no
# limit.
#
# The format for the scene call is:
# $scene = Scene_Shop.new(shopID, discountRate, sellRate,
# markupRate, taxRate, InflationRate,
# restockRate, continuousRestock)
#
# (all the type rules from method #1 apply to this constuctor as well!)
#
# restockRate: How long, in minutes, to wait before the store
# "restocks" its items. (e.g. a value of 90 is 1 hour
# and 30 minutes of playtime) Set to 0 to disable
# restocking completely!
#
# continuousRestock: Boolean (true/false) that determines whether the shop
# restocks continuously. Setting this to true causes a
# shop to restock at the restockRate regardless of the
# player's actions. Setting this to false causes the
# shop to "call" for a restock after the player visits
# a fully stocked store.
#
# If your restockRate is 30 minutes and
# continuousRestock is true:
# When the player visits the shop for the first time
# the timer will start. If the player visits again in
# 45 minutes, The store will be restocked. If the
# player comes back 15 minutes after that, the store
# will be restocked again.
#
# But, if your restockRate is 30 minutes and
# continuousRestock is false:
# When the player visits the shop for the first time
# the timer will start. If the player visits again in
# 45 minutes, the store will be restocked, but the
# timer will reset to 30 minutes! If the player comes
# back 15 minutes later, there will still be 15
# minutes left on the restock timer! This is akin to
# the shopkeeper calling in an order for more stock
# when the player shows up to shop.
#
#-------------------------------------------------------------------------------
Set the number of shopkeepers in your game in Game_Shopping:
CODE
#---------------------------------------------------------------------------
# IMPORTANT:
# You will get an error when buying or selling used items if you try to
# pass a shopID that is higher than the number of @totalShopkeepers - 1.
# Set this to the number of shops in your game, or HIGHER! Setting higher
# will waste memory, but you can always count up the number of shops you
# have before shipping your finished game and change it back to the
# correct number!
#---------------------------------------------------------------------------
@totalShopkeepers = 2
Icon customization is in Game_Shopping:
CODE
#---------------------------------------------------------------------------
# Change these if you need to use different atribute up/down icons
#---------------------------------------------------------------------------
@atkIconUp = 1916
@atkIconDown = 1932
@atkIconSame = 1948
@defIconUp = 1917
@defIconDown = 1933
@defIconSame = 1949
@spiIconUp = 1918
@spiIconDown = 1934
@spiIconSame = 1950
@agiIconUp = 1919
@agiIconDown = 1935
@agiIconSame = 1951
Item "pool" labels are in Redefinitions:
CODE
#---------------------------------------------------------------------------
# Change these if you want to label the item pools differently
#---------------------------------------------------------------------------
@headings = ["New Items", "Used Items"]
New in v1.0!
New customization options in Game_Shopping:
To control restocking while the player is visiting a store:
CODE
#---------------------------------------------------------------------------
# Set this to true if you would like the shops to restock themselves while
# the player is currently shopping (this will throw up a message to the
# player to notify him of the restock)
#---------------------------------------------------------------------------
@allowRestockWhileShopping = true
To control the display of tax calculations in the detail window:
CODE
#---------------------------------------------------------------------------
# Set this to false if you do not wish to use tax. Make sure to set your
# tax rates to 0!
#---------------------------------------------------------------------------
@allowTax = true
To define a single icon for all Classes and Actors:
CODE
#---------------------------------------------------------------------------
# If you want a single icon for all classes or actors, you can set that
# here. If you want to assign icons on a per-class or per-actor basis, set
# the universal to nil, and define the individual ones below.
#---------------------------------------------------------------------------
@universalClassIcon = nil
@universalActorIcon = 1903
To set prices for your actors and classes:
CODE
#-----------------------------------------------------------------------------
# Sets price data for advanced shop objects.
#
# PLEASE NOTE: Skills, classes and actors cannot be sold, only bought!
#-----------------------------------------------------------------------------
def initPrices
#---------------------------------------------------------------------------
# Set prices for skills here. Start at position 1. Each number corresponds
# to the ID number of the skill in the database. If you don't wish to sell
# a skill, use 'nil' in its place. These skills will be discovered the
# usual way instead of being unlocked from purchasing.
#---------------------------------------------------------------------------
@skillPrices = [ #DON'T TOUCH THIS ONE!
nil,
#Skills 1-10
100, 200, 300, nil, nil, nil, nil, nil, nil, nil,
#Skills 11-20
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
#Skills 21-30
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
#Skills 31-40
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
#Skills 41-50
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
#Skills 51-60
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
#Skills 61-70
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
#Skills 71-80
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
#Skills 81-82
nil, nil
]
#---------------------------------------------------------------------------
# Set prices for classes here. Start at position 1. Each number corresponds
# to the ID number of the class in the database. If you don't wish to sell
# a class, use 'nil' in its place. These classes will be discovered the
# usual way instead of being unlocked from purchasing.
#---------------------------------------------------------------------------
@classPrices = [ #DON'T TOUCH THIS ONE!
nil,
#Classes 1-8
nil, 2000, 3000, 4000, 5000, 6000, 7000, 8000
]
#---------------------------------------------------------------------------
# Set prices for actors here. Start at position 1. Each number corresponds
# to the ID number of the actor in the database. If you don't wish to sell
# an actor, use 'nil' in its place. These actors will be discovered the
# usual way instead of being unlocked from purchasing.
#---------------------------------------------------------------------------
@actorPrices = [ #DON'T TOUCH THIS ONE!
nil,
#Actors 1-8
nil, 2000, 3000, 4000, 5000, 6000, 7000, 8000
]
end
To set individual icons for Classes or Actors:
CODE
#-------------------------------------------------------------------------
# If you have individual icons for each class, define them here!
#-------------------------------------------------------------------------
classIcons = [ #DON'T TOUCH THIS ONE!
nil,
#Classes 1-8
1154, 1897, 1682, 1899, 549, 547, 1898, 1630
]
and
CODE
#-------------------------------------------------------------------------
# If you have individual icons for each actor, define them here!
#-------------------------------------------------------------------------
actorIcons = [ #DON'T TOUCH THIS ONE!
nil,
#Actors 1-8
1, 2, 3, 4, 5, 6, 7, 8
]
To customize descriptions of classes and actors:
CODE
#---------------------------------------------------------------------------
# Define the text that will appear in the shop help window for classes here:
#---------------------------------------------------------------------------
classDescriptions = [ #DON'T TOUCH THIS ONE!
nil,
#Class 1 (Paladin)
"Stout defender and holy warrior.",
#Class 2 (Warrior)
"Me hit things hard!",
#Class 3 (Priest)
"Has anyone seen my alterboy?",
#Class 4 (Magician)
"Poof! You're a spider!",
#Class 5 (Knight)
"Yea, I smiteth mine enemies.",
#Class 6 (Dark Knight)
"None shall pass!",
#Class 7 (Grappler)
"My chi is bigger than yours.",
#Class 8 (Thief)
"I can haz ur gold?"
]
#---------------------------------------------------------------------------
# Define the text that will appear in the shop help window for classes here:
#---------------------------------------------------------------------------
actorDescriptions = [ #DON'T TOUCH THIS ONE!
nil,
#Actor 1
"Actor info goes here!",
#Actor 2
"Actor info goes here!",
#Actor 3
"Actor info goes here!",
#Actor 4
"Actor info goes here!",
#Actor 5
"Actor info goes here!",
#Actor 6
"Actor info goes here!",
#Actor 7
"Actor info goes here!",
#Actor 8
"Actor info goes here!",
]
If you are an ADVANCED scripter, and you would like to plug shopoholic into your "exhaustible" skill system (i.e. Final Fantasy 8 magic system) so that you can buy multiples of skills, you will need to make edits in several places. They are marked in the code, but here's a rundown:
In Redefinitions:
CODE
if @item.is_a?(RPG::Skill) and $game_shopping.exhaustableSkills
#-------------------------------------------------------------------------
#If you are building a game with exhaustable skills, add code here
#to increase the specific skill by the purchased amount.
# Note: @item is a skill object in this context!
#
# The next version of shopoholic may implement this if there is
# enough desire for the feature.
#-------------------------------------------------------------------------
end
and
CODE
elsif item.is_a?(RPG::Skill) and $game_shopping.exhaustableSkills
#number = the current amount of that skill possessed.
else
In Game_Shopping:
CODE
#---------------------------------------------------------------------------
# If you want to be able to restock skills, set this to true. For example,
# if you are building a game where a skill can only be used a certain number
# of times before being replenished(e.g. Final Fantasy VIII), set this to
# true.
#---------------------------------------------------------------------------
@exhaustableSkills = false
depending on your system, you may need to make further modifications. If this is a heavily desired functionality, I will program a system to work directly with shopoholic.
New in v2.0!
To create a bank:
CODE
#-------------------------------------------------------------------------------
#
# IMPORTANT CUSOMIZATION INFORMATION:
# To call a bank, use the script call:
# $scene = Scene_Bank.new(bankID, rates, slotCost, loanMax, hasVault)
# bankID: The ID of the bank to be shown. (you can show the same bank
# In various events throughout your game, just as you can with
# shops. This way, you can have 1 bank for your entire game
# if you chose)
# rates: An array of interest rates: [savings, checking, loan]
# savings: interest rate for savings accounts at this
# instance of this bank.
# checking: interest rate for checking accounts at this
# instance of this bank.
# loan: interest rate for checking accounts at this
# instance of this bank.
# NOTE: If you have more than one event per bankID you can
# set different interest rates at each one! (sort of like
# branches of a real bank)
# slotCost: Cost for each new Saftey Deposit Box in the vault
# loanMax: The max amount the bank will issue in a single loan. This
# overrides the global setting for max loan if it is lower.
# hasVault Boolean indicating whether or not this instance of this bank
# has a vault. Again if you have multiple events for a bankID
# Then you can enable the vault in some while disabling it in
# others and the players items will persist.
#-------------------------------------------------------------------------------
New customization options in Game_Shopping:
You can configure globally whether shops accept debit transactions or not:
CODE
#---------------------------------------------------------------------------
# Set this to false if you do not want shops to accept debit (IE, checks,
# Debit Card or whatever item is linked to checking accounts)
#---------------------------------------------------------------------------
@shopsAcceptDebit = true
You need to configure the debit item ID as well:
CODE
#---------------------------------------------------------------------------
# Set this to the item ID of the item required to enable debit purchases.
#---------------------------------------------------------------------------
@debitItemID = 21
You can globally configure the amount of an item left in stock that triggers a demand crunch and the inflated prices:
CODE
#---------------------------------------------------------------------------
# Shopkeepers will start raising their prices on new items when they have
# this number or LESS in their inventory (for limited items)
#---------------------------------------------------------------------------
@demandAmount = 10
New options in redefinitions:
I added Vocab for banking terms so that you can change them easily. I will probably update this soon and add shopping vocab as well:
CODE
module Vocab
BankAccounts = "Accounts"
BankVault = "Vault"
BankCancel = "Cancel"
BankDeposit = "Deposit"
BankWithdraw = "Withdraw"
BankTransfer = "Transfer"
#-----------------------------------------------------------------------------
# The variables below probably belong in a banking module, I'll update it
# when I'm not feeling so lazy!
#-----------------------------------------------------------------------------
# Icon indexes for each account type.
#-----------------------------------------------------------------------------
BankAccountIcons = [ #Savings Icon
1631,
#Checking Icon
1666,
#Loan Icon
1630
]
#-----------------------------------------------------------------------------
# Help window text for accounts.
#-----------------------------------------------------------------------------
BankDescriptions = [ #Savings Description
"A high yield savings account.",
#Checking Description
"Provides credit for shopkeepers.",
#Loan Description
""
]
#-----------------------------------------------------------------------------
# Account names.
#-----------------------------------------------------------------------------
BankAccountNames = [ #Savings
"Savings",
#Checking
"Checking",
#Loan
"Loan"
]
end
In Storage_Slot, you can configure the icon index, though I forgot to comment it:
CODE
@icon_index = 1947
Options in Game_Banking:
Set the max number of banks you have!
CODE
#---------------------------------------------------------------------------
# IMPORTANT:
# You will get an error when managing accounts and vaults if you try to
# pass a bankID that is higher than the number of @totalBanks - 1. Set
# this to the number of *different* banks in your game, or HIGHER! Setting
# higher will waste memory, but you can always count up the number of
# banks you have before shipping your finished game and change it back to
# the correct number!
# Note, if you want one "central" bank, just use the same bankID in each
# bank event.
#---------------------------------------------------------------------------
@totalBanks = 1
You can set how many minutes must pass for interest to be accumulated. All banks proccess interest at the same time in the real world, so if you have a day/night system in your game make sure to set this to the same length as your day:
CODE
#---------------------------------------------------------------------------
# How many minutes must pass before the bank compounds interest.
#---------------------------------------------------------------------------
@interestTerm = 2
Set the universal max for loans here:
CODE
#---------------------------------------------------------------------------
# You can set a universal maximum for all loans here.
#---------------------------------------------------------------------------
@loanMax = 100000
Set the types of accounts you will allow:
CODE
#---------------------------------------------------------------------------
# All banks are created allowing the same account types. if you want to
# disable an account type for your game, change it's value below to false
#---------------------------------------------------------------------------
@allowSavings = true
@allowChecking = true
@allowLoans = true
Set the max saftey deposit boxes a bank can have in its vault. Any more than 64 will break the vault page:
CODE
#---------------------------------------------------------------------------
# Number of saftey deposit boxes in the vault. (multiples of 8 look best)
#---------------------------------------------------------------------------
@maxSlots = 64
Set the starting free(open) slots in each bank's vault here:
CODE
#---------------------------------------------------------------------------
# Number of starting "free" slots per bank.
#---------------------------------------------------------------------------
@freeSlots = 4
You can change the labels in the Window_Bank_Account:
CODE
#---------------------------------------------------------------------------
# Change these if you want to label the list differently.
#---------------------------------------------------------------------------
@headings = ["Account", "Interest Rate", "Balance"]
Feel free to use this in your game, but please give me a shout in the credits! Also, feel free to edit this for your own personal purposes but please do not repost an edited version without my consent first.
Also, mad props to whoever threw together the original icon set I worked from. (DLed it from the resource section before the site went down and I can't remember who made the file!)