Shop : Change Prices
Version: 3.5
By: Kain Nobel
Introduction
This script simply allows you to change prices on items, weapons and armors as well as save your changes in your save file. Also, you're able to reset these prices back to whats specified in the database on any/all items, weapons and armor easily.
Features
Script
Instructions
Place Above Main (and Below SDK, only if using). Don't try and modify the prices directly in the script, all that is handled via database and call scripts (see FAQ)
FAQ
Compatibility
This script WILL corrupt old save files!
Credits and Thanks
Thanks to whoever origionally requested this feature a couple months ago, if you come forward I'll put your name here ;)
Terms and Conditions
Another "Free to use in commercial and non-commercial games" script, but please credit yours truely :thumb:
Version: 3.5
By: Kain Nobel
Introduction
This script simply allows you to change prices on items, weapons and armors as well as save your changes in your save file. Also, you're able to reset these prices back to whats specified in the database on any/all items, weapons and armor easily.
Features
- Change prices of items, armors and weapons
- Price changes are saved/loaded with your save file
- Can reset prices back to whats set in the database
Script
Shop : Change Prices
Spoiler
- #===============================================================================
- # ** Shop : Change Prices
- #===============================================================================
- if Object.const_defined?(:SDK)
- SDK.log('Shop.ChangePrices', 'Kain Nobel ©', 3.5, '2009.09.01')
- SDK.log_overwrite("RPG::Item".to_sym, :price=)
- SDK.log_overwrite("RPG::Armor".to_sym, :price=)
- SDK.log_overwrite("RPG::Weapon".to_sym, :price=)
- end
- #===============================================================================
- # ** RPG::Item
- #===============================================================================
- class RPG::Item
- #-----------------------------------------------------------------------------
- # * Alias Listings
- #-----------------------------------------------------------------------------
- alias_method :changeprices_rpgitm_priceget, :price
- #-----------------------------------------------------------------------------
- # * Price
- #-----------------------------------------------------------------------------
- def price
- if $game_system.is_a?(Game_System) && $game_system.item_price.has_key?(id)
- return $game_system.item_price[id]
- end
- changeprices_rpgitm_priceget
- end
- #-----------------------------------------------------------------------------
- # * Price = (value)
- #-----------------------------------------------------------------------------
- def price=(value)
- $game_system.item_price[id] = [value, 0].max
- end
- end
- #===============================================================================
- # ** RPG::Armor
- #===============================================================================
- class RPG::Armor
- #-----------------------------------------------------------------------------
- # * Alias Listings
- #-----------------------------------------------------------------------------
- alias_method :changeprices_rpgarm_priceget, :price
- #-----------------------------------------------------------------------------
- # * Price
- #-----------------------------------------------------------------------------
- def price
- if $game_system.is_a?(Game_System) && $game_system.armor_price.has_key?(id)
- return $game_system.armor_price[id]
- end
- changeprices_rpgarm_priceget
- end
- #-----------------------------------------------------------------------------
- # * Price = (value)
- #-----------------------------------------------------------------------------
- def price=(value)
- $game_system.armor_price[id] = [value, 0].max
- end
- end
- #===============================================================================
- # ** RPG::Weapon
- #===============================================================================
- class RPG::Weapon
- #-----------------------------------------------------------------------------
- # * Alias Listings
- #-----------------------------------------------------------------------------
- alias_method :changeprices_rpgwpn_price, :price
- #-----------------------------------------------------------------------------
- # * Price
- #-----------------------------------------------------------------------------
- def price
- if $game_system.is_a?(Game_System) && $game_system.weapon_price.has_key?(id)
- return $game_system.weapon_price[id]
- end
- changeprices_rpgwpn_price
- end
- #-----------------------------------------------------------------------------
- # * Price = (value)
- #-----------------------------------------------------------------------------
- def price=(value)
- $game_system.weapon_price[id] = [value, 0].max
- end
- end
- #===============================================================================
- # ** Game_System
- #===============================================================================
- class Game_System
- #-----------------------------------------------------------------------------
- # * Public Instance Variables
- #-----------------------------------------------------------------------------
- attr_reader :item_price
- attr_reader :armor_price
- attr_reader :weapon_price
- #-----------------------------------------------------------------------------
- # * Alias Listings
- #-----------------------------------------------------------------------------
- alias_method :changeprices_gmsystem_initialize, :initialize
- #-----------------------------------------------------------------------------
- # * Object Initialization
- #-----------------------------------------------------------------------------
- def initialize
- changeprices_gmsystem_initialize
- @item_price = Hash.new
- @armor_price = Hash.new
- @weapon_price = Hash.new
- end
- #-----------------------------------------------------------------------------
- # * Reset Prices
- #-----------------------------------------------------------------------------
- def reset_prices
- reset_item_prices
- reset_armor_prices
- reset_weapon_prices
- end
- #-----------------------------------------------------------------------------
- # * Reset Item Prices
- #-----------------------------------------------------------------------------
- def reset_item_prices(*args)
- if args.empty?
- $data_items.each {|item| next if item.nil? ; args << item.id}
- end
- args.each {|i| @item_price.delete(i)}
- end
- #-----------------------------------------------------------------------------
- # * Reset Armor Prices
- #-----------------------------------------------------------------------------
- def reset_armor_prices(*args)
- if args.empty?
- $data_armors.each {|armor| next if armor.nil? ; args << armor.id}
- end
- args.each {|i| @armor_price.delete(i)}
- end
- #-----------------------------------------------------------------------------
- # * Reset Weapon Prices
- #-----------------------------------------------------------------------------
- def reset_weapon_prices(*args)
- if args.empty?
- $data_weapons.each {|weapon| next if weapon.nil? ; args << weapon.id}
- end
- args.each {|i| @weapon_price.delete(i)}
- end
- end
Expand to see the code.
Instructions
Place Above Main (and Below SDK, only if using). Don't try and modify the prices directly in the script, all that is handled via database and call scripts (see FAQ)
FAQ
Changing prices...
Spoiler
In order to change your prices, you'll need to do it via call script. Here's how I would do it...
- gs = $game_system
- gs.item_price[1] = 1000
- gs.armor_price[1] = 1000
- gs.weapon_price[1] = 1000
Expand to see the code.
Resetting prices...
Spoiler
In this example, I'm only gonna show you how to reset Item prices, you can do the same for armors and weapons...
...This will reset prices back to whats set in the database.
- gs = $game_system
- # No argument will reset ALL item prices
- gs.reset_item_prices
- # An array of item IDs will only reset prices on these items
- arr = [1, 2, 3, 4]
- gs.reset_item_prices(*arr)
- # You can also do it this way...
- gs.reset_item_prices(1, 2, 3, 4)
Expand to see the code.
...This will reset prices back to whats set in the database.
Compatibility
This script WILL corrupt old save files!
This script aliases the following methods...
Spoiler
RPG::Item.price
RPG::Armor.price
RPG::Weapon.price
Game_System.initialize
RPG::Armor.price
RPG::Weapon.price
Game_System.initialize
Credits and Thanks
Thanks to whoever origionally requested this feature a couple months ago, if you come forward I'll put your name here ;)
Terms and Conditions
Another "Free to use in commercial and non-commercial games" script, but please credit yours truely :thumb: