RPG Maker Forums

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.

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,017
Messages
1,018,354
Members
137,801
Latest member
topsan
Top