RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

[RESOLVED] More then one item drop

Started by wasup274, November 28, 2007, 09:03:07 PM

0 Members and 1 Guest are viewing this topic.

wasup274

^^^ basicly title. is there any scripts that make a monster drop more then 1 item.

Shinami

Credit goes to SephirothSpawn. Read the notes in the script or I will mimick Falcon. SDK dependancy was removed.



#==============================================================================
# ** Additional Enemy Drops
#------------------------------------------------------------------------------
# SephirothSpawn
# 2006-07-09
# Version 1
#------------------------------------------------------------------------------
# * Customization
#
#   ~ Enemy Item Drops
#     Enemy_Item_Drops = { enemy_id => { item_id => drop_percent, ... }, ... }
#
#   ~ Enemy Weapon Drops
#     Enemy_Weapon_Drops = { enemy_id => { item_id => drop_percent, ... }, ... }
#
#   ~ Enemy Armor Drops
#     Enemy_Armor_Drops = { enemy_id => { item_id => drop_percent, ... }, ... }
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
#SDK.log('Additional Enemy Drops', 'SephirothSpawn', 1, '2006-07-09')

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
#if SDK.state('Additional Enemy Drops')
 
#==============================================================================
# ** Game_Enemy
#==============================================================================

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # * Enemy Item Drops
  #  ~ enemy_id => { item_id => drop_percent, ... }
  #--------------------------------------------------------------------------
  Enemy_Item_Drops = { 1 => {1 => 50, 2 => 30, 3 => 10}, 2 => {3 => 100, 4 => 70, 7 => 100} }
  #--------------------------------------------------------------------------
  # * Enemy Weapon Drops
  #  ~ enemy_id => { weapon_id => drop_percent, ... }
  #--------------------------------------------------------------------------
  Enemy_Weapon_Drops = { 1 => {1 => 25}, 2 => {2 => 25} }
  #--------------------------------------------------------------------------
  # * Enemy Item Drops
  #  ~ enemy_id => { item_id => drop_percent, ... }
  #--------------------------------------------------------------------------
  Enemy_Armor_Drops = { 1 => {1 => 100} }
  #--------------------------------------------------------------------------
  # * Get Drop Items
  #--------------------------------------------------------------------------
  def get_drop_items
    # Item, Weapon & Armor Collection List
    items = []
    # Item Lists
    if Enemy_Item_Drops.has_key?(@enemy_id)
      # Passes Each Item
      Enemy_Item_Drops[@enemy_id].each do |item_id, drop_percent|
        # Adds items If Randomly Dropped
        if rand(100) < drop_percent
          items << $data_items[item_id]
          $game_party.gain_item(item_id, 1)
        end
      end
    end
    if Enemy_Weapon_Drops.has_key?(@enemy_id)
      # Passes Each Weapon
      Enemy_Weapon_Drops[@enemy_id].each do |weapon_id, drop_percent|
        # Adds items If Randomly Dropped
        if rand(100) < drop_percent
          items << $data_weapons[weapon_id]
          $game_party.gain_weapon(weapon_id, 1)
        end
      end
    end
    if Enemy_Armor_Drops.has_key?(@enemy_id)
      # Passes Each Armor
      Enemy_Armor_Drops[@enemy_id].each do |armor_id, drop_percent|
        # Adds items If Randomly Dropped
        if rand(100) < drop_percent
          items << $data_armors[armor_id]
          $game_party.gain_armor(armor_id, 1)
        end
      end
    end
    # Return List
    return items
  end
end

#==============================================================================
# ** Window_BattleResult
#==============================================================================

class Window_BattleResult < Window_Base
  #--------------------------------------------------------------------------
  # * Add Multiple Drops
  #--------------------------------------------------------------------------
  def add_multi_drops
    # Collects Extra Droppings
    for enemy in $game_troop.enemies
      # Adds Extra Treasures
      @treasures << enemy.get_drop_items
    end
    # Flatten Array
    @treasures.flatten!
    # Sort Treasures By ID
    @treasures.sort! {|a, b| a.id <=> b.id}
    # Sort Treasures By Type
    @treasures.sort! do |a, b|
      a_class = a.is_a?(RPG::Item) ? 0 : a.is_a?(RPG::Weapon) ? 1 : 2
      b_class = b.is_a?(RPG::Item) ? 0 : b.is_a?(RPG::Weapon) ? 1 : 2
      a_class<=>b_class
    end
    # Adjust Height & Window Contents
    self.height = [@treasures.size * 32 + 64, 256].min
    self.contents = Bitmap.new(width - 32, @treasures.size * 32 + 32)
    # Adjust Y
    self.y = 160 - height / 2
    # Refresh Window
    refresh
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    if Input.press?(Input::UP)
      self.oy -= 4 if self.oy > 0
    elsif Input.press?(Input::DOWN)
      self.oy += 4 if self.oy < self.contents.height - 64
    end
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_enemydrops_scnbtl_sp5 start_phase5
  #--------------------------------------------------------------------------
  # * Start After Battle Phase
  #--------------------------------------------------------------------------
  def start_phase5
    # Original Start Phase 5
    seph_enemydrops_scnbtl_sp5
    # Add Extra Item Drops
    @result_window.add_multi_drops
  end
end

#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------




Demonic Blade

Does anything have to be edited in the script? Oh, heck I'll try it out! :) Good idea too Wasup274! Though you could always just make more monsters, it's a good idea.:) And nice for coming with such a quick reply Shinami.
I wonder how many of my-reps are there for a reason, and not just because some jackass wanted to show off in front of some other jackasses...?
Probably a lot of them - and those people sure as hell don't deserve my pity, let alone my disgust.
That's right, let's see some more -Rep'ing! BOOYEAH!!

Zeriab

The user requesting this has not been online for a long time.
I have tagged topic as [RESOLVED] due to the script being posted. Please make a post if this is not the case.

@DB: Yes, you have to edit the Enemy_Item_Drops, Enemy_Weapon_Drops and Enemy_Armor_Drops unless you want the example drops given in the script.

Demonic Blade

Quote from: Zeriab on December 22, 2007, 02:00:50 PM
The user requesting this has not been online for a long time.
I have tagged topic as [RESOLVED] due to the script being posted. Please make a post if this is not the case.

@DB: Yes, you have to edit the Enemy_Item_Drops, Enemy_Weapon_Drops and Enemy_Armor_Drops unless you want the example drops given in the script.

*Gulp* Alright then... :(
I wonder how many of my-reps are there for a reason, and not just because some jackass wanted to show off in front of some other jackasses...?
Probably a lot of them - and those people sure as hell don't deserve my pity, let alone my disgust.
That's right, let's see some more -Rep'ing! BOOYEAH!!