Jump to content
Sign in to follow this  
DarknessFalls

Flare Collection Currencies

Recommended Posts

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:

 

 

 

Gl1FqjD.png

Kr0IytH.png

Kd9mtYf.png

lkmrx3a.png

npTJVbq.png

b3AcR6C.png

 

 

 

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>
  • 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 with out a percentage default to 100%. When you set the percentage you have to set 0-100 as an integer.

 

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 togetherFor 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:

 

Kr0IytH.png

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.
Example:FlareCurrencies.addAmount('Demon Teeth', 56);

// Or:

FlareCurrencies.addAmount('Demon Teeth', -56);
  • FlareCurrenies.openShop(currencyName, boolean): Lets you open a shop specific to that currency.
Example:

 

 

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.
Example:

// variable id 5 has an amount of 650
FlareCurrencies.setAmountBasedOnVariableId('Demon Teeth', 5);

// Demon Teeth currency now has a value of 650
Yanfly 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:
[
    {
        name: currency["Currency One Name"],
        description: currency["Currency One Description"],
        icon: currency["Currency One Icon Index"],
        amount: 0
    },
    {
        name: currency["Currency Two Name"], 
        description: currency["Currency Two Description"],
        icon: currency["Currency Two Icon Index"],
        amount: 0
    },
    {
        name: currency["Currency Three Name"],
        description: currency["Currency Three Description"],
        icon: currency["Currency Three Icon Index"],
        amount: 0
    },
    {
        name: currency["Currency Four Name"],
        description: currency["Currency Four Description"],
        icon: currency["Currency Four Icon Index"],
        amount: 0
    },
    {
        name: currency["Currency Five Name"],
        description: currency["Currency Five Description"],
        icon: currency["Currency Five Icon Index"],
        amount: 0
    },
];
  • 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.

Not Public.

 

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.

Edited by DarknessFalls

Share this post


Link to post
Share on other sites

Please do not meaninglessly bump threads in that area unless you have an update. (=
Imagine what would happen if everybody would start bumping their script and game threads. ( ͡° ͜ʖ ͡°)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted