Group: Revolutionary
Posts: 267
Type: Artist
RM Skill: Beginner
Price Modify
Version : 3.25 Author : LordHeinrich - Assistance From Kread-Ex Release : 08/18/2010 Updates
o 2010.08.18 - Enhancements to Random Prices o 2010.08.01 - Info Window Bug Fix o 2010.07.30 - Compatibility with Buy Item Add-On o 2010.07.26 - Corrected bug with Charisma System where shop prices did not auto update o 2010.07.26 - Compatibility with v3 series of Shop Overhaul o 2010.07.09 - New feature "Party Charisma System" o 2010.07.09 - New feature, Price Discrimination (2nd Degree) o 2010.07.06 - Compatible with Sell Item Overhaul LITE o 2010.07.05 - Bug Fix. Now values reset when exiting shops o 2010.07.05 - Bug fix. selling_weapons did not work. o 2010.07.04 - Function to add or remove Random if BuyModify not imported o 2010.07.04 - Function to unimport BuyModify added o 2010.07.04 - Added RANDOM function. Purchase prices are now random when not calling a script.. o 2010.07.04 - Added BuyModify to modify purchase price. o 2010.07.04 - Added new functions for different classes. o 2010.07.04 - Improved compatibility with Sell Item Overhaul. o 2010.07.04 - Modified code for efficiency. Credit: Kread-Ex o 2010.07.04 - Added lines for default values. o 2010.07.03 - Started Script and Finished.
Introduction The shop scene is a bit lacking. Items are locked to selling at 50% of cost and prices are set to database values. This little script allows you to modify shop prices using script calls in shop events.
v2.10 adds the function NORAND. What this does is turn the RANDOM feature on or off, however, this will only affect the random feature if $imported["BuyModify"] = false, or in other words, if the BuyModify script is NOT going to be used. Descriptions are included in the instructions of the script.
v2.38 adds 2nd Degree Price Discrimination! This is a quantity discount (the more you buy, the more you save).
v2.50 adds a Simple Party Charisma System
v3.00 Compatible with v3 series of Sell Item Overhaul
v3.25 Adds enhancements to the Random price features.
Features - When not calling a script to set prices for buying items, the price is now Random ** Enhanced features to set the frequency of change for random prices - Adjust the Selling Price by setting a Percentile value of item/weapon/Armor Base cost - Allows shops to purchase items at both Premiums and Discounts - Allows modification of prices items are sold at in shops - Possibility to use events to change cost permanently using items or conditional branches - Purchase and Selling are independent from each other, the amount you can sell items for has no relation to Purchase price at a shop - This script includes two scripts in one and you can import either one or both (default is both). - Quantity Discounts set by configuration or by script calls with events - Simple Charisma system configurable by Script calls and Configuration module
Script
Link 3.25
http://www.megaupload.com/?d=3QPV4JZO
Sorry, code got too large for codebox...
Customization - Use the Configuration Module to set the Minimum and Maximum selling percentiles. - Set the price of goods when not calling the script by adjusting the default values - Random variable can be adjusted to modify the price. Set to 0 for no variance.
Compatibility - Works with default shop scene - Compatible with Sell Item Overhaul - Compatible with Buy Item Add-On
Screenshot
Event Setup
Shop that purchases at 40%
Installation - Place somewhere below materials and above Main. If used, place below Buy Item Overhaul and above Sell Item Overhaul.
FAQ
Terms and Conditions - Free to use - Please give credit
This post has been edited by LordHeinrich: Aug 19 2010, 12:05 AM
Group: +Gold Member
Posts: 4,136
Type: Scripter
RM Skill: Undisclosed
I can't help but notice that your script is very lacking performance-wise. By that, I mean two things: 1 - You rewrote the entire Scene_Shop while you could just have rewritten the specific part you have modified. 2 - This:
CODE
class Game_System::Selling attr_accessor :percent def initialize @percent = 0 end end
class Game_System attr_reader :selling alias_method :heinrich_selling_init, :initialize def initialize heinrich_selling_init @selling = Selling.new end end
This is rather inefficient. You are creating an entire new class just to set one single instance variable. You could have written it like this:
CODE
class Game_System attr_accessor :selling_percent alias_method :hein_game_system_init, :initialize def initialize hein_game_system_init @selling_percent = 0 end end
This would be beneficial in term of parsing speed, RAM and CPU.
__________________________
FRACTURE - a SMT inspired game (demo) made by Rhyme, Karsuman and me. Weep and ragequit.
Group: Revolutionary
Posts: 267
Type: Artist
RM Skill: Beginner
Thanks!!!!
I don't know much at all about scripting. Will create a new version very soon.
lol
I just noticed that I rewrote the entire scene shop
I forgot I had two versions of the script. One for for uploading and one for having in my game as I was going to combine this with the Overhaul script I made for myself.
Will fix shortly.
Adding another function at the moment to modify buying prices as well
Edit: Scene Shop modified. Thanks!!
This post has been edited by LordHeinrich: Jul 4 2010, 07:47 AM
Nice you're trying to get started with scripting. If you seek help how you could improve your script, you might want to take a look at my version of this addition to the rpg maker engine.
For the past couple of months I've been learning RGSS and I've got the basic stuff down such windows, variables, conditional statements, ect. But, I can't see myself making big scripts such as a jumping system or a side view battle system. I was wondering how you learned to script because I really want to know how to script really well.
Thanks in advance.
Hey there,
Well I don't make battle neither though I can still teach you some things :)... The way I've learned to script is by reading other scripts for the most part. I've allways been interested in other peoples work but this time I though I had to try to make something myself...and it worked!! The most importand thing when you go scripting is (at least in my case) that you want to make something to help an other wich can't script. You also need to feel the competition that's around in the scripting-community. Cause, I have to say, if you get pushed to get a sertain request done before an other scripter does, you feel POWERFULL!! :P So that's an other thing... You also don't need to be afraid to learn from others or helpfiles. When I write my scripts, I actualy always have the helpfiles open to look things up I don't know or remember. Then, you must be calm, cause you need to try the script a lot of times. When I write a script, I test it after almost every changes. First I set up the major structure. Like when I make a window-script or part of a script I start with something like this:
CODE
class Window_Name < Window_Base def initialize(x,y,width,height) super(x,y,width,height) refresh end
def refresh self.contents.clear draw_contents end
def draw_contents draw_something(with, some, parameters) end
def update refresh if @something != @what_it_should_be end end
So that's also very important. Then, the biggest thing I learned scripting from is TRIAL AND ERROR. That's the most irritating way to learn something, cause it's more ERROR than TRIAL, but it does the trick realy good.
So that's it how I did it. Now it's up to you. Do some requests (if I didn't do it allready :P) and learn from them.
Hope that helped you out a little. If not, keep your eye on the Scriptology-topic (see my sig) where I'll be updating for my scripting(video)tutorials. Perhaps they're going to be usefull for you one day ;)
Group: Revolutionary
Posts: 267
Type: Artist
RM Skill: Beginner
Updated to v2.05. I now added a RANDOM function. You can define the percentile variance for Item prices (when you purchase only). The price will change every time that someone enters a shop. If anyone doesn't like this feature, just set RANDOM = 0 and prices will not randomize.
If anyone wants, I could probably randomize everything, but for now I only set it to randomize purchase price when no script call is made. Making the script call:
$game_system.buying_xxxx = 0 would do the same.
xxxx cannot be "all", so you would have to specify the type, item, weapon, or armor.
If anyone wants, I can assign a specific value for the random function, like when n = 1 only or I can change it to work only when the buying_all function is used.
As it stands now, I believe this to be the final version of the script because I cannot think of anything else to add.
Group: Revolutionary
Posts: 267
Type: Artist
RM Skill: Beginner
I realized that I removed all functions to turn off BuyModify when set to false... I added them back and also added a function NORAND which would turn the random feature on and off. This is only when BuyModify is NOT imported and will not modify the random feature when BuyModify is imported. To turn the random feature off when buy Modify is imported, set RANDOM = 0.
Setting RANDOM = 0 will also turn off random when not importing BuyModify.
If anyone has any suggestions, feel free to share. Else, unless I can think of anything, the script is now in its final version.
Group: Revolutionary
Posts: 267
Type: Artist
RM Skill: Beginner
another update to v2.20.
Found a bug. When exiting shops, the values were not reset. Now, all $game_system script calls are reset when exiting a shop. I left the other script calls as permanent.
Group: Revolutionary
Posts: 267
Type: Artist
RM Skill: Beginner
I made a LITE version of Sell Item Overhaul that does not include the Menu changes. I thought it's better if I make two different versions because I may like the new menu, but someone else may like the default setup. Anyway, this version is compatible with both where as v2.20 is only compatible with the BUNDLED version.
So there are no new features other than the compatibility and no bug fixes. If you already have v2.20, and are not interested in using Sell Item Overhaul LITE, there is no need to download v2.25.
Group: Revolutionary
Posts: 267
Type: Artist
RM Skill: Beginner
Updated again. This time I added a new feature, Second Degree Price Discrimination. This would be a Quantity Discount, so basically, the more of an item you buy at a time, the less each individual item will cost. There are two configuration settings added to the script for this feature. One is to not import any of the code "PRICE_DISCRIMINATION = " and the other is to set the factor "DISCRIMINATION_FACTOR = "
When PRICE_DISCRIMINATION = false or DISCRIMINATION_FACTOR = 0, there will be no Quantity discounting
The discrimination factor initiates at values from 1 - 5. Anything past 5 will work, but it will not change the prices further.
When factor of 1 is used, the prices will change slowly. For low priced goods, you may not notice a discount until about 10 or so are bought. If 99 of the item is bought, then the discount will be approx 9.4%.
When factor of 5 is used, prices will change at the maximum rate. When 99 of an item is purchased, discount is approx 38.9%. This is why I stopped it at 5 as a factor of 6 would have about cut prices in half at 99 items.
The following script call can be made with this feature:
GNM::BUYCONFIG::DISCRIMINATION_FACTOR = n , where n is a number from 0 - 5
This will change the factor globally and permanently. Because of this, if you want to reset the discrimination factor, you have to do it at the end of the shop processing.
I opted not to do something with selling, but of it's requested, I can add it.
Group: Revolutionary
Posts: 267
Type: Artist
RM Skill: Beginner
Another update and another new feature. This time a simple party charisma system. The charisma system can be thought of as Shopping Experience. Basically the more you buy or sell, the higher your charisma. Charisma is able to do a couple of things.
When AFFECT_PRICE = true it will affect the level of price discrimination. Basically, the higher the charisma, the greater per item discounts when buying in bulk!
When AFFECT_BUY or AFFECT_SELL = true it will affect the price of items; lowering purchase price and raising selling price.
There are three script calls that can be made:
$game_party.charisma = n will set charisma = n
$game_party.gain_charisma(n) will gain n charisma
$game_party.lose_charisma(n) will lose n charisma
These commands can be used to make complex shopping events using conditional branches or control switches.
Charisma is displayed in the shop status menu right under "Possession".
The Charisma system will be compatible with the 2.35 series of Sell Item Overhaul scripts which will be uploaded shortly.
Group: Revolutionary
Posts: 267
Type: Artist
RM Skill: Beginner
I updated this script to be compatible with v3 series of the Shop Overhaul scripts. Also found a small bug in this one while testing the Shop Overhaul scripts.
When canceling a purchase of an item, the shop prices did not automatically change to reflect the new price after the change in charisma. This was corrected, so now the price of items displayed is accurate to the price paid.
Group: Revolutionary
Posts: 267
Type: Artist
RM Skill: Beginner
v3.01 - Made a small update for those that are using the Buy Item Add-On for Sell Item Overhaul. For those not using that add-on, v3.01 is not required.
Group: Revolutionary
Posts: 267
Type: Artist
RM Skill: Beginner
New version uploaded. Beginning the transition to "PriceModify" for the official name.
In this version, I enhanced the Random Price feature. you can now set the frequency of randomness. I added this one in an odd way, so I will explain a bit here, but all (more) instructions are within the script as well.
Originally, you could only set prices to be random, and they were always random. This is still an option, however, I added a few settings to give more control over the randomness of prices. They use seeds in order to make a more predictable random number generator. This will prevent prices from constantly fluctuating unless the seeds are turned off. The two ways to control the frequency are SEEDFACT & SEEDTIME.
SEEDFACT uses a seed factor, actually divisor to determine how often the seed is changed. The lower the number, the faster the frequency, however, the prices lock in once the shop is entered. This means that you can not scroll the items and the prices will change. This one can use any integer + / - infinity including 0. To turn the feature off, set SEEDFACT = false
SEEDTIME uses a simple timer that is built into the script. The timer is always going since it uses game time, however, you can set the script to use different units of time. They are hours, minutes and seconds. You would have to write the words for the unit of measurement in quotes, so "hours", "minutes", "seconds". To turn it off, set SEEDTIME = false
The timer alone is not enough however. You must also set the INTERVAL. The interval will change the price every n amount of x unit. INTERVAL must be a number from 1 to infinity. To prevent errors, setting INTERVAL = 0 will change the price every 43 of whatever unit you are using. Negatives will not cause errors and will just use the absolute value. I only did that because of the logic of something changing every -n seconds doesn't make sense.
It is possible to change all the settings with script calls. I gave examples within the script. Also, while it will not cause an error, you cannot use both SEEDFACT and SEEDTIME. The game will always choose SEEDTIME if both are turned on, so keep that in mind when configuring the script of making script calls.
Also, by default the Random Price feature is OFF, so in order for any of this to work, RANDOM cannot equal 0.
I didn't go too crazy testing this out, but the testing I did was successful. Please report any bugs if any are found.