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

[转载发布] TAA_EnemyDrops v1.0.1

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    4 天前
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4593

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 昨天 11:11 | 显示全部楼层 |阅读模式
    TAA_EnemyDrops - v1.0.1
    Created by taaspider

    This plugin is compatible with both MV and MZ.

    Terms of Use
    Any plugins developed by taaspider are free for use for both commercial and  noncommercial RPG Maker games, unless specified otherwise. Just remember to credit "taaspider".

    Redistribution of parts or the whole of taaspider plugins is forbidden (which also includes reposting), unless it comes from the official website (linked within the post). You are allowed to edit and change the plugin code for your own use, but you're definitely not  allowed to sell or reuse any part of the code as your own. Although not required to use my plugins, a free copy of your game would be nice!

    Introduction

    This plugin aims to give the developer more control and flexibility when setting up loot drops from enemies. With it you can set advanced rules to influence drop probability, determine the number of times a specific item can be dropped and how probability increases/decreases after each drop, which means a second drop can be more or less likely to happen. You can also influence probability with a variable, so that drop rate can be affected without much work.

    As of most of my plugins until now, EnemyDrops can be configured either through an external JSON file, plugin parameters or enemy note tags. It's up to the dev to select the method he's most comfortable with! Also, for those who use an external JSON file, you have the option to use a single file for both TAA_EnemyLevels and TAA_EnemyDrops, centralizing enemy setup in a single place for both plugins (and maybe others in the future).

    There's a huge list of possible comparisons and conditionals to compose a drop rule, be sure to read the help file thoroughly to check on all possibilities!

    Features


    • Use either an external JSON file or the Plugin Manager to setup conditional drop rules for each enemy, or create a default global rule to apply to drop settings done through the engine database.
    • Share the JSON file with other plugins from the TAA liberary (typically TAA_Enemy* plugins, like TAA_EnemyLevels), so you can concentrate all enemy config data in one place.
    • Create a "stop clause", where if a specific condition is not met, the plugin interrupts rule processing and discard any following rules for that drop.
    • Select from a huge variety of conditional clauses to customize enemy drops to your liking, raging from the default random condition to checking party inventory, enemy settings, battle history, and others!

    Screenshots

    Spoiler












    How to Use

    WARNING: This plugin requires RPG Maker MV 1.5.0 or above! Please make sure your RPG Maker MV software is up to date before using this plugin. You don't need any specific version if you're using MZ.

    First of, download the plugin here. There's a lot of conditionals you can use while setting up drop probability that I won't cover in this post, so I advise a good reading on the help file before using this.

    You can also test the plugin using my sample demo project. It was built with MV, but you can open it with MZ as well (just open the game.rmmzproject file and you're good to go).

    Spoiler: JSON FILE AS A DATA SOURCE
    The JSON file can be shared with other plugins from the TAA library (typically TAA_Enemy* plugins, like TAA_EnemyLevels), so you can concentrate all enemy config data in one place. Be sure to check other plugins help sections and see which one supports this datasource sharing.

    To use a JSON file, be sure to select this option in the Datasource Type parameter.

    The File parameter inside the JSON Config parameter determines which file will be read to load drop configuration. Regardless of using a dedicated file or sharing the file with other TAA plugins, EnemyDrops data must follow this basic structure:

                    JSON:       
    1. [
    2.      {
    3.          "id": <enemy ID>,
    4.          "drops": [
    5.              {
    6.                  "item": <item id / name (without blank spaces)>,
    7.                  "armor": <armor id / name (without blank spaces)>,
    8.                  "weapon": <weapon id / name (without blank spaces)>,
    9.                  "type": <drop type>,
    10.                  "base": <base drop chance>,
    11.                  "amount": <drop amount>
    12.                  "iterationEffect": {
    13.                      "type": <type code>,
    14.                      "attenuation": <attenuation value>
    15.                  },
    16.                  "conditions": [
    17.                      <conditional clause 1>,
    18.                      <conditional clause 2>,
    19.                      ...
    20.                  ]
    21.              },
    22.              {
    23.                  ...
    24.              },
    25.              ...
    26.          ]
    27.      }
    28. ]
    复制代码


    You can customize the object's tags as you wish using the next parameters.

    IMPORTANT:

    • <enemy ID> must be a valid enemy ID in the database, and must be unique in your JSON file. More than one entry for the same id can (and will) generate errors.
    • <item id> should be replaced either by the item id from the database, or its name. If you choose to use an item name, be sure to surround it with quotes and remove any blank spaces. For example: an item named Big Potion can be referenced here as "BigPotion". You need at least one object from item, armor or weapon for each rule, but it is not necessary to have all three present.
    • <armor id> should be replaced either by the armor id from the database, or its name. The same instructions given above for item names are applied. You need at least one object from item, armor or weapon for each rule, but it is not necessary to have all three present.
    • <weapon id> should be replace either by the weapon id from the database, or its name. The same instructions given above for item names are applied. You need at least one object from item, armor or weapon for each rule, but it is not necessary to have all three present.
    • <drop type> defines what the drop rules refer to. It has four possible values:

      • "item": only the item object is effectively dropped (if conditions are met). If this type is set, the "item" object must be present.
      • "armor": only the armor object is effectively dropped (if conditions are met). If this type is set, the "armor" object must be present.
      • "weapon": only the weapon object is effectively dropped (if conditions are met). If this type is set, the "weapon" object must be present.
      • "all": any item, armor or weapon object present is effectively dropped (if conditions are met). At least one of the drop objects must be present ("item", "armor", "weapon")

    • <base drop chance> is a value between 0 and 100 and represents how likely the drop is to happen. It is a percentage value, and the higher it is, the more likely it succeeds.
    • <drop amount> is the number of times the item / armor / weapon should be dropped when conditions are met. You can define how drop chance applies for multiple item / armor / weapons instances with the iterationEffect object.
    • <type code> is a numeric value representing one of three possible behaviors:

      • 0: Shared probability. That means that the drop chance is tested a single time for all items. If it pass, all items are dropped. If it fails, none are.
      • 1: Repeat probability. That means that each item has its own chance of being dropped, but the same probability is applied to each one of them.
      • 2: Attenuate probability. That means that for each item instance evaluated, drop probability for the next one is reduced/increased by the <attenuation value>. This applies individually to items, armors and weapons. So if           a drop rule is set to drop 2 of each, the conditional rules calculate the initial probability for the first item, armor and weapon, but the second of each one of them is attenuated.

    • <attenuation value> is a number between -100 and 100 and represents how much to attenuate (or increase the chance) of a second drop when the drop amount is greater than 1 and <type code> is set to 2.
    • <conditional clause> are evaluation clauses, as described in the section "Conditional Clauses".
    Spoiler: PLUGIN MANAGER DATA
    Setting up enemy level data through Plugin Parameters is pretty straightforward, just make sure there is only one entry for each enemy ID.

    Also keep in mind that if the plugin TAA_EnemyLevels is present and enabled, TAA_EnemyDrops is forced to use the same datasource type. If EnemyLevels is set to use an external JSON file, EnemyDrops will need to use the same file with all settings bundled together. If it is set to use the Plugin Manager, EnemyDrops will need to be set through the Plugin Manager as well.

    Enemy note tags can be used regardless of both plugin configs!
    Spoiler: CONDITIONAL CLAUSES
    This section covers all possible conditional clauses that can increase or decrease drop probability for each drop rule. All drop rules follows the same structure:
    <condition>:<result>:<stop clause>​
    <result> represents how the drop probability is affected if the conditional clause is met, and it can assume one of two formats:
    <op><value>%​
    <op> is either + (to increase the probability), - (to decrease it),(to multiply it) or = to set it to a specific value.​
    <value> is a percentage, and must be a value between 0 and 100 (decimals can be used for higher precision after the dot. Example: 0.5%)​
    <op><value>​
    Here <op> has the same possible values, but <value> is treated as a floating representation of a percentage value. It must be a value between 0 and 1, where 0 represents 0%, and 1 represents 100%. To represent a 50% value, for example, you would write 0.5 without the '%' character. Be careful, as writing 0.5% is way different than typing 0.5.​
    <stop clause> is an optional clause which can determine if the conditional evaluation should stop depending on the conditional clause result. It must be wither one of two options:
    'stop if false': If the condition is not met, do not evaluate remaining clauses​
    'stop if true': If the condition is met, do not evaluate remaining clauses​
    This option can be useful if you require one condition to be met to evaluate other conditions. For example, if the actor's level is less than 10, don't bother testing other conditions.​
    <condition> is the conditional clause itself. Consult the help file for a detailed description on all possible conditionals.
    Spoiler: ENEMY NOTE TAGS
    Conditional drop rules can also be configured using enemy note tags. If you do use note tags though, be aware that including at least one item rule via note tag will cause the plugin to discard any clauses configured through the Plugin Manager or JSON file, regardless of which item it affects.

    To start a conditional drop note block, add the following pattern to your enemy note box:
    <TAA_ED: <item type>=<item reference>, amount=<value>, attenuation=<type code>;<value>>​

    • <item type> is either 'item', 'armor' or 'weapon', and determine which type of item may be dropped after evaluating drop probabilities.
    • <item reference> is an item, armor or weapon ID (depending on what <item type> is set to), a variable referencing an ID (using the v[n] format) or the dropped object name without blank spaces.
    • <value> is an integer. When used with the 'amount' property it must be positive and higher than zero. For the attenuation settings it can assume a negative value.
    • <type code> must be one of three values:

      • 0: Shared probability. That means that the drop chance is tested a single time for all items. If it pass, all items are dropped. If it fails, none are.
      • 1: Repeat probability. That means that each item has its own chance of being dropped, but the same probability is applied to each one of them.
      • 2: Attenuate probability. That means that for each item instance evaluated, drop probability for the next one is reduced/increased by the <attenuation value>. This applies individually to items, armors and weapons. So if a drop rule is set to drop 2 of each, the conditional rules calculate the initial probability for the first item, armor and weapon, but the second of each one of them is attenuated.
      • If the 'amount' property is not present, the plugin will assume the drop rules apply to a single object unit.
      • Both 'amount' and 'attenuation' are optional parameters and can be omitted.

    After entering the opening tag, insert your conditional clauses (one per line) and close your conditional block with the tag </TAA_ED>

    Here's a few examples:
    <TAA_ED: item=Potion>​
    PARTY GOLD > 1000:+5%​
    BATTLE TURN < v[1]: +10%​
    RANDOM 15%: +20%​
    </TAA_ED>​

    <TAA_ED: armor=4, amount=2, attenuation=2;-50>​
    PARTY NOT ARMOR 4: +10%​
    v[5] >= 15: + 5%​
    ENEMY DEATH DAMAGE > 500: +20%​
    </TAA_ED>​

    <TAA_ED: item=v[5], amount=1>​
    s[1] is true: +10%​
    v[6] < 100: +5%​
    ENEMY STRUCK LAST BY SKILL 5: + 10%​
    </TAA_ED>​

    Spoiler: DEFAULT PARAMETERS
    Default Drop Rules
    Use this structure to setup default conditional drop rules when none are present in drop configs. This will be applied to loot configured through the engine, so 'Engine Settings' needs to be set to 'Keep'.​

    Engine Settings
    This parameter is used to determine how the plugin will handle default engine drop configurations. You can choose to either keep or discard. If set to 'Keep', the plugin will run the engine default drop settings and then add conditional drops to the resulting set. If set to 'Discard', engine drop settings are skipped, and only conditional drop rules are run.​

    Chance Processing
    Use this to determine when the conditional drop rules will be processed. It can happen either immediately after enemy death, or if it should wait the end of the battle.​

    Drop Rate Variable
    Select a variable which can be used to affect drop rate. If the variable value is 0, drop rate is not affected and the chance calculated based on conditional rules is used. If less than 0, the value is transformed into percentage and reduces the drop rate. If greater than 0, the value is turned into percentage and increases drop rate.​

    Spoiler: SCRIPT CALLS
    $gameSystem.edChanceProcessing()
    Returns 0 if chance processing is set to run at enemy death, or 1 if set to run at battle end.

    $gameSystem.edUpdateChanceProcessing(option)
    Chance chance processing settings. option can be either 0 to run at enemy death, or 1 to run at battle end.

    $gameSystem.edUseEngineSettings()
    Returns true if engine drops are kept, or false if they are set to be discarded.

    $gameSystem.edEnableEngineSettings()
    Enables the Engine Settings parameter, so that engine drops are kept with  conditional drops.

    $gameSystem.edDisableEngineSettings()
    Disables the Engine Settings parameter, so that engine drops are discarded and only conditional drops are considered.
    Spoiler: PLUGIN COMMANDS
    Chance Processing Settings
    Manage when drop processing takes place. If can be set to run either at each individual enemy death, or all enemies together at battle end.

    Engine Settings
    Manage how the plugin handles drops configured through the default engine configs. If enabled, any enemy drops configured through the engine will run as set, and conditional drops are added to this result. If disabled, only conditional drops are considered.
    Spoiler: CHANGELOG

    • Version 1.0.1:

      • Fixed a bug that could cause game crash while preparing plugin indexes on game boot;
      • Fixed a bug that would cause the max amount of drops of an item to always be applied, ignoring the chance calculations;
      • Fixed a bug that would cause the amount of drops to be ignored, and never drop more than one item. This scenario would happen only when using the Plugin Manager as datasource;

    • Version 1.0.0:

      • Fixed a bug on default drop rules;
      • Refactored a bit of code to allow easier future plugins compatibility;

    • Version 0.9.0:

      • Beta release;



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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-16 14:17 , Processed in 0.071522 second(s), 56 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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