设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 70|回复: 0

[转载发布] Flare Collection - Currencies

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    8308

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    30623
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    39825

    灌水之王

    发表于 6 天前 | 显示全部楼层 |阅读模式
    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:

    Spoiler









    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:



    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 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:
    [    {        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.

    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


    本贴来自国际rpgmaker官方论坛作者:DarknessFalls处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/flare-collection-currencies.49744/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-1 20:50 , Processed in 0.112433 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表