Tax Script

Tax Script
Version: 2.0

Introduction

This Script allows the user to add a sales tax to items that are sold in a shop.
In addition, the user may use negative taxes, for discount shops.
The user can easily change the tax rate using call script.

Screenshots

http://img163.imageshack.us/img163/7595/taxezmo2.png[/img]

Script

http://falcon.rmrk.net/tax.txt

Instructions

Place this above main, below everything else and it should work fine :)
To use the sales tax:
call script:
$game_system.tax = TAXRATE

then it should work

FAQ

N/A

Compatibility

Should work with all custom shop systems, however the window that displays the tax/discount rate will probably not appear.

Credits and Thanks

Thanks to Mega Flare for requesting this, and thanks to SephirothSpawn for helping me with an error!

Special thanks goes to Blizzard, who motivated me to write version 2.0

Author's Notes

This should be my final update.
I have to say, yet again and Awesome Script! It also works with -%.
This would work well with a popularity script or something, heh, is it just me or is RMXP on a baby boom with scripts lately
Incredible. I love the idea. If my game had higher prices, I'd definitely use this.
Like, Awesome script!

Be mean, be nice, 99% Tax ;)
you rule!
Well, since a lot of people seem to like it, I'm going to work on getting this to handle decimals :)
Nice work, The_Darklord, its always nice to see new scripts being posted :D

A few things I saw while I took a look at yuor script

1)
Quote:
Incompatible with SDK as I rewrite too many methods XD


Actually It is compatible with SDK since it doesn't split any methods in Scene_Shop, this script would be incompatible with other Shop Systems.

2)
Quote:
Set variable one to X before shop processing, then it should add X% tax.
If you want to use a different variable change:
$game_variables[1] to $game_variables[VARIABLE GO HERE!]
then it should work

Try and use as few of the in-game variables as possible, it would be easier if you added a new variable to Game_System or Game_Temp for the tax and well It would be easier to use tax as decimal numbers, and then the user can change the tax rate through a call script command

3) Many of the methods you rewrote could have been aliased for compatibility: Window_ShopBuy#draw_item Scene_Shop#update_buy and Scene_Shop#update_number to be exact.
1) I need to read more about the SDK, whenever I think it's compatible with the SDK, it turns out not to be, and when I dont think it is, it is compatible with the SDK, lol.

2) Next version will use a variable I will add to game_system.

3) I'll alias the next version.

Thanks for the comment!
in my request thats what i requested for it to be called by the call script command.
Oh, XD so that was what you meant by Script Command Thingy :P
I'll have the new version done sometime this week.
Yeah... Im not really good at explaining stuff
off topic Show
Here is the list of methods that the SDK modifies
Game_Map - setup
Game_Map - update
Game_Character - update
Game_Event - refresh
Game_Player - update
Sprite_Battler - update
Spriteset_Map - initialize
Spriteset_Map - update
Scene_Tile - main
Scene_Map - main
Scene_Map - update
Scene_Save - write_save_data
Scene_Load - read_save_data
Scene_Menu - initialize
Scene_Menu - main
Scene_Menu - update & command input
Scene_Battle - main
Scene_Battle - update
Scene_Battle - update_phase3_basic_command
Scene_Battle - make_basic_action_result


If you need any help aliasing the methods I mentioned feel free to contact me.
so if he makes its compatible with the SDK... it want work with my project since i dont use SDK:(
I may make a SDK version later.

Version 1.1 (Decimal Support) is now out.
You must now use:
$game_system.tax = X
to change tax rate.
Next version I'm going to finish aliasing all the methods.

Thanks for the offer Trickster, but I know how to alias :)
Just tested the new version and now its works even better! I mean that decimals make it more realalistic. Also I like to say in your first post you might want to change the Authors Notes
>_< Accidental Post >_<
Thanks :)
Authors note fixed :P
Good Work The_Darklord. Glad to see you fixed that error with the percents. Hope I was of some use to you.

Keep up the good work.
Thank god you helped me with the percent error, I would have had to write a huge if statement to round the value -_-

Also, thanks to whichever mod deleted my accidental post.

I'll try to finish aliasing stuff by Sunday.
It would be cooler if you could use it with attibutes instead if you put a attribute called 2 for example it adds 2 dollars tax on it. The maximumm is 7 dollars tax get it so 7 attributes numbered 1-7 and each one means different amount of tax. IT would be so much easier.
But tax is with percentage, not a pre-defined number. But, if you used attributes, you couldn't change tax in game (Could you?)


Question ~ Can you do negative percent with this? Like, if you wanted to add a discount system instead?
Attributes sound kinda stupid to me. It's not very easy to assign an attribute to EVERY item you want to tax. Having a variable which you can change with a call script command sound a lot easier to me. Besides, if you want an item to permanetly increase in price, you can change its price instead of an attribute.

If I understood Mega Flare correctly (I think he said it works with -%) then discount systems should work. I'll test it out right now and edit this post.
EDIT: Discount shops work.
Yeah it works. I tried it. Its nice thing. So if you like saved a town you can make it -7%. So that would make items in that town cheaper
Now I get it. Sorry for my dumby post at Request Script section, I just realized it now. To make a tax different for each town, I would just have to make an event which Calls Script to change tax rates whenever I want it to. Am I right?

I'm definitely using this script. Thanks!
yeah that works. You can also make it -7%, 7.5% and other crap like that
I thought of an improvement. When you set a negative tax rate, it will display it as a subsidy instead. It won't affect the way it works, but it will make it look more professional.

Replace the following (lines 207-209)
self.contents.draw_text(4, 0, 200, 86, "Current Tax Rate")
self.contents.font.color = normal_color
self.contents.draw_text(172, 0, 64, 86, $game_system.tax.to_s + "%", 2)
Expand to see the code.

with this
if $game_system.tax >= 0
  self.contents.draw_text(4, 0, 200, 86, "Current Tax Rate")
else
  self.contents.draw_text(4, 0, 200, 86, "Current Subsidy")
end
self.contents.font.color = normal_color
if $game_system.tax >= 0
  self.contents.draw_text(172, 0, 64, 86, $game_system.tax.to_s + "%", 2)
else
  self.contents.draw_text(172, 0, 64, 86, ($game_system.tax * -1).to_s + "%", 2)
end
Expand to see the code.
Very sweet. This'll make things fun. I always like to aggrivate the player.
"Oh, well you can buy it here" (sounds like a lot) "You chose not to, and now you have to buy it here for a higher price"
lol Very nice. I haven't seen any other scripts you've done, but keep up the good work!
Thanks ^_^

JesseG88, I'm going to put that feature in my next version, where I will finish aliasing the methods.
I*see*innumerable*uses*for*this.*Awesome,*man.
Version 1.2 is out, nothing has changed, except when tax is 0, the tax rate won't display :) and for discount stores, instead of tax rate, Discount rate will be displayed.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=6051