- Joined
- Jun 7, 2013
- Messages
- 1,393
- Reaction score
- 210
- First Language
- English
Flare Currencies - A better way to manage currencies, v3.0
Darkness Falls, MIT License, Credit must be given to me.
free for commercial usage
Download: Get The Script, Make sure to name the script: Flare-Currency.js
Screenshots:
Disclaimer
All code is written in ES6 and compiled to ES5, do not edit the distributed script file. Please see the source for making modifications and please read this section on building scripts.
This script should work with all or any other scripts that modify the shop in any way.
Flare Currency allows you to add up to 5 currencies to your game via the options menu when setting up a script.
When a currency is added you can add the following tags in enemy note tags, not troops.
<currencyToGain name: "Some Name" amount: x chance: 89>
Currencies can have a variable amount, for example:
<currencyToGain name: "Some Name" amount: "1 ~ 34" chance: 89>This means that "Some Name" has a 89% chance to drop between 1 and 34 "coins"
Shops
Shops are easy to build in Flare Currencies.
It's quite amazing too.
So how do we make a shop? The first thing to do is to set up some items with the following tag:
<currencyShop belongsTo: "Sample Name" andCosts: 76>
That should real like english. We are saying this item belongs to a currency shop and a currency of: "Sample Name."
We also state that the it costs x of that currency.
So lets read it together: For the currency shop this item belongs to sample name and costs 76 of sample name.
The next things, for the currency information section is to then do:
<currencyShopEvent belongsTo: "currency Name">
In a comment for that event. What this does is:
As you can see we have an extra line: "There is a currency shop selling this item."
This tells the player that hey, there is a currency shop on this map.
So now that you went through your weapons, armors and items and added tags to stipulate which items belong to what currencies and how much they cost, how do you open said shop?
You create an event:
FlareCurrencies.openShop("Sample Name", boolean)You have essentially opened a shop that is either purchase only (the boolean) or allows the user to sell items.
Selling items only works for items that belong to that currency shop. Items may have multiple different Currencies but currency shops only take items that belong to the specific currency you specified.
You cannot have multi currency based shops.
ATTN Developers
This shop is designed to be completely backwards compatible with your shop scripts. How ever if there is an issue Please file a bug report.
ATTN Users
This shop will be blank if the currency doesn't exist or no items have that currency.
Additional Information
You must keep the name and the description short. If you make them too long then they will go off the window and it will look broken.
Amount is not capped, you can have over 9,999 of any currency, but you cannot have any thing less then 0. any negative value that that takes the currency amount below 0 will cause your currency to default to 0.
Public API
FlareCurrencies.openShop('Demon Teeth');// Or:FlareCurrencies.openShop('Demon Teeth', true); // Purchase only
// variable id 5 has an amount of 650FlareCurrencies.setAmountBasedOnVariableId('Demon Teeth', 5);// Demon Teeth currency now has a value of 650Yanfly Victory Aftermath Script
To see currencies spit out as "battle spoils" add the following to the option, "victory order": currency.
It can come in what ever order you want, how ever it must be present. For example:
exp custom drops currency
Once added, battles will have an additional battle spoils window showing the currencies you gained.
Yanfly Menu Manager Script
You don't have to do anything. It just works.
For Developers
I have a special treat for you.
You can mess around with currencies in your own scripts via: flareCurrency which is a global object. You can do the following with it:
This class is not meant to be given to the end user as a public api. It is for developers. End users haveFlareCurrencies as a public class they can access for events.
Regarding Enemies:
Enemies have some extra keys added to them thats been around since 1.0 of the script. Lets look at them now.
- enemyCurrencyRewardData - Contains information about the various currencies this enemy can reward. This is generated on game start.
- gainCurrenciesOnBattleWin - Contains name of currency and a boolean of true or false.
Both of the above are arrays of objects.
FAQ:
Somethings broken ...
Please take a screen shot of the error. If the console is open take a screen shot of that too. What were you doing before it crashed. What scripts do you currently have active (and their order)?
Can you add ... ?
Yes I can. Please explain what you want in detail, any additional information such as screen shots, example images and so on.
I have issues with a shop script what do I do?
Regarding shop scripts
A lot of shop scripts change the core functionality of the shop its self. Mine builds on top of the shop, making sure to call the parent shop scene if no currency has been passed in. This can cause issues with other shop scripts that blow away or radically and destructively change how the shop is being created when the user speaks to an event to activate the shop.
If you have shop issues please take a screen shot of the issue and link me to the shop script that is causing issues. Also make sure that you try placing it above or below my script.
Current incompatible scripts:
- Detailed Shop Script
Darkness Falls, MIT License, Credit must be given to me.
free for commercial usage
Download: Get The Script, Make sure to name the script: Flare-Currency.js
Screenshots:
All code is written in ES6 and compiled to ES5, do not edit the distributed script file. Please see the source for making modifications and please read this section on building scripts.
This script should work with all or any other scripts that modify the shop in any way.
Flare Currency allows you to add up to 5 currencies to your game via the options menu when setting up a script.
When a currency is added you can add the following tags in enemy note tags, not troops.
<currencyToGain name: "Some Name" amount: x chance: 89>
- name: The name of the currency, must match that of the currency you set up in the script options.
- amount: The amount of the currency to reward.
- chance: Optional. The percentage of which the enemy will drop the currency and its amount.
Currencies can have a variable amount, for example:
<currencyToGain name: "Some Name" amount: "1 ~ 34" chance: 89>This means that "Some Name" has a 89% chance to drop between 1 and 34 "coins"
Shops
Shops are easy to build in Flare Currencies.
It's quite amazing too.
So how do we make a shop? The first thing to do is to set up some items with the following tag:
<currencyShop belongsTo: "Sample Name" andCosts: 76>
That should real like english. We are saying this item belongs to a currency shop and a currency of: "Sample Name."
We also state that the it costs x of that currency.
So lets read it together: For the currency shop this item belongs to sample name and costs 76 of sample name.
The next things, for the currency information section is to then do:
<currencyShopEvent belongsTo: "currency Name">
In a comment for that event. What this does is:
As you can see we have an extra line: "There is a currency shop selling this item."
This tells the player that hey, there is a currency shop on this map.
So now that you went through your weapons, armors and items and added tags to stipulate which items belong to what currencies and how much they cost, how do you open said shop?
You create an event:
FlareCurrencies.openShop("Sample Name", boolean)You have essentially opened a shop that is either purchase only (the boolean) or allows the user to sell items.
Selling items only works for items that belong to that currency shop. Items may have multiple different Currencies but currency shops only take items that belong to the specific currency you specified.
You cannot have multi currency based shops.
ATTN Developers
This shop is designed to be completely backwards compatible with your shop scripts. How ever if there is an issue Please file a bug report.
ATTN Users
This shop will be blank if the currency doesn't exist or no items have that currency.
Additional Information
You must keep the name and the description short. If you make them too long then they will go off the window and it will look broken.
Amount is not capped, you can have over 9,999 of any currency, but you cannot have any thing less then 0. any negative value that that takes the currency amount below 0 will cause your currency to default to 0.
Public API
- FlareCurrencies.addAmount(currencyName, currencyAmount): Lets you add a specific amount to a currency, either negative or positive.
- FlareCurrenies.openShop(currencyName, boolean): Lets you open a shop specific to that currency.
FlareCurrencies.openShop('Demon Teeth');// Or:FlareCurrencies.openShop('Demon Teeth', true); // Purchase only
- FlareCurrencies.setAmountBasedOnVariableId(currencyName, variableId): Lets you set an amount positive or negative based on the currency name and the variables value.
// variable id 5 has an amount of 650FlareCurrencies.setAmountBasedOnVariableId('Demon Teeth', 5);// Demon Teeth currency now has a value of 650Yanfly Victory Aftermath Script
To see currencies spit out as "battle spoils" add the following to the option, "victory order": currency.
It can come in what ever order you want, how ever it must be present. For example:
exp custom drops currency
Once added, battles will have an additional battle spoils window showing the currencies you gained.
Yanfly Menu Manager Script
You don't have to do anything. It just works.
For Developers
I have a special treat for you.
You can mess around with currencies in your own scripts via: flareCurrency which is a global object. You can do the following with it:
- flareCurrency.store(currencies) - This takes an array of objects, an example from the script:
- flareCurrency.setStoreFromLoad(store) - Takes an instance of the above example which is gathered from loading a Saved game.
- flareCurrency.getCurrencyStore() - Gets the above store at its current state.
This class is not meant to be given to the end user as a public api. It is for developers. End users haveFlareCurrencies as a public class they can access for events.
Regarding Enemies:
Enemies have some extra keys added to them thats been around since 1.0 of the script. Lets look at them now.
- enemyCurrencyRewardData - Contains information about the various currencies this enemy can reward. This is generated on game start.
- gainCurrenciesOnBattleWin - Contains name of currency and a boolean of true or false.
Both of the above are arrays of objects.
FAQ:
Somethings broken ...
Please take a screen shot of the error. If the console is open take a screen shot of that too. What were you doing before it crashed. What scripts do you currently have active (and their order)?
Can you add ... ?
Yes I can. Please explain what you want in detail, any additional information such as screen shots, example images and so on.
I have issues with a shop script what do I do?
Regarding shop scripts
A lot of shop scripts change the core functionality of the shop its self. Mine builds on top of the shop, making sure to call the parent shop scene if no currency has been passed in. This can cause issues with other shop scripts that blow away or radically and destructively change how the shop is being created when the user speaks to an event to activate the shop.
If you have shop issues please take a screen shot of the issue and link me to the shop script that is causing issues. Also make sure that you try placing it above or below my script.
Current incompatible scripts:
- Detailed Shop Script
Last edited by a moderator:


