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.
Script: download here
This tutorial might be useful.
Place this script below Materials and above Main
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.
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).
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 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