taaspider

Veteran
Veteran
Joined
Jan 27, 2017
Messages
160
Reaction score
191
First Language
Portuguese
Primarily Uses
RMMV
TAA_EnemyDrops - v1.0.0
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

TAA_EnemyDrops_sample1.png
1627862997494.png
1627863023378.png

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).

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:
[
     {
         "id": <enemy ID>,
         "drops": [
             {
                 "item": <item id / name (without blank spaces)>,
                 "armor": <armor id / name (without blank spaces)>,
                 "weapon": <weapon id / name (without blank spaces)>,
                 "type": <drop type>,
                 "base": <base drop chance>,
                 "amount": <drop amount>
                 "iterationEffect": {
                     "type": <type code>,
                     "attenuation": <attenuation value>
                 },
                 "conditions": [
                     <conditional clause 1>,
                     <conditional clause 2>,
                     ...
                 ]
             },
             {
                 ...
             },
             ...
         ]
     }
 ]

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".

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!

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.

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>​

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.​

$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.

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.

  • 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;
 

Latest Threads

Latest Profile Posts

If you still don't subscribe our Polish channel please consider it :)
1.png
Who wants to see my review of the worst star wars movie? This movie has all the excitement of being on Jury Duty of the most boring case ever about trade negotiations.
A lot to learn to make a game. Can I handle it?
I've been working on status effects since last thursday, and today I finished the core mechanic of Zombie, Teleport, Curse and Recall. Zombie and Curse are lacking a few things to make them complete atm. Teleport though is the "HAHA" spell for some of my mobs, but can "NOPE" at them with Recall.
I'm weird as there are a few game franchises I'll watch and read about, but have no interest in playing.

Forum statistics

Threads
115,165
Messages
1,087,748
Members
149,707
Latest member
hardrockmessi12
Top