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:
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
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
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
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
I have added it to the main menu for the default system.
Examples
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.
-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)
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]
}
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)
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
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)
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.
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.
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:

