Help - Search - Members - Calendar
Full Version: Shopoholic v 2.0
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS2-Submissions
Pages: 1, 2, 3, 4
cmpsr2000
Shopoholic

Version: 2.0
Author: Cmpsr2000
Release Date: June 25 2008

Introduction
Shopoholic is a modification that adds more features and functionality to the RMVX shopping system.


Features
  • Items sold to a shop may be repurchased.
  • Shops can have custom markup (or markdown!)
  • Shops can sell "used" items back to the player at a discount
  • Shops can charge tax
  • See modification to ALL attributes when hovering over an item
  • New in v 1.0!
    • Tax can be disabled
    • Shops can sell Skills, Classes, and Actors.
    • Shops can have a limited amount of items in stock
    • Shops can restock items.
    • Several new customization options available
  • New in v 2.0!
    • Shops can raise their prices once inventory hits a certain level.
    • Banking and Vault Storage!
    • Banks can have an unlimited number of accounts.
    • Accounts can be Savings (high interest), Checking(low interest, allows debit purchasing) or Loans.
    • Loans can be limited to a dollar amount per bank or globally.
    • Banks can have vaults with up to 64 slots of storage!
    • Slots(Safety Deposit Boxes) can be purchased, or given to the player freely.
    • Various other bank-related customizations.


Script
Click to view attachment
Click to view attachment
Click to view attachment
Click to view attachment
Click to view attachment
Click to view attachment
Click to view attachment
Click to view attachment
Click to view attachment
Click to view attachment
Click to view attachment
Click to view attachment


Customization

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"]



Compatibility
Requires RGSS2. Redefines Scene_Title, Scene_Shop, Window_ShopBuy, Game_Actor


Screenshot



New in v1.0!






New in v2.0!









DEMO
Click to view attachment


Installation
Copy the script files into your game under the materials section.


Todo List:
  1. Add sorting for used items
  2. Address possible script incompatibilities, clean up logic in various places


FAQ
None yet!

Terms and Conditions
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.

Thanks ^^/

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!)
woratana
Sounds pretty good. smile.gif

Though, in script part 'Redefinition'.
Why do you alias but not use it. tongue.gif
cmpsr2000
QUOTE (woratana @ May 18 2008, 10:11 PM) *
Sounds pretty good. smile.gif

Though, in script part 'Redefinition'.
Why do you alias but not use it. tongue.gif



Which one? In general I use alias so that I can redefine the existing method. That way, when the game calls a method, it goes to the new "edited" version I built instead of the preexisting method.
woratana
Well, it seems like you misunderstood on how to use alias tongue.gif

It's long, so I'll describe in spoiler smile.gif
[Show/Hide] description~

You can just do this:
CODE
  def create_game_objects
    $game_temp          = Game_Temp.new
    $game_message       = Game_Message.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    $game_shopping      = Game_Shopping.new
  end


And it will work same as:
CODE
  alias oldCreateGameObj create_game_objects
  def create_game_objects
    $game_temp          = Game_Temp.new
    $game_message       = Game_Message.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    $game_shopping      = Game_Shopping.new
  end


And what is the alias for? it's basically for shorten the script, and make the script compatible with others.
so, if you use alias in right way, it will be like this:

CODE
alias oldCreateGameObj create_game_objects
  def create_game_objects
    oldCreateGameObj
    $game_shopping      = Game_Shopping.new
  end


Read puppeto's alias tutorial may help you understand more about this. smile.gif
http://www.rpgrevolution.com/forums/?showtopic=13319
cmpsr2000
QUOTE (woratana @ May 18 2008, 10:33 PM) *
Well, it seems like you misunderstood on how to use alias tongue.gif

It's long, so I'll describe in spoiler smile.gif
[Show/Hide] description~

You can just do this:
CODE
  def create_game_objects
    $game_temp          = Game_Temp.new
    $game_message       = Game_Message.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    $game_shopping      = Game_Shopping.new
  end


And it will work same as:
CODE
  alias oldCreateGameObj create_game_objects
  def create_game_objects
    $game_temp          = Game_Temp.new
    $game_message       = Game_Message.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    $game_shopping      = Game_Shopping.new
  end


And what is the alias for? it's basically for shorten the script, and make the script compatible with others.
so, if you use alias in right way, it will be like this:

CODE
alias oldCreateGameObj create_game_objects
  def create_game_objects
    oldCreateGameObj
    $game_shopping      = Game_Shopping.new
  end


Read puppeto's alias tutorial may help you understand more about this. smile.gif
http://www.rpgrevolution.com/forums/?showtopic=13319


That's what I was used to as well, but I was getting compiler errors when redefining certain RGSS methods without first aliasing.
woratana
What did you do that return error?

try not to use the capitalize text as new name
e.g.
CODE
alias old_method method
cmpsr2000
QUOTE (woratana @ May 18 2008, 10:53 PM) *
What did you do that return error?

try not to use the capitalize text as new name
e.g.
CODE
alias old_method method


I was getting the error from redefining a method, not from using alias. Camel-casing is supported in ruby, only all-caps names are inferred constants (as it should be).

It was so long ago I can't remember the error I was getting. It was back when I first started working with RMVX, I found that if I first aliased the method, I no longer received the error so I simply adopted it as a best-practice for RMVX coding(rather that tracking down the actual cause of the error).

If I have time, I'll try and replicate the error.
woratana
Well, the problem is that other scripts that alias methods you aliased in that script will not compatible. sad.gif

So I hope you will find the solution soon. smile.gif
YanXie
Well, sometimes when using alias method, the positioning of the alias line could also play a role in scripting.

Say,for example I want to alias this method from Scene_Map :

CODE
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    $game_map.interpreter.update      # Update interpreter
    $game_map.update                  # Update map
    $game_player.update               # Update player
    $game_system.update               # Update timer
    @spriteset.update                 # Update sprite set
    @message_window.update            # Update message window
    unless $game_message.visible      # Unless displaying a message
      update_transfer_player
      update_encounter
      update_call_menu
      update_call_debug
      update_scene_change
    end
  end


I'd do this :

CODE
  #--------------------------------------------------------------------------  
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if $game_bank.gold != 0 or $game_bank.loan != 0
     $game_bank.step                     # Add $game_bank.step
    end
    puppet_bank_update                  # The usual.
  end
end


Rather than this :

CODE
  
  #--------------------------------------------------------------------------  
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    puppet_bank_update                  # The usual.
    if $game_bank.gold != 0 or $game_bank.loan != 0
     $game_bank.step                     # Add $game_bank.step
    end
  end
end


The later sometimes can cause problem.

I can't really verify the cause, but it seem it is conflicting with the "unless" variable.

btw, this is big example of how I use alias :

CODE
#==============================================================================
# ** Alias Start
#==============================================================================
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
#  This class performs the title screen processing.
#==============================================================================
class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # * Create Game Objects
  #--------------------------------------------------------------------------
  alias puppet_bank_create_game_objects create_game_objects # Alias method
  def create_game_objects
    puppet_bank_create_game_objects    # The usual.
    $game_bank = Game_Bank.new         # Create $game_bank.
  end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs the map screen processing.
#==============================================================================
class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------  
  # * Alias Listing
  #--------------------------------------------------------------------------  
  alias puppet_bank_terminate terminate # Alias method
  alias puppet_bank_update update       # Alias method
  #--------------------------------------------------------------------------  
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    snapshot_for_clearback              # Create clear snapshot.
    puppet_bank_terminate               # The usual.
  end  
  #--------------------------------------------------------------------------  
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if $game_bank.gold != 0 or $game_bank.loan != 0
     $game_bank.step                     # Add $game_bank.step
    end
    puppet_bank_update                  # The usual.
  end
end
#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
#  This class performs the save and load screen processing.
#==============================================================================

class Scene_File < Scene_Base
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias puppet_bank_write_save_data write_save_data # Alias method  
  alias puppet_bank_read_save_data read_save_data # Alias method  
  #--------------------------------------------------------------------------
  # * Write Save Data
  #     file : write file object (opened)
  #--------------------------------------------------------------------------
  def write_save_data(file)
    puppet_bank_write_save_data(file)       # The usual.
    Marshal.dump($game_bank,         file)  # Create dump for $game_bank.
  end
  #--------------------------------------------------------------------------
  # * Read Save Data
  #     file : file object for reading (opened)
  #--------------------------------------------------------------------------
  def read_save_data(file)
    puppet_bank_read_save_data(file)        # The usual.
    $game_bank         = Marshal.load(file) # Load $game_bank
  end
end  
#==============================================================================
# ** End of Alias
#==============================================================================
################################################################################


It works well for me, no error at all.

cheers,puppeto4. wink.gif

The Wizard 007
This is a great idea for a script and I see many uses for it. I do have a problem though when I set weapons in the shop. I get a 'Window_Shop_Details' line 150: NoMethod Error. It says undefined method 'atk' for nil:NilClass. Any idea what it could be and how to fix it? Your help would be greatly appreciated.
dragondp1
Well it is cool and all but when i play the game and go to a shop, it says error line 347...
cmpsr2000
QUOTE (puppeto4 @ May 19 2008, 03:00 PM) *
btw, this is big example of how I use alias :

It works well for me, no error at all.

cheers,puppeto4. wink.gif


Right, I understand how it's supposed to work. (see redefinitions of ACS, I use aliases to allow for menu customization)

Thank you guys for trying to help though, I appreciate the sentiment! biggrin.gif

I did actually manage to track down my previous error to the hacked version of RMVX I was using prior to the stateside release! This is great, since I can go back and remove all the extra aliases I added in to help get around it. So far this script and ACS are working without them. Woot!

QUOTE (The Wizard 007 @ May 19 2008, 04:29 PM) *
This is a great idea for a script and I see many uses for it. I do have a problem though when I set weapons in the shop. I get a 'Window_Shop_Details' line 150: NoMethod Error. It says undefined method 'atk' for nil:NilClass. Any idea what it could be and how to fix it? Your help would be greatly appreciated.


This is probably because one of your actors is not wearing a weapon in the primary slot. I have fixed this bug in the current version I'm working on, so the next release should fix it for ya ^^

QUOTE (dragondp1 @ May 21 2008, 05:53 PM) *
Well it is cool and all but when i play the game and go to a shop, it says error line 347...


Make sure to read the instructions up above for calling the shop. You have to set some variables in each shopkeeper event or it won't work! If you still have problems, post some more detailed information on the error for me.
woratana
I suggest you not to mention about illegal copy of RMVX. tongue.gif
(If I'm not misunderstood)
The Wizard 007
Cool thanks, that would be great.
gend0
Great ! cmpsr2000

But shop menu does not support for single character sprite
Ex. $ralph.png

Can you fix it ? happy.gif
The Wizard 007
Yeah I noticed that too plus if you have any negative stat modifiers to equipment it doesn't show correctly in the box to the right, it'll show the color change as down but the number stays the same. This really is a great script and I would hate to not be able to use it.
cmpsr2000
QUOTE (gend0 @ May 25 2008, 12:26 AM) *
Great ! cmpsr2000

But shop menu does not support for single character sprite
Ex. $ralph.png

Can you fix it ? happy.gif


Yes, this is already fixed in the next version actually ^^b

QUOTE (The Wizard 007 @ May 25 2008, 09:06 PM) *
Yeah I noticed that too plus if you have any negative stat modifiers to equipment it doesn't show correctly in the box to the right, it'll show the color change as down but the number stays the same. This really is a great script and I would hate to not be able to use it.


This is also already fixed in the version I'm working on ^^b

Hold tight, it should be done by tomorrow!
The Wizard 007
Awesome glad you are making an update. Not to be a pain but is it almost done?
cmpsr2000
QUOTE (The Wizard 007 @ Jun 2 2008, 05:45 PM) *
Awesome glad you are making an update. Not to be a pain but is it almost done?


Yes biggrin.gif

New in v 1.0
  • Tax can be disabled
  • Shops can sell Skills, Classes, and Actors.
  • Shops can have a limited amount of items in stock
  • Shops can restock items.
  • Several new customization options available


and, bug-fixes galore.

Try it out and let me know if you find any bugs or want anything extra ^^b
The Wizard 007
Oh thanks a million cmpsr2000. You really went all out on the update. I was expecting a couple fixes but this is just great!!! A nice bonus of selling skills, classes, and actors(that almost seems wrong). Great work, the demo works great but still have to test it on my project but it should be ok. I'll let you know if I find any bugs or inconsistencies. You are one hardcore scripter.
cmpsr2000
QUOTE (The Wizard 007 @ Jun 3 2008, 04:33 PM) *
Oh thanks a million cmpsr2000. You really went all out on the update.


You have no idea ;.; Took me twice as long as I was planning lol

QUOTE (The Wizard 007 @ Jun 3 2008, 04:33 PM) *
A nice bonus of selling skills, classes, and actors(that almost seems wrong).


Everyone needs a slave now and then laugh.gif

Actually I added that so people could build a "mercenary" system easily.
The Wizard 007
Yeah the hireling/mercenary system will be great for a side project I am somewhat working on. After a little more playing around I found a couple bugs. In the nomal shop if I try purchasing the first item no mater what it is it brings up a line 393 NoMethodError, undefined method '>' for false:FalseClass, tried tweaking the symbols a little, didn't work, then tried deleting lines 392-397 it worked then but I'm not sure if it will affect anything eventually.

I found the second bug when I changed the shop menu a little and started buying some equipment for some reason it doesn't add the item to the inventory, it will make the sound like it is being bought then I noticed the possession number stayed 0 and went to check my items and there was nothing added.

I then made sure to test both of these bugs again on your new demo without any modifications and sure enough they are still there, the NoMethod Error and the shopkeeper who steals your money bug (pretty comical twist actually).
I hope these bugs are easily fixable. I know you've been working hard on it and have other scripts on your plate to deal with.

And as far as adding features the script has awesome features already but maybe have an option to show hit rate, evasion, and critical +'s and -'s, it looks like there would be room to do so in the right hand shop menu. And maybe a feature that shows the actual + or - for each weapon/armor stat instead of the total atk/def/etc. that the actor would have after equipping the item. Something like...

Atk +3 Spi -1
Def +4 Agi +0

Hope you can consider these features but it's not really necessary. ANyway good luck and thanks.
cmpsr2000
QUOTE (The Wizard 007 @ Jun 3 2008, 05:36 PM) *
Yeah the hireling/mercenary system will be great for a side project I am somewhat working on. After a little more playing around I found a couple bugs. In the nomal shop if I try purchasing the first item no mater what it is it brings up a line 393 NoMethodError, undefined method '>' for false:FalseClass, tried tweaking the symbols a little, didn't work, then tried deleting lines 392-397 it worked then but I'm not sure if it will affect anything eventually.

I found the second bug when I changed the shop menu a little and started buying some equipment for some reason it doesn't add the item to the inventory, it will make the sound like it is being bought then I noticed the possession number stayed 0 and went to check my items and there was nothing added.

I then made sure to test both of these bugs again on your new demo without any modifications and sure enough they are still there, the NoMethod Error and the shopkeeper who steals your money bug (pretty comical twist actually).
I hope these bugs are easily fixable. I know you've been working hard on it and have other scripts on your plate to deal with.

And as far as adding features the script has awesome features already but maybe have an option to show hit rate, evasion, and critical +'s and -'s, it looks like there would be room to do so in the right hand shop menu. And maybe a feature that shows the actual + or - for each weapon/armor stat instead of the total atk/def/etc. that the actor would have after equipping the item. Something like...

Atk +3
Def +4


Good idea, I'll add an option that will allow the developer to choose additive or strict modifier +/-.

I thought I had fixed all those "> false" errors >.< For some reason, the hash is returning the value of .eql? instead of evaluating it and returning the default "nil" value. I think I know what the equip problem is as well, those should be easy fixes...brb >.>

edit: Ok, fixed the bugs. The feature will be in the next big update.

v 1.01 changes:
  • Fixed bug where the shopkeeper would steal your money and keep your equipment when buying biggrin.gif
  • Fixed crash when buying from a basic store.
The Wizard 007
Great work man, works like a charm. Thanks for responding so quickly. I Look forward to the next update.
From_Ariel
You need to move shopaholic.zip to demo the demo link is broken smile.gif
cmpsr2000
QUOTE (From_Ariel @ Jun 4 2008, 05:52 AM) *
You need to move shopaholic.zip to demo the demo link is broken smile.gif


ah I forgot to update the postIDs after I changed out the files, good catch!
cmpsr2000
New in v 1.02:
  • Updated compatibility with other scripts. Saving and object instantiation should now happen unless another script is placed AFTER Shopoholic that redefines those methods without first aliasing and executing the alias.
sargunster
ur an amazing scripter!!!!
cmpsr2000
QUOTE (sargunster @ Jun 13 2008, 02:52 PM) *
ur an amazing scripter!!!!


lol thanks! laugh.gif
Devlin
Fantastic script! I really love your shopoholic script. It's so useful and I can think of many different ways to use them, such as day/night shops, depending on relationships between shopkeeper and player, they can mark down the price or up, and so forth. It I'll be keeping my eye on this script.

EDIT: Okay, I ran into an odd error. I thought it might be same SHOPID I used so I changed it to 2. And I still run into the problems if I have money. I go into the shop if I don't have any gold and it works fine. But soon as I get money, and open the shop again, it crashed. It was weird because my first shopping event works prefectly but my second shopping event is not.


[Show/Hide] Picture

You can see how I set up the call script, and ran into the error soon as I talked to the shopping event. Also you can see the picture at bottom, I was able to open up the shopping menu only if I have no gold. I'm not sure if this information is useful to you but I have only one person in the party, nobody else.


EDIT2:
I found out the cause of the problem. It is "purchase only" option. I checked it because I didn't want the player to sell anything to the shop. With the option checked, I run into the errors. If I unchecked it, works fine.
cmpsr2000
QUOTE (Devlin @ Jun 14 2008, 10:16 PM) *
EDIT: Okay, I ran into an odd error. I thought it might be same SHOPID I used so I changed it to 2. And I still run into the problems if I have money. I go into the shop if I don't have any gold and it works fine. But soon as I get money, and open the shop again, it crashed. It was weird because my first shopping event works prefectly but my second shopping event is not.

EDIT2:
I found out the cause of the problem. It is "purchase only" option. I checked it because I didn't want the player to sell anything to the shop. With the option checked, I run into the errors. If I unchecked it, works fine.


hmm that's odd, I'll take a look at it. is your first shopping event a basic shop as well?
Devlin
QUOTE (cmpsr2000 @ Jun 14 2008, 08:55 PM) *
QUOTE (Devlin @ Jun 14 2008, 10:16 PM) *
EDIT: Okay, I ran into an odd error. I thought it might be same SHOPID I used so I changed it to 2. And I still run into the problems if I have money. I go into the shop if I don't have any gold and it works fine. But soon as I get money, and open the shop again, it crashed. It was weird because my first shopping event works prefectly but my second shopping event is not.

EDIT2:
I found out the cause of the problem. It is "purchase only" option. I checked it because I didn't want the player to sell anything to the shop. With the option checked, I run into the errors. If I unchecked it, works fine.


hmm that's odd, I'll take a look at it. is your first shopping event a basic shop as well?


Yes, it's also a basic shop. But the purchase only option was not checked. That is why my first shopping event worked fine.

EDIT: I went back to test it. I set my first shopping event to "purchase only", and yep. I ran into same error.
cmpsr2000
QUOTE (Devlin @ Jun 14 2008, 11:06 PM) *
Yes, it's also a basic shop. But the purchase only option was not checked. That is why my first shopping event worked fine.

EDIT: I went back to test it. I set my first shopping event to "purchase only", and yep. I ran into same error.



Ok, that should be easily fixable. I'm working on a new version of this right now anyhow.
Devlin
QUOTE (cmpsr2000 @ Jun 14 2008, 09:36 PM) *
Ok, that should be easily fixable. I'm working on a new version of this right now anyhow.


Okay. I will be looking forward at your new version. Thank you for your script.
Stress
This is insane!

Haha. Nice!

Thanks! I don't have many shops in my game but when I do...they'll be AWESOME!!!

Haha! Actually the best part of this is the cha ching sound effect included. That's gold.

EDIT: /facepalm...

SE is standard RPGM VX...

Heh. You learn something new everyday!!!
spike_xp
may i request a feature? a feature that makes floating prices. if the stock's low, then make the price will grow higher. vice versa.

thx for your attention...
cmpsr2000
QUOTE (spike_xp @ Jun 16 2008, 05:37 AM) *
may i request a feature? a feature that makes floating prices. if the stock's low, then make the price will grow higher. vice versa.

thx for your attention...


That's a good idea, I'll add it into the upcoming version! thumbsup.gif
Aindra
Great script.

My suggestion that you go add your credit/version into the script as the comments. Because there are no version listed in the script, I wasn't sure if I'm using 1.0 version or 1.02 version. The demo says something like "Welcome to Shopolic 1.0!" so that got me all confused.
cmpsr2000
QUOTE (Aindra @ Jun 17 2008, 09:12 PM) *
Great script.

My suggestion that you go add your credit/version into the script as the comments. Because there are no version listed in the script, I wasn't sure if I'm using 1.0 version or 1.02 version. The demo says something like "Welcome to Shopolic 1.0!" so that got me all confused.


Ah ok, I was kinda lazy on the commenting for awhile but I've been adding this info in with my newest versions. I'll make sure it's there with the next version!
Aindra
That's good. happy.gif

If you don't mind another suggestion for your script...

Player can only sell weapons to weaponsmith, armours to armoursmith, etc. Is it possible?
cmpsr2000
QUOTE (Aindra @ Jun 18 2008, 01:37 PM) *
That's good. happy.gif

If you don't mind another suggestion for your script...

Player can only sell weapons to weaponsmith, armours to armoursmith, etc. Is it possible?


Yes, restrictive selling and other selling modifications are on my list of things to add at a later date, but right now I'm going to focus on getting banking and storage working ^^
Aindra
Yes. I noticed that you got a lot on your scripting plate. I hope you don't get burnt out with fixing/updating several of your scripts!

Good luck. happy.gif
sargunster
hmm... banking what would it do?
give you interest on the money you store?
confused.gif unsure.gif huh.gif
mukumuku
@compsr2000 Your class change script is great however there are no methods to save a characters item/level/exp when changing class. I'm bad at scripting, the only thing i did with my experience is reroute it to a comment event. Everytime a character switches class on accept button pressed. The comment event works and all but however when trying to set var to exp and leveling the char using that var, it doesn't past through. The character remains the same level and items are removed at random.

Is there a chance to add a character 1-4 level/item/exp/stats data etc?
cmpsr2000
QUOTE (mukumuku @ Jun 18 2008, 03:09 PM) *
@compsr2000 Your class change script is great however there are no methods to save a characters item/level/exp when changing class. I'm bad at scripting, the only thing i did with my experience is reroute it to a comment event. Everytime a character switches class on accept button pressed. The comment event works and all but however when trying to set var to exp and leveling the char using that var, it doesn't past through. The character remains the same level and items are removed at random.

Is there a chance to add a character 1-4 level/item/exp/stats data etc?


This is the wrong thread for that question @.@

My response will be in the class switcher thread.
cmpsr2000
whew, v 2.0 is live!

I fixed a few bugs, such as the shop-buy-only crash on simple shops, but otherwise:

New in v 2.0!
  • Shops can raise their prices once inventory hits a certain level.
  • Banking and Vault Storage!
  • Banks can have an unlimited number of accounts.
  • Accounts can be Savings (high interest), Checking(low interest, allows debit purchasing) or Loans.
  • Loans can be limited to a dollar amount per bank or globally.
  • Banks can have vaults with up to 64 slots of storage!
  • Slots(Safety Deposit Boxes) can be purchased, or given to the player freely.
  • Various other bank-related customizations.


New screenshots:







New Customization:
--workin on it right now--
YanXie
Good job happy.gif. Now let see how you handle the storing methods >_>, since that what I'm stuck with
Netto
Great job! This script will be very popular in a few seconds smile.gif
cmpsr2000
QUOTE (puppeto4 @ Jun 25 2008, 05:40 PM) *
Good job happy.gif. Now let see how you handle the storing methods >_>, since that what I'm stuck with


The vault actually is item storage. I decided to write a completely different script for pure storage, though, to let the users choose between a list-type and the grid-type I have in the bank vault.
Netto
Great job! This script will be very popular in a few seconds smile.gif

Edit: Good timing cmpsr2000, lol you saved my from double post
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.