Drop Item Sets

This script allows you to set up “drop item sets”. A drop item set is simply a collection of drop items: at the end of battle,
you can potentially receive drops from a chosen set.

Drop item sets are chosen depending on whether their condition is met. The drop item set condition can be anything related to the state of the game
when the enemy dies, such as the skill that was used to defeat the enemy, or certain properties of the battler that defeated the enemy, or the values of
game variables or switches.

Drop item sets allow you to further control which drops are available for the party to obtain after winning a battle.

For example, suppose an enemy drops three items: Potion, Hi-Potion, and Gold Ore. You organize the drops into two separate groups as folows:

Group 1: Potion, Hi-Potion
Group 2: Potion, Hi-Potion, Gold Ore

You then place a condition on the second group such that it will only drop if Hime is in the active battle party. This means that group 2 drop set will not be selected if Hime is not in the battle party, and therefore Gold Ore does not drop if Hime is not in the battle party.

Download

Script: download here

This tutorial might be useful.

Installation

Place this script below Materials and above Main

Usage

Start by setting the drop items for the enemy.
Then create drop item sets. By default, there are no sets, so none of the
enemies will drop anything.

dropItemSets1

To create a drop item set, use a note-tag of the format

<drop-item set>
drops: 1, 2, 3
priority: 7
condition: formula
drop: w1 0.6
drop: a4 0.23
drop: i7 1
</drop-item set>

The drops is a list of drop item ID’s, corresponding to each drop in the enemy’s list of drop items. The editor provides 3 drop items, so the first
drop is numbered 1. You can repeat the same drop multiple times in the list if you want it to be dropped multiple times.

In addition to pulling drop items from a list, you can also manually add drops to each group using the drop option. The drop option takes an object ID,
where you choose “w” for weapon, “a” for armor, and “i” for item, followed by the database ID. The second value is the droprate, as a percentage. So
0.6 means 60%, 0.23 means 23%, and 1 means 100%.

Priority determines whether the drop set should be checked before other sets.
For example, a priority 10 set is checked before a priorty 5 set.

The condition is a ruby statement that determines whether the set will be chosen or not. When the set is chosen, then those drops are the ones that you
can potentially receive at the end of battle.

The condition comes with 5 variables for you to use

a - the Game_Battler that defeated this enemy
b - this enemy
c - the Game_Action used by the battler in `a`
p - game party
t - game troop
v - game variables
s - game switches

Because drops, by default, are only rewarded when the enemy has been killed, we only need to keep track of who killed the enemy. It’s possible that an event
kills the enemy, in which case a would be nil, and your formula will not work as you expect (it will return false in these cases, so no errors).

Examples

Some conditions that you might use for drop item sets

Attacker's level.
Maybe drops are only available if your level > 5
  a.level > 5

Killing blow skill.
Maybe a drop is only available if you kill using skill 23
  c.item == $data_skills[23]

Attacker's state
Set requires attacker to have state 23 applied when enemy was killed
   a.state?(23)

Attack element
Set requires the damage to have element 5 (not including features)
   c.item.damage.element_id == 5

You may also like...

41 Responses

  1. KK says:

    I tried this one out, but my condition doesn’t work.
    I use “condition: b.state?(27)” to get special drops if the enemy got inflicted with state 27.
    I assume that, by default, when enemies die, their states are gone, maybe….
    Is there anyway to make the condition possible? Or is there a way to set if the drop set dropped if a certain skill hit the enemy even if it is not a killing blow?

  2. Doop says:

    Can you use this, for say an item, let’s say Hammer, in inventory. Like a monster could drop the hammer if it isn’t in inventory, but if it is it won’t be dropped.

    • Hime says:

      Yes. You can specify this condition
      p.hasItem?($data_items[23])
      Assuming item 23 is the hammer.
      And then create two drop sets: one that has the hammer, and the other that does not.

  3. Arkaik says:

    Hi Hime!
    I’m using Venka’s Bestiary v1.8 and i guess if there’s a way to display the drop sets at the script. I’ve already ask it at the post, but if you could help me it’ll be good, since i don’t know if Venka is really using the forum.

    Btw, thanks for this awesome script!

  4. Tesaigo says:

    ok, thats sad, it’s an extremelly beautiful script : thank’s for the support anyway…

  5. Tesaigo says:

    Before I test, can you tell me something? This Drop Sets work togheter with your Map Drops? I’m using an ABS, and I would like to know if when the monster Die it he will drop the itens defined in this notes on the map… By the way, looks a great Script, congratulations!

    • Tsukihime says:

      Map Drops is not related to enemy drops so it should.

      • Tesaigo says:

        Thanks for the Reply! One more doubt (maybe a stupid one), how do I set to an enemy on map (in that case in an ABS) drop an item into a region close of him (for example, the enemy dies on coordinates X5, Y6, then he drops itens in 1 tile of distance of where he die… Is this possible?

        • Tsukihime says:

          Drop Item Sets does not support that feature. If you have questions regarding other scripts post it in the appropriate spot. If there is no blog post then I am likely not supporting the script.

  6. Ray says:

    how do I write the condition that a particular piece of equipment is equipped by a party member?
    thanks in advance.

    • Tsukihime says:

      Assuming you want to know if actor 4 has armor 5 equipped

      $game_actors[4].equips.include?($data_armors[5])
      

      If you want to know whether the person that defeated the enemy has it equipped then you can use

      a.equips.include?($data_armors[5])
      
  7. digger says:

    Does this work with extended drop scripts?
    IE: Scripts that give enemies additional drops?
    There are several scripts that allow more items to be dropped than the standard 3. Would there be a way for this script to work with any of them?

  8. Devi Taylor says:

    I can see where this would be awesomely useful in a game. Does it only work on items/drops or can it also be used for gold?

Leave a Reply

Your email address will not be published. Required fields are marked *