Loot Table Addon/Patch for Yanfly Extra Drops

CursedEmbrace

Veteran
Veteran
Joined
Dec 19, 2013
Messages
22
Reaction score
3
First Language
English
Primarily Uses
Hello everyone, today I have a script request I'm hoping someone or several some ones can help with.

I use the Yanfly extra drops script which is great for all those random little incidental items I'd like enemies to drop but it doesn't quite do all I'd like when it comes to bosses.

What I'd like is to be able to create a new kind of note that creates a "table" of items with its own drop rate. Lets say, for the sake of example I have a "table" that has a 50% chance of dropping from a boss and in that table I have three items, each one has a 33.333 ect% chance (or whatever values I input into the notes) of being selected as the single drop from the "loot table".

I hope that makes sense.

Anyway, what I hope to achieve from this is a situation similar to games such as World of Warcraft where bosses can have randomly assigned loot but still guarantee a certain number of dropped items.

I envision a bosses notes perhaps looking something like:

<drop I12: 20%>
<drop I13: 5%>
<drop I14: 2%>
<droptable: 100%: I44:25%, W12:25%, A7:25%, A13:25%>

Or something like that, which allows for both random little items (potions and the like perhaps? Maybe crafting materials?) while the table, of which there can be multiples of even the same table to assure that some of the better loot is gotten by the party while keeping the random nature of rpg loot.

I'll provide the copy of the Yanfly extra loot script that I'm using, as that will no doubt be helpful.

#==============================================================================# # ▼ Yanfly Engine Ace - Extra Drops v1.01# -- Last Updated: 2011.12.31# -- Level: Normal# -- Requires: n/a# #==============================================================================$imported = {} if $imported.nil?$imported["YEA-ExtraDrops"] = true#==============================================================================# ▼ Updates# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# 2011.12.31 - Bug Fixed: Drop ratios now work properly.# 2011.12.17 - Started Script and Finished.# #==============================================================================# ▼ Introduction# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# Enemies by default only drop three items maximum in RPG Maker VX Ace. The# drop rates are also limited to rates that can only be achieved through# denominator values. A drop rate of say, 75% cannot be achieved. This script# provides the ability to add more than just three drops and more control over# the drop rates, too.# #==============================================================================# ▼ Instructions# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# To install this script, open up your script editor and copy/paste this script# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.# # -----------------------------------------------------------------------------# Enemy Notetags - These notetags go in the enemies notebox in the database.# -----------------------------------------------------------------------------# <drop Ix: y%># <drop Wx: y%># <drop Ax: y%># Causes enemy to drop item, weapon, or armour (marked by I, W, or A) x at a# rate of y percent. Insert multiples of this tag to increase the number of# drops an enemy can possibly have.# #==============================================================================# ▼ Compatibility# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that# it will run with RPG Maker VX without adjusting.# #==============================================================================# ▼ Editting anything past this point may potentially result in causing# computer damage, incontinence, explosion of user's head, coma, death, and/or# halitosis so edit at your own risk.#==============================================================================module YEA module REGEXP module ENEMY DROP_PLUS = /<(?:DROP|drop)[ ]([IWA])(\d+):[ ](\d+)([%%])>/i end # ENEMY end # REGEXPend # YEA#==============================================================================# ■ DataManager#==============================================================================module DataManager #-------------------------------------------------------------------------- # alias method: load_database #-------------------------------------------------------------------------- class <<self; alias load_database_edr load_database; end def self.load_database load_database_edr load_notetags_edr end #-------------------------------------------------------------------------- # new method: load_notetags_al #-------------------------------------------------------------------------- def self.load_notetags_edr for enemy in $data_enemies next if enemy.nil? enemy.load_notetags_edr end end end # DataManager#==============================================================================# ■ RPG::Enemy#==============================================================================class RPG::Enemy < RPG::BaseItem #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :extra_drops #-------------------------------------------------------------------------- # common cache: load_notetags_edr #-------------------------------------------------------------------------- def load_notetags_edr @extra_drops = [] #--- self.note.split(/[\r\n]+/).each { |line| case line #--- when YEA::REGEXP::ENEMY::DROP_PLUS case $1.upcase when "I"; kind = 1 when "W"; kind = 2 when "A"; kind = 3 else; next end item = RPG::Enemy::DropItem.new item.kind = kind item.data_id = $2.to_i item.drop_rate = $3.to_i * 0.01 @extra_drops.push(item) end } # self.note.split #--- end end # RPG::Enemy#==============================================================================# ■ RPG::Enemy::DropItem#==============================================================================class RPG::Enemy::DropItem #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :drop_rate #-------------------------------------------------------------------------- # new method: drop_rate #-------------------------------------------------------------------------- def drop_rate return 0 if @drop_rate.nil? return @drop_rate end end # RPG::Enemy::DropItem#==============================================================================# ■ Game_Enemy#==============================================================================class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # alias method: make_drop_items #-------------------------------------------------------------------------- alias game_enemy_make_drop_items_edr make_drop_items def make_drop_items result = game_enemy_make_drop_items_edr result += make_extra_drops return result end #-------------------------------------------------------------------------- # new method: make_extra_drops #-------------------------------------------------------------------------- def make_extra_drops result = [] for drop in enemy.extra_drops next if rand > drop.drop_rate result.push(item_object(drop.kind, drop.data_id)) end return result end end # Game_Enemy#==============================================================================# # ▼ End of File# #==============================================================================
I think that's all for now, thanks for reading and I hope you're all having a good day.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Couldn't you just use a script which makes random items pop up from items on usage?


I would certainly make it that way.


You can name it "Treasure Box" or however you want it, give it 100% drop rate from bosses, and when the player opens it, a random item will be gained.


Several scripts like this exist, I know Dekita made one, that is what I use in my project and it works perfectly!
 

CursedEmbrace

Veteran
Veteran
Joined
Dec 19, 2013
Messages
22
Reaction score
3
First Language
English
Primarily Uses
Couldn't you just use a script which makes random items pop up from items on usage?

I would certainly make it that way.

You can name it "Treasure Box" or however you want it, give it 100% drop rate from bosses, and when the player opens it, a random item will be gained.

Several scripts like this exist, I know Dekita made one, that is what I use in my project and it works perfectly!
That certainly is an option I could resort to if needed, but the loot table thing would be a bit more elegant (seeing the stuff you get directly on the victory aftermath screen and so on, saving item slots in the database ect.), although an amount of work (possibly a lot of work) for whoever makes it. Its a reasonable idea though, so thanks.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Actually, I remember seeing a script like what you described.


Ever played Dragon Nest? At the end of a dungeon, the player could choose a treasure chest from 4 chests.


The script I am talking about does the exact same thing.


It visually displays 4 (or how many you want) chests, and the player can choose one from them at the end of the battle. It is totally independent from the default drop system.


The sad part is, however, that I forgot where I saw this and have no idea about the author's name. :(


I guess it was over at rmrk.net somewhere. You could try to search for that one, maybe you will have better luck in finding it than I got. I will keep looking for it later too.


It might need a compatibility patch for Yanfly's Aftermath, but I can make that for you, if you can find the script I mentioned.
 

typhon01

Designer/Coder
Member
Joined
Nov 16, 2013
Messages
20
Reaction score
8
First Language
English
Primarily Uses
I was toying around with the idea of loot tables myself for my own projects, though I haven't found an intuitive way to implement them... Anyways, I'll spend some more time with it the next couple of days and let you know what I come up with.
 

CursedEmbrace

Veteran
Veteran
Joined
Dec 19, 2013
Messages
22
Reaction score
3
First Language
English
Primarily Uses
I was toying around with the idea of loot tables myself for my own projects, though I haven't found an intuitive way to implement them... Anyways, I'll spend some more time with it the next couple of days and let you know what I come up with.
Oh, thanks for looking into it.

--Edit

My partner (who has only recently been learning how to code for rpgmaker) took a look at the Yanfly drop script and came up with an edit that has actually more or less put together what I was looking for (as far as we know!) thought I'd post the edited version of the script to that you veterans might be able to improve on it or something, I don't know.

Code:
#==============================================================================# # ? Yanfly Engine Ace - Extra Drops v1.01 with Exona Loot Table Edit# -- Last Updated: 2011.12.31# -- Level: Normal# -- Requires: n/a# #==============================================================================$imported = {} if $imported.nil?$imported["YEA-ExtraDrops"] = true#==============================================================================# ? Updates# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# 2011.12.31 - Bug Fixed: Drop ratios now work properly.# 2011.12.17 - Started Script and Finished.# #==============================================================================# ? Introduction# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# Enemies by default only drop three items maximum in RPG Maker VX Ace. The# drop rates are also limited to rates that can only be achieved through# denominator values. A drop rate of say, 75% cannot be achieved. This script# provides the ability to add more than just three drops and more control over# the drop rates, too.# #==============================================================================# ? Instructions# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# To install this script, open up your script editor and copy/paste this script# to an open slot below ? Materials/?? but above ? Main. Remember to save.# # -----------------------------------------------------------------------------# Enemy Notetags - These notetags go in the enemies notebox in the database.# -----------------------------------------------------------------------------# <dropx Ix: y%># <dropx Wx: y%># <dropx Ax: y%># Causes enemy to drop item, weapon, or armour (marked by I, W, or A) x at a# rate of y percent. Insert multiples of this tag to increase the number of# drops an enemy can possibly have.# #==============================================================================# ? Compatibility# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that# it will run with RPG Maker VX without adjusting.#==============================================================================# Exonas edit - Loot tables# Currently set up for 4 possible loot tables (per enemy) (drop1, drop2, drop3# and drop4). Unlimited different items, armours or weapons can be put into a# single loot table (example below). Works best if all items in the loot table# are set to a low drop rate to increase randomness of drops. The script will# loop through all items, armours ect in each loot table until 1 item per table# is chosen. Works fine alongside default script functionality so far.## Examples of 2 different loot tables:# <drop1 W3: 10%># <drop1 A4: 10%># <drop2 I10: 10%># <drop2 A11: 10%># <drop2 W30: 10%># * You can have an unlimited number of items in each loot table.# * Each loot table will give only one item from their loot table.# * Use <drop A/W/IX y%> for default script functionality as stated above.#==============================================================================# ? Editting anything past this point may potentially result in causing# computer damage, incontinence, explosion of user's head, coma, death, and/or# halitosis so edit at your own risk.#==============================================================================module YEA  module REGEXP  module ENEMY        DROP_PLUS = /<(?:DROP|drop)[ ]([IWA])(\d+):[ ](\d+)([%%])>/i    DROP_PLUSONE = /<(?:DROP1|drop1)[ ]([IWA])(\d+):[ ](\d+)([%%])>/i    DROP_PLUSTWO = /<(?:DROP2|drop2)[ ]([IWA])(\d+):[ ](\d+)([%%])>/i    DROP_PLUSTHREE = /<(?:DROP3|drop3)[ ]([IWA])(\d+):[ ](\d+)([%%])>/i    DROP_PLUSFOUR = /<(?:DROP4|drop4)[ ]([IWA])(\d+):[ ](\d+)([%%])>/i      end # ENEMY  end # REGEXPend # YEA#==============================================================================# ¦ DataManager#==============================================================================module DataManager    #--------------------------------------------------------------------------  # alias method: load_database  #--------------------------------------------------------------------------  class <<self; alias load_database_edr load_database; end  def self.load_database    load_database_edr    load_notetags_edr  end    #--------------------------------------------------------------------------  # new method: load_notetags_al  #--------------------------------------------------------------------------  def self.load_notetags_edr    for enemy in $data_enemies      next if enemy.nil?      enemy.load_notetags_edr    end  end  end # DataManager#==============================================================================# ¦ RPG::Enemy#==============================================================================class RPG::Enemy < RPG::BaseItem    #--------------------------------------------------------------------------  # public instance variables  #--------------------------------------------------------------------------  attr_accessor :extra_drops  attr_accessor :extra_dropsONE  attr_accessor :extra_dropsTWO  attr_accessor :extra_dropsTHREE  attr_accessor :extra_dropsFOUR    #--------------------------------------------------------------------------  # common cache: load_notetags_edr  #--------------------------------------------------------------------------  def load_notetags_edr    @extra_drops = []    @extra_dropsONE = []    @extra_dropsTWO = []    @extra_dropsTHREE = []    @extra_dropsFOUR = []       #---    self.note.split(/[\r\n]+/).each { |line|      case line      #---      when YEA::REGEXP::ENEMY::DROP_PLUS        case $1.upcase        when "I";  kind = 1        when "W";  kind = 2        when "A";  kind = 3        else; next        end        item = RPG::Enemy::DropItem.new        item.kind = kind        item.data_id = $2.to_i        item.drop_rate = $3.to_i * 0.01        @extra_drops.push(item)              when YEA::REGEXP::ENEMY::DROP_PLUSONE        case $1.upcase        when "I";  kind = 1        when "W";  kind = 2        when "A";  kind = 3        else; next        end        item = RPG::Enemy::DropItem.new        item.kind = kind        item.data_id = $2.to_i        item.drop_rate = $3.to_i * 0.01        @extra_dropsONE.push(item)              when YEA::REGEXP::ENEMY::DROP_PLUSTWO        case $1.upcase        when "I";  kind = 1        when "W";  kind = 2        when "A";  kind = 3        else; next        end        item = RPG::Enemy::DropItem.new        item.kind = kind        item.data_id = $2.to_i        item.drop_rate = $3.to_i * 0.01        @extra_dropsTWO.push(item)              when YEA::REGEXP::ENEMY::DROP_PLUSTHREE        case $1.upcase        when "I";  kind = 1        when "W";  kind = 2        when "A";  kind = 3        else; next        end        item = RPG::Enemy::DropItem.new        item.kind = kind        item.data_id = $2.to_i        item.drop_rate = $3.to_i * 0.01        @extra_dropsTHREE.push(item)               when YEA::REGEXP::ENEMY::DROP_PLUSFOUR        case $1.upcase        when "I";  kind = 1        when "W";  kind = 2        when "A";  kind = 3        else; next        end        item = RPG::Enemy::DropItem.new        item.kind = kind        item.data_id = $2.to_i        item.drop_rate = $3.to_i * 0.01        @extra_dropsFOUR.push(item)             end          } # self.note.split    #---      end  end # RPG::Enemy#==============================================================================# ¦ RPG::Enemy::DropItem#==============================================================================class RPG::Enemy::DropItem    #--------------------------------------------------------------------------  # public instance variables  #--------------------------------------------------------------------------  attr_accessor :drop_rate    #--------------------------------------------------------------------------  # new method: drop_rate  #--------------------------------------------------------------------------  def drop_rate    return 0 if @drop_rate.nil?    return @drop_rate  end  end # RPG::Enemy::DropItem#==============================================================================# ¦ Game_Enemy#==============================================================================class Game_Enemy < Game_Battler    #--------------------------------------------------------------------------  # alias method: make_drop_items  #--------------------------------------------------------------------------  alias game_enemy_make_drop_items_edr make_drop_items  def make_drop_items    result = game_enemy_make_drop_items_edr    result += make_extra_drops    return result  end    #--------------------------------------------------------------------------  # new method: make_extra_drops  #--------------------------------------------------------------------------  def make_extra_drops    result = []        oneitem = 0        failsafe = 0        while (result == [])        if failsafe == 4000    break    end     failsafe += 1            for dropONE in enemy.extra_dropsONE        next if rand > dropONE.drop_rate        if rand < dropONE.drop_rate          result.push(item_object(dropONE.kind, dropONE.data_id))          break        end      end        end            failsafe = 0    while (oneitem == 0)           if failsafe == 4000      break      end       failsafe += 1            for dropTWO in enemy.extra_dropsTWO        next if rand > dropTWO.drop_rate        if rand < dropTWO.drop_rate          result.push(item_object(dropTWO.kind, dropTWO.data_id))          oneitem = 1          break        end      end        end        oneitem = 0    failsafe = 0    while (oneitem == 0)      if failsafe == 4000      break      end       failsafe += 1            for dropTHREE in enemy.extra_dropsTHREE        next if rand > dropTHREE.drop_rate        if rand < dropTHREE.drop_rate          result.push(item_object(dropTHREE.kind, dropTHREE.data_id))          oneitem = 1          break        end      end        end        oneitem = 0    failsafe = 0    while (oneitem == 0)      if failsafe == 4000      break      end       failsafe += 1            for dropFOUR in enemy.extra_dropsFOUR        next if rand > dropFOUR.drop_rate        if rand < dropFOUR.drop_rate          result.push(item_object(dropFOUR.kind, dropFOUR.data_id))          oneitem = 1          break        end      end       end    for drop in enemy.extra_drops      next if rand > drop.drop_rate      result.push(item_object(drop.kind, drop.data_id))  end     return result end  end # Game_Enemy#==============================================================================# # ? End of File# #==============================================================================
 
Last edited by a moderator:

Cody Rauh

Veteran 2D/3D Artist
Veteran
Joined
Dec 14, 2015
Messages
61
Reaction score
5
First Language
English
How would a person utilize this script for chests on a map,

and is it compatible with RMMV or is it strictly Ace?

Cause I would like to be able to have a chest that the character opens, and gives a random items with % to loot each item.
Difference here is not looting  monster during battle so afraid enemy.extra drops wouldn't work. Additionally I want chest to

only be opened x times per day ( day being game time. )
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,015
Members
137,563
Latest member
MinyakaAeon
Top