Tsukihime 1,489 Posted October 24, 2012 (edited) Feature: Haggle Rate -Tsukihime Receive discounts at shops when buying things! Download Script: http://db.tt/n4aRayJq Required: Feature Manager Usage Tag database objects with <ft: haggle_rate x>For some float x representing the haggle rate. For example, 0.5 means you get half-price on everything, whereas 2 means everything is twice as expensive. Edited May 27, 2015 by Tsukihime 1 Share this post Link to post Share on other sites
dbchest2 11 Posted October 24, 2012 aw, rather useful. Share this post Link to post Share on other sites
TheFaceless 6 Posted October 24, 2012 Question: Does this mean that sometimes the price will be at 2x or 0.5x or permanantly 2x or 0.5x? Share this post Link to post Share on other sites
Tsukihime 1,489 Posted October 24, 2012 (edited) Depends on how you use it. If you put the feature on a state, then the price will change only when the state is active (on the leader) If you put it on an actor, then the price will always change as long as you are the leader. So for example if you have a merchant class and you say that they always buy stuff for cheaper...then you would put the feature on them as a class feature. Edited October 24, 2012 by Tsukihime Share this post Link to post Share on other sites
TheFaceless 6 Posted October 24, 2012 wow thats good, thanks might be useful in my game should I include it later Share this post Link to post Share on other sites
Bunni89 85 Posted October 24, 2012 Is there any way you can use this to make different shops have different prices? Like the shop in one city sells stuff at 0.9x rate, but it always does that, not just only if you have a certain character. Also it'd be neat if you could modify prices for specific items, like a state that means all food is cheaper, or a shop that sells really expensive potions but everything else is normal rate. The default system in rpgmaker is really rather restrictive XD Share this post Link to post Share on other sites
Tsukihime 1,489 Posted October 24, 2012 Well, some issues 1: first, you will need a way to categorize your items (eg: food, pots, ...). Until something like that exists (which is trivial), you won't be able to specify discounts on a type of item 2: Then you will need a way to note tag a shop. Again, no nice solutions for that. I have written a note-section script that makes it easy to set up shop note tags, but I haven't developed it. Share this post Link to post Share on other sites
PhoenixSoul 1,412 Posted September 17, 2017 (edited) Yeah, I'll just say this. Multiple applied tags ADD rather than MULTIPLY together. Since I don't think NEGATIVE INTEGERS are implemented, if one wanted to use .75 and another .75 to increase the discount even more (would be .56), it would become 1.5, A VERY LIKELY UNWANTED 50% INFLATION. So, after some time, I got some assistance with this issue. Thanks to @LockeZ, one can now use multiplied values rather than added values. Since the Dropbox link is shredded just as much as a person through a wood chipped would be, spoiler tag + code box, ACTIVATE! Spoiler =begin #============================================================================== ** Feature: Haggle Rate Author: Hime Date: Oct 23, 2012 ------------------------------------------------------------------------------ ** Change log Sept 17, 2017 - added optional line to have the values multiply together instad of add. Oct 23, 2012 - initial release ------------------------------------------------------------------------------ ** Terms of Use * Free to use in non-commercial projects * Contact me for commercial use * No real support. The script is provided as-is * Will do bug fixes, but no compatibility patches * Features may be requested but no guarantees, especially if it is non-trivial * Preserve this header ------------------------------------------------------------------------------ ** Required -Feature Manager (http://himeworks.com/2012/10/13/feature-manager) ------------------------------------------------------------------------------ Receive discounts at shops. Party discount rate determined by the haggle rate of the leader. Tag database objects with <ft: haggle_rate x> For some float x. If x = 0, then everything is free If x > 0 and x < 1, then you have a discount If x == 1 then normal price If x > 1 then prices are inflated #============================================================================== =end $imported = {} if $imported.nil? $imported["Feature_EquipTypeRequirement"] = true #============================================================================== # ** Rest of the script #============================================================================== module Features module Haggle_Rate FeatureManager.register(:haggle_rate, 1.0) end end module RPG class BaseItem def add_feature_haggle_rate(code, data_id, args) data_id = 0 value = args[0].to_f add_feature(code, data_id, value) end end end class Game_Party < Game_Unit def haggle_rate val = leader.features_sum(:haggle_rate, 0) #~ val = leader.features_with_id(:haggle_rate, 0).inject(1.0) {|r, ft| r *= ft.value } #If you would rather have haggle rates that multiply the values, #use the line above and comment out the previous line -Amyrakunejo and LockeZ val > 0 ? val : 1 end end class Window_ShopBuy < Window_Selectable alias :ft_haggle_rate_price :price def price(item) return (ft_haggle_rate_price(item) * $game_party.haggle_rate).to_i end end So, that's basically it. "_sum" is replaced with "_with_id" and ".inject(1.0) {|r, ft| r *= ft.value }" is added after "( :haggle_rate, 0)" I guess having experience with multiple programming languages becomes useful over time... Me, my highest level of experience is with Hexadecimal, but that's another story. You good people, enjoy. Edited September 18, 2017 by PhoenixSoul Uploaded original script plus the fix. Don't use Dropbox, or you will get cancer. Share this post Link to post Share on other sites