Currency System

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Currency System

-Tsukihime



Overview

This script replaces the default currency system with a more sophisticated way of managing currency.

It allows you to easily create as many currencies as you want in the game, and exchange between currencies through events.

Usage

Start by setting up the currencies in the game.

In the configuration at the top, you will see a Currencies table. You can have as many currencies as you want by entering the appropriate entries.

Each currency has an ID which you will be using throughout the project.

Each currency contains a display name, a symbol, as well as an exchange value.

Some simple script calls for getting or losing money:



Code:
$game_party.gain_money(amount, currency_id)
$game_party.lose_money(amount, currency_id)
By default, the currency_id is the currency currently in use (more info below), so it can be omitted if you want it to be based on the current currency.

The exchange value determines how much the currency is worth.

For example, suppose we have the following setup



Code:
{ 1 => ["Gold", "G", 5],
  2 => ["Silver", "S", 1]
}
This means that

For each gold you exchange, you receive 5 silvers

For each silver you exchange, you receive 0.2 golds

In order to exchange currency, use the script call



Code:
$game_party.exchange_currency(src, dest, amount)

$game_party.exchange_currency(1, 2, 200)
You pass in two currency ID's, the currency you start with, and the currency you want to exchange to, as well as the amount. The script will use the exchange values defined in the Currency table to calculate the exchange rate and add/subtract the appropriate amounts from the two currencies.

Different currencies can be used throughout the game.

At this time, only one currency may be used at anytime.

You can change the global currency by calling



Code:
change_currency(currency_id)

change_currency(1) # change the gold
change_currency(2) # change to silver
This allows you to simulate different currencies in different cities or regions.

The currency that is displayed in your main menu is the currency that is currently used.

If you want to see all of your currencies, use the script call



Code:
SceneManager.call(Scene_PartyBank)
I have added it to the main menu for the default system.

Examples

You would use an event to set up currency exchange.

Suppose I start with 5000 silvers



I then ask the NPC to exchange silvers to gold



After I exchanged 100 silvers, this is what I have



With an exchange rate of 5 Silver = 1 Gold, that is expected.
Download

Script: http://db.tt/U9bBddiZ

Notes

Having a specialized "Money" scene to view your party's funds should be created. Does anyone want to write it?

Also, a "currency exchange" scene would make it much easier to exchange currencies. Someone want to do that?

Basic money window I've added for the default system. You can access it via Scene_PartyBank.

It needs improvement but I'm not a designer.

 
Last edited by a moderator:

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
I don't think 5000 - 100 is 900 :/

However the script seems pretty cool.

Not sure if i missed it but how does this interact with shops?
 

Jomarcenter

jomarcenter-MJM
Veteran
Joined
Apr 24, 2012
Messages
1,270
Reaction score
206
First Language
ENGLISH
Primarily Uses
RMMV
I don't think 5000 - 100 is 900 :/

However the script seems pretty cool.

Not sure if i missed it but how does this interact with shops?
yeah how does it interact with the shops?
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
It just takes the currency that's currently in use (specified in $game_system.currency) and all transactions will use that currency.

So for example if Silver was currently used, then everything uses Silver.

If Gold was currently used, then everything uses Gold.

Haven't found any good way to allow users to specify the prices of a particular object using multiple currencies.

I don't think 5000 - 100 is 900 :/

However the script seems pretty cool.

Not sure if i missed it but how does this interact with shops?
Lol separate screenshots.
 

Lunara

Moon Lady
Member
Joined
Mar 14, 2012
Messages
58
Reaction score
74
First Language
English
Primarily Uses
Thank you for making this script, I've been waiting for something like it for a while. I wanted to report an error that I keep getting, though:



This happens when I switch to a new currency and try to buy something with the new currency, while having enough money for the item. I also did this in a clean project, to make sure no other scripts were conflicting.

If you could take a look into the script and see what the problem is, I'd very much appreciate it.

I'd also like to ask a few questions:

- In your screenshots, you show more than one currency in the menu, but the instructions in the script say you can't. Why did you remove that feature?

- If you can put the above feature back into the script, is there a way to not make the newer currencies show up until you've turned on a switch?

(These aren't entirely necessary, as I've made a work-around, but it would still be handy.)
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Found the issue and fixed it. It was a silly issue on my part (forgot to test shops)

For the custom money window, I removed it because it is not flexible.

It is hardcoded into the menu design, which basically means if you're using a custom menu, doesn't work.

Even then, it's hardcoded to show up to 3 currencies, and automatically adjusts its size to account for additional currencies, if any.

I couldn't come up with any good way to show multiple currencies in such a small space so I just dumped it into a custom scene.

I can provide such a custom money window hooked to a variable which will decide how many currencies to show, but it would mainly require the user to customize it to suit their own menu needs.
 

Lunara

Moon Lady
Member
Joined
Mar 14, 2012
Messages
58
Reaction score
74
First Language
English
Primarily Uses
Thanks for fixing it, it works great now. ~

I actually already have it attached to a variable, because I wanted to be able to use it in a normal text window. Like I said, I don't need it to show in the gold window, it would just make things more convenient. And since you said it wouldn't work with a custom menu, I wouldn't be able to use it anyway.

Thank you again for making this script. :3
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
This would really be useful if shops can utilize all currencies at once in the way like most games that use multiple currencies do it...
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
This would really be useful if shops can utilize all currencies at once in the way like most games that use multiple currencies do it...
The issue is how you are supposed to input that.

You can't use the default shop editor to specify 5 different currencies, for example.

Someone said that I can just use notetags to specify the price of each item in the database.

But that is assume all shops sell the same stuff as the same price, which doesn't account for the fact that you can set custom prices for each item at each shop.

Because there was no solution that would make it easy to work with I decided not to implement it, because if I did I'd probably end up getting a bunch of complaints about how other games make it really easy to do this and whatnot.
 
Last edited by a moderator:

Anirban

Warper
Member
Joined
Aug 23, 2013
Messages
2
Reaction score
0
First Language
Bengali
Primarily Uses
How dt add this system in the main menu. I've applied the script, but the currency window does't appearing in the menu screen
 

David Bergström

Death Arcana follower.
Veteran
Joined
Sep 7, 2013
Messages
148
Reaction score
7
First Language
English
Primarily Uses
Silly question, but what are the Terms of Use of this Script?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Free to use in commercial/non-commercial.
 

David Bergström

Death Arcana follower.
Veteran
Joined
Sep 7, 2013
Messages
148
Reaction score
7
First Language
English
Primarily Uses
Ah thanks for that Tsukihime! This is a fantastic script!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,047
Members
137,569
Latest member
Shtelsky
Top