Shop Taxes VX, They are everywhere now... |
|
|
|
|
Feb 14 2010, 12:27 PM
|

Level 2

Group: Member
Posts: 18
Type: Mapper
RM Skill: Skilled

|
Script InfoWith this script you can add taxes to shops, or even add discounts. Depending on the item's price, you can make taxes or discounts everywhere. You can even create shops which will give you money when you buy an item if you overdo the discounts. FeaturesTaxes (in percentage) Discounts (in percentage) Taxes (in amounts) Discounts (in amounts) Free items Free items with money Items (that are free normally) with a price ScreensScriptCODE #============================================================================ # Tax Script 2.5 (BETA)(VX) #---------------------------------------------------------------------------- # Originally made by Falcon for RMXP (see further info at bottom of this part) # Edited by Delyemerald2 to fit the RMVX #---------------------------------------------------------------------------- # This system adds something to shop status, but in the same process, copies # Everything normally there. # With this script, you can add taxes or discounts. # In order to do so, use the command Script in an event and enter this: # (For Taxes) # $game_system.tax.percent = x # Where x is a value above 0 (will be counted in percentages) # $game_system.tax.direct = y # Where y is a value above 0 (this will be added to the base prices) # (For Discounts) # $game_system.tax.percent = x # Where x is a value below 0 (will be counted in percentages) # $game_system.tax.direct = y # Where y is a value below 0 (this will be added to the base prices) #---------------------------------------------------------------------------- # Credits to: # Falcon for the original script # Blizard for the idea that triggered version 2.0 (Falcon's Credits) # You, becuase you eat a cookie in your life =D #---------------------------------------------------------------------------- # ORIGINAL INFO (RMXP Version) #---------------------------------------------------------------------------- # By Falcon # Thanks to Blizzard for the idea that triggered version 2.0 #---------------------------------------------------------------------------- # This system should be compatible with all shop systems, but the # Shop Status window will only show the tax/discount rate for the default #============================================================================
# setup the variable that will hold the tax rate class Game_System::Tax Direct_First = true attr_accessor :percent attr_accessor :direct def initialize @percent = 0 @direct = 0 end end
class Game_System attr_reader :tax alias_method :delyemerald2_tax_init, :initialize def initialize delyemerald2_tax_init @tax = Tax.new end end # increase the price of the following items by the tax rate class RPG::Item def price return Integer(@price + $game_system.tax.direct + @price * $game_system.tax.percent / 100) end end
class RPG::Weapon def price return Integer(@price + $game_system.tax.direct + @price * $game_system.tax.percent / 100) end end
class RPG::Armor def price return Integer(@price + $game_system.tax.direct + @price * $game_system.tax.percent / 100) end end
class Window_ShopStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization # x : window X coordinate # y : window Y coordinate #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 240, 304) @item = nil refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear if @item != nil number = $game_party.item_number(@item) self.contents.font.color = system_color self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession) self.contents.font.color = normal_color self.contents.draw_text(4, 0, 200, WLH, number, 2) # Here you can customize what there will stand when there's a tax. You can also # edit the heights of the words and numbers. One warning: Don't make it to long # or it will overlap the percentages. if $game_system.tax.percent > 0 # If there is tax self.contents.draw_text(4, 16, 200, WLH, "Current Tax") self.contents.font.color = normal_color self.contents.draw_text(100, 16, 104, WLH, $game_system.tax.percent.to_s + "%", 2) elsif 0 > $game_system.tax.percent # If there is a discount rate self.contents.draw_text(4, 16, 200, WLH, "Discount") self.contents.font.color = normal_color self.contents.draw_text(100, 16, 104, WLH, $game_system.tax.percent.to_s + "%", 2) end if $game_system.tax.direct > 0 # If there is tax self.contents.draw_text(4, 32, 200, WLH, "Tax (A)") self.contents.font.color = normal_color self.contents.draw_text(100, 32, 104, WLH, $game_system.tax.direct.to_s , 2) elsif 0 > $game_system.tax.direct # If there is a discount rate self.contents.draw_text(4, 32, 200, WLH, "Discount (A)") self.contents.font.color = normal_color self.contents.draw_text(100, 32, 104, WLH, $game_system.tax.direct.to_s , 2) end for actor in $game_party.members x = 4 y = WLH * (2 + actor.index * 2) draw_actor_parameter_change(actor, x, y) end end end #-------------------------------------------------------------------------- # * Draw Actor's Current Equipment and Parameters # actor : actor # x : draw spot x-coordinate # y : draw spot y-coordinate #-------------------------------------------------------------------------- def draw_actor_parameter_change(actor, x, y) return if @item.is_a?(RPG::Item) enabled = actor.equippable?(@item) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x, y, 200, WLH, actor.name) if @item.is_a?(RPG::Weapon) item1 = weaker_weapon(actor) elsif actor.two_swords_style and @item.kind == 0 item1 = nil else item1 = actor.equips[1 + @item.kind] end if enabled if @item.is_a?(RPG::Weapon) atk1 = item1 == nil ? 0 : item1.atk atk2 = @item == nil ? 0 : @item.atk change = atk2 - atk1 else def1 = item1 == nil ? 0 : item1.def def2 = @item == nil ? 0 : @item.def change = def2 - def1 end self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change), 2) end draw_item_name(item1, x, y + WLH, enabled) end #-------------------------------------------------------------------------- # * Get Weaker Weapon Equipped by the Actor (for dual wielding) # actor : actor #-------------------------------------------------------------------------- def weaker_weapon(actor) if actor.two_swords_style weapon1 = actor.weapons[0] weapon2 = actor.weapons[1] if weapon1 == nil or weapon2 == nil return nil elsif weapon1.atk < weapon2.atk return weapon1 else return weapon2 end else return actor.weapons[0] end end #-------------------------------------------------------------------------- # * Set Item # item : new item #-------------------------------------------------------------------------- def item=(item) if @item != item @item = item refresh end end end CODE #============================================================================ # Tax Script 2.0 (VX) #---------------------------------------------------------------------------- # Originally made by Falcon for RMXP (see further info at bottom of this part) # Edited by Delyemerald2 to fit the RMVX #---------------------------------------------------------------------------- # This system adds something to shop status, but in the same process, copies # Everything normally there. # With this script, you can add taxes or discounts. # In order to do so, use the command Script in an event and enter this: # (For Taxes) # $game_system.taxrate = x # Where x is a value above 0 (will be counted in percentages) # $game_system.taxamount = y # Where y is a value above 0 (this will be added to the base prices) # (For Discounts) # $game_system.taxrate = x # Where x is a value below 0 (will be counted in percentages) # $game_system.taxamount = y # Where y is a value below 0 (this will be added to the base prices) #---------------------------------------------------------------------------- # Credits to: # Falcon for the original script # Blizard for the idea that triggered version 2.0 (Falcon's Credits) # You, becuase you eat a cookie in your life =D #---------------------------------------------------------------------------- # ORIGINAL INFO (RMXP Version) #---------------------------------------------------------------------------- # By Falcon # Thanks to Blizzard for the idea that triggered version 2.0 #---------------------------------------------------------------------------- # This system should be compatible with all shop systems, but the # Shop Status window will only show the tax/discount rate for the default #============================================================================
# setup the variable that will hold the tax rate class Game_System attr_accessor :taxrate attr_accessor :taxamount alias declaration initialize def initialize declaration @taxrate = 0 @taxammount = 0 end end
# increase the price of the following items by the tax rate class RPG::Item def price return Integer(@price + $game_system.taxamount + @price * $game_system.taxrate / 100) end end
class RPG::Weapon def price return Integer(@price + $game_system.taxamount + @price * $game_system.taxrate / 100) end end
class RPG::Armor def price return Integer(@price + $game_system.taxamount + @price * $game_system.taxrate / 100) end end
class Window_ShopStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization # x : window X coordinate # y : window Y coordinate #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 240, 304) @item = nil refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear if @item != nil number = $game_party.item_number(@item) self.contents.font.color = system_color self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession) self.contents.font.color = normal_color self.contents.draw_text(4, 0, 200, WLH, number, 2) # Here you can customize what there will stand when there's a tax. You can also # edit the heights of the words and numbers. One warning: Don't make it to long # or it will overlap the percentages. if $game_system.taxrate > 0 # If there is tax self.contents.draw_text(4, 16, 200, WLH, "Current Tax") self.contents.font.color = normal_color self.contents.draw_text(100, 16, 104, WLH, $game_system.taxrate.to_s + "%", 2) elsif 0 > $game_system.taxrate # If there is a discount rate self.contents.draw_text(4, 16, 200, WLH, "Discount") self.contents.font.color = normal_color self.contents.draw_text(100, 16, 104, WLH, $game_system.taxrate.to_s + "%", 2) end if $game_system.taxamount > 0 # If there is tax self.contents.draw_text(4, 32, 200, WLH, "Tax (A)") self.contents.font.color = normal_color self.contents.draw_text(100, 32, 104, WLH, $game_system.taxamount.to_s , 2) elsif 0 > $game_system.taxamount # If there is a discount rate self.contents.draw_text(4, 32, 200, WLH, "Discount (A)") self.contents.font.color = normal_color self.contents.draw_text(100, 32, 104, WLH, $game_system.taxamount.to_s , 2) end for actor in $game_party.members x = 4 y = WLH * (2 + actor.index * 2) draw_actor_parameter_change(actor, x, y) end end end #-------------------------------------------------------------------------- # * Draw Actor's Current Equipment and Parameters # actor : actor # x : draw spot x-coordinate # y : draw spot y-coordinate #-------------------------------------------------------------------------- def draw_actor_parameter_change(actor, x, y) return if @item.is_a?(RPG::Item) enabled = actor.equippable?(@item) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x, y, 200, WLH, actor.name) if @item.is_a?(RPG::Weapon) item1 = weaker_weapon(actor) elsif actor.two_swords_style and @item.kind == 0 item1 = nil else item1 = actor.equips[1 + @item.kind] end if enabled if @item.is_a?(RPG::Weapon) atk1 = item1 == nil ? 0 : item1.atk atk2 = @item == nil ? 0 : @item.atk change = atk2 - atk1 else def1 = item1 == nil ? 0 : item1.def def2 = @item == nil ? 0 : @item.def change = def2 - def1 end self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change), 2) end draw_item_name(item1, x, y + WLH, enabled) end #-------------------------------------------------------------------------- # * Get Weaker Weapon Equipped by the Actor (for dual wielding) # actor : actor #-------------------------------------------------------------------------- def weaker_weapon(actor) if actor.two_swords_style weapon1 = actor.weapons[0] weapon2 = actor.weapons[1] if weapon1 == nil or weapon2 == nil return nil elsif weapon1.atk < weapon2.atk return weapon1 else return weapon2 end else return actor.weapons[0] end end #-------------------------------------------------------------------------- # * Set Item # item : new item #-------------------------------------------------------------------------- def item=(item) if @item != item @item = item refresh end end end InstructionsPaste above main, underneath ALL standard shop scripts. Depending on the version you use: (v2.0)Use the command Script in an event and enter this: (For Taxes) $game_system.taxrate = x Where x is a value above 0 (will be counted in percentages) $game_system.taxamount = y Where y is a value above 0 (this will be added to the base prices) (For Discounts) $game_system.taxrate = x Where x is a value below 0 (will be counted in percentages) $game_system.taxamount = y Where y is a value below 0 (this will be added to the base prices) (v2.5)Use the command Script in an event and enter this: (For Taxes) $game_system.tax.percent = x Where x is a value above 0 (will be counted in percentages) $game_system.tax.direct = y Where y is a value above 0 (this will be added to the base prices) (For Discounts) $game_system.tax.percent = x Where x is a value below 0 (will be counted in percentages) $game_system.tax.direct= y Where y is a value below 0 (this will be added to the base prices) ComingNothing coming yet. CreditsFalcon for the original RMXP version Sephirothspawn for giving me a small modified part of the script as start of v2.5
This post has been edited by Delyemerald2: Feb 17 2010, 11:35 PM
__________________________
~Auras, Crystal Miracles~
|
|
|
|
|
|
|
|
|
Feb 15 2010, 12:38 PM
|

Level 3

Group: Member
Posts: 30
Type: Writer
RM Skill: Advanced

|
Hey, this works great. Thanks for posting. This will definitely add a bit more realism to games, especially if tax rates fluctuate as time goes by or differ from area to area. Great job!  -Ben
__________________________
 "Ask for some palm trees, or tales from the South Seas, and I just might turn your head." - Twelve Volt Man, Jimmy Buffett
|
|
|
|
|
|
|
|
|
Feb 16 2010, 10:44 AM
|
Level 1

Group: Member
Posts: 5
Type: Event Designer
RM Skill: Skilled

|
QUOTE (Delyemerald2 @ Feb 16 2010, 10:37 AM)  My bad. I misspelled amount everytime, and thought I had fixed that. But I forgot one. Go back to the script, and at line 44, remove a M from the "@taxammount = 0" Sorry, but it is still not working.
This post has been edited by pultilian: Feb 16 2010, 10:44 AM
|
|
|
|
|
|
|
|
|
Feb 16 2010, 11:43 AM
|
Level 1

Group: Member
Posts: 5
Type: Event Designer
RM Skill: Skilled

|
QUOTE (Delyemerald2 @ Feb 16 2010, 10:56 AM)  Oke, then tell me these things:
Did it happened while starting up the game? If yes, where did you paste the script exactly and do you have any other custom shop scripts (or add-ons, it can be a compatibility issue)?
If no, please give me the event where the error occured in. (what you typed) It happened while talking (using action key) to an event with shop processing and the script command $game_system.taxamount = 10
This post has been edited by pultilian: Feb 16 2010, 12:13 PM
|
|
|
|
|
|
|
|
|
Feb 16 2010, 11:04 PM
|

Level 2

Group: Member
Posts: 18
Type: Mapper
RM Skill: Skilled

|
Weird, that shouldn't happen... I will try to make an other version of the script. Try that one. If it doesn't work, then I think it's because this script is not compatible with that menu script. And if that is the case, I'll try to make it compatible. EDIT Try this: CODE #============================================================================ # Tax Script 2.5 (BETA)(VX) #---------------------------------------------------------------------------- # Originally made by Falcon for RMXP (see further info at bottom of this part) # Edited by Delyemerald2 to fit the RMVX #---------------------------------------------------------------------------- # This system adds something to shop status, but in the same process, copies # Everything normally there. # With this script, you can add taxes or discounts. # In order to do so, use the command Script in an event and enter this: # (For Taxes) # $game_system.tax.percent = x # Where x is a value above 0 (will be counted in percentages) # $game_system.tax.direct = y # Where y is a value above 0 (this will be added to the base prices) # (For Discounts) # $game_system.tax.percent = x # Where x is a value below 0 (will be counted in percentages) # $game_system.tax.direct = y # Where y is a value below 0 (this will be added to the base prices) #---------------------------------------------------------------------------- # Credits to: # Falcon for the original script # Blizard for the idea that triggered version 2.0 (Falcon's Credits) # You, becuase you eat a cookie in your life =D #---------------------------------------------------------------------------- # ORIGINAL INFO (RMXP Version) #---------------------------------------------------------------------------- # By Falcon # Thanks to Blizzard for the idea that triggered version 2.0 #---------------------------------------------------------------------------- # This system should be compatible with all shop systems, but the # Shop Status window will only show the tax/discount rate for the default #============================================================================
# setup the variable that will hold the tax rate class Game_System::Tax Direct_First = true attr_accessor :percent attr_accessor :direct def initialize @percent = 0 @direct = 0 end end class Game_System attr_reader :tax alias_method :delyemerald2_tax_init, :initialize def initialize delyemerald2_tax_init @tax = Tax.new end end # increase the price of the following items by the tax rate class RPG::Item def price return Integer(@price + $game_system.tax.direct + @price * $game_system.tax.percent / 100) end end
class RPG::Weapon def price return Integer(@price + $game_system.tax.direct + @price * $game_system.tax.percent / 100) end end
class RPG::Armor def price return Integer(@price + $game_system.tax.direct + @price * $game_system.tax.percent / 100) end end class Window_ShopStatus < Window_Base #-------------------------------------------------------------------------- # * Object Initialization # x : window X coordinate # y : window Y coordinate #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 240, 304) @item = nil refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear if @item != nil number = $game_party.item_number(@item) self.contents.font.color = system_color self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession) self.contents.font.color = normal_color self.contents.draw_text(4, 0, 200, WLH, number, 2) # Here you can customize what there will stand when there's a tax. You can also # edit the heights of the words and numbers. One warning: Don't make it to long # or it will overlap the percentages. if $game_system.tax.percent > 0 # If there is tax self.contents.draw_text(4, 16, 200, WLH, "Current Tax") self.contents.font.color = normal_color self.contents.draw_text(100, 16, 104, WLH, $game_system.tax.percent.to_s + "%", 2) elsif 0 > $game_system.tax.percent # If there is a discount rate self.contents.draw_text(4, 16, 200, WLH, "Discount") self.contents.font.color = normal_color self.contents.draw_text(100, 16, 104, WLH, $game_system.tax.percent.to_s + "%", 2) end if $game_system.tax.direct > 0 # If there is tax self.contents.draw_text(4, 32, 200, WLH, "Tax (A)") self.contents.font.color = normal_color self.contents.draw_text(100, 32, 104, WLH, $game_system.tax.direct.to_s , 2) elsif 0 > $game_system.tax.direct # If there is a discount rate self.contents.draw_text(4, 32, 200, WLH, "Discount (A)") self.contents.font.color = normal_color self.contents.draw_text(100, 32, 104, WLH, $game_system.tax.direct.to_s , 2) end for actor in $game_party.members x = 4 y = WLH * (2 + actor.index * 2) draw_actor_parameter_change(actor, x, y) end end end #-------------------------------------------------------------------------- # * Draw Actor's Current Equipment and Parameters # actor : actor # x : draw spot x-coordinate # y : draw spot y-coordinate #-------------------------------------------------------------------------- def draw_actor_parameter_change(actor, x, y) return if @item.is_a?(RPG::Item) enabled = actor.equippable?(@item) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x, y, 200, WLH, actor.name) if @item.is_a?(RPG::Weapon) item1 = weaker_weapon(actor) elsif actor.two_swords_style and @item.kind == 0 item1 = nil else item1 = actor.equips[1 + @item.kind] end if enabled if @item.is_a?(RPG::Weapon) atk1 = item1 == nil ? 0 : item1.atk atk2 = @item == nil ? 0 : @item.atk change = atk2 - atk1 else def1 = item1 == nil ? 0 : item1.def def2 = @item == nil ? 0 : @item.def change = def2 - def1 end self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change), 2) end draw_item_name(item1, x, y + WLH, enabled) end #-------------------------------------------------------------------------- # * Get Weaker Weapon Equipped by the Actor (for dual wielding) # actor : actor #-------------------------------------------------------------------------- def weaker_weapon(actor) if actor.two_swords_style weapon1 = actor.weapons[0] weapon2 = actor.weapons[1] if weapon1 == nil or weapon2 == nil return nil elsif weapon1.atk < weapon2.atk return weapon1 else return weapon2 end else return actor.weapons[0] end end #-------------------------------------------------------------------------- # * Set Item # item : new item #-------------------------------------------------------------------------- def item=(item) if @item != item @item = item refresh end end end Follow the new instructions, new commands are used.
This post has been edited by Delyemerald2: Feb 16 2010, 11:17 PM
__________________________
~Auras, Crystal Miracles~
|
|
|
|
|
|
|
|
|
Aug 29 2011, 04:51 AM
|

Level 1

Group: Member
Posts: 12
Type: Developer
RM Skill: Intermediate

|
QUOTE (Mitsarugi @ Aug 22 2011, 02:24 AM)  why the hell when i click on the "With Taxes" spoiler i see a photo of you and your Girlfriend????? I was thinking that too.
__________________________
[/font][size="7"][/size] Who decied that Light i s good? And Darkness is Evil?
|
|
|
|
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
RPG RPG Revolution is an Privacy
Policy and Legal
|
|