VX 스크립트

Source Thread: http://rmrk.net/index.php/topic,40114.0.html

  전투후 몬스터가 드롭하는 아이템의 가짓수를 확장하는 스크립트입니다.  추가 드롭아이템이 나올 확률, 입수하는 돈의 액수 범위등을 조정할 수 있습니다.

 

**이 스크립트는 사용하는 전투 시스템과 호환성이 없을 수도 있습니다.  또한 스크립트로 추가된 루트 아이템은 몬스터 정보 스크립트(도감류)에 표시되지 않을 수 있습니다.

 

#==============================================================================
#    Drop Options
#    Version: 1.1
#    Author: modern algebra (rmrk.net)
#    Date: September 11, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script is very simple. All it does is allow you to make item drops a
#   little less static in some very simple ways: 
#   (a) you can make more than two drops for each enemy, so enemies can drop a 
#      greater variety of loot; 
#   (b) you can place a cap on the amount of these extra drops, so if you want 
#      a boss to have a 100% chance of dropping one of three items, but only 
#      one,then you can do that; and
#   (c) you can randomize the amount of gold dropped by setting a range within
#      which it can fall.
#
#    If you are using any scripts that show loot drops of enemies (such as a 
#   bestiary), the effects of this script will not be reflected in that without
#   direct modifications. If you are using such a script, please feel free to 
#   post a link to it in this script's thread in RMRK and I will write a patch
#   for it.
#
#    This script may not work with some custom battle systems, particularly 
#   ones that do not use troops.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script above Main and below any other scripts in the Script 
#   Editor (F11).
#
#    All configuration happens in the note boxes of enemies. If you wish to add
#   a new drop, place this code in a note box for the enemy:
#      drop[type id, probability]
#        type        : the type, either Item, Weapon, or Armor. Armour is also
#                     accepted.
#        id          : This is the ID of the item, weapon, or armor.
#        probability : This is the probability the item, weapon, or armor will
#                     drop. If you put a % sign after the number, then it will
#                     drop that percentage of the time. If not, then the number
#                     you put here will be the denominator, same as with 
#                     regular drops. The number has to be an integer.
#    EXAMPLES:
#      drop[Item 1, 65%]
#          This will mean that the item with ID 1 (Potion by default) will drop
#         65% of the time when you kill this enemy.
#      drop[armor 5, 8]
#          This will mean that the armor with ID 5 (Mithril Shield by default)
#         will drop 1/8 times you kill this enemy.
#
#    To set a maximum on the number of extra drops (note that this only applies
#   to extra drops set up in the note field - the two default drops are exempt 
#   from this cap), you can use the code:
#      max_drop[x]
#         x : the maximum amount of extra drops that you want.
#   EXAMPLE:
#    If an enemy is set up like this:
#      drop[weapon 20, 100%]
#      drop[weapon 21, 100%]
#      max_drop[1]
#    Then that means that the enemy will definitely drop either Weapon 20 
#   (Mythril Spear) or Weapon 21 (Mythril Blade), but will not drop both since 
#   the max_drop code prevents it from dropping more than one of the notebox
#   drops.
#
#    To randomize the amount of gold an enemy drops, place the following code 
#   in its note box:
#      gold[variance]
#        variance : this is an integer, and the amount of gold dropped is 
#          calculated by randomly selecting a number between 0 and this value,
#          and then adding it to the regular gold drop you set in the database.
#    EXAMPLE:
#      If an enemy has 5 gold set as its drop in the database, then the 
#     following note:
#        gold[12]
#      will mean that the enemy will drop anywhere between 5 and 17 gold upon
#     its death.
#==============================================================================

#==============================================================================
# ** RPG::Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - gold
#    new method - random_gold, extra_drops
#==============================================================================

class RPG::Enemy
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Gold
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_drpopt_gold_2go9 gold unless self.method_defined? (:ma_drpopt_gold_2go9)
  def gold (*args)
    return (rand (random_gold + 1)) + ma_drpopt_gold_2go9 (*args)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Random Gold
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def random_gold
    (@rand_gold = self.note[/GOLD[(d+)]/i] != nil ? $1.to_i : 0) if !@rand_gold
    return @rand_gold
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Extra Drops
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def extra_drops
    if @extra_drops.nil?
      @extra_drops = []
      self.note.gsub (/DROP[(item|weapon|armou?r)s*(d+),?s*(d+)(%?)]/i) {
        drop = RPG::Enemy::DropItem.new
        case $1.downcase
        when "item"
          drop.kind = 1
          drop.item_id = $2.to_i
        when "weapon"
          drop.kind = 2
          drop.weapon_id = $2.to_i
        else
          drop.kind = 3
          drop.armor_id = $2.to_i
        end
        drop.denominator = $4.empty? ? $3.to_i : $3.to_f
        @extra_drops.push (drop)
      }
    end
    return @extra_drops
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Max Drops
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def max_drops
    if !@max_drops
      @max_drops = self.note[/MAX[ _]DROPS?[(d+)]/i].nil? ? 999 : $1.to_i
    end
    return @max_drops
  end
  # If using Note Editor
  if self.method_defined? (:ma_reset_note_values)
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Reset Note Values
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    alias mala_nedo_restnte_9yn2 ma_reset_note_values
    def ma_reset_note_values (*args)
      mala_nedo_restnte_9yn2 (*args) # Run Original Method
      @rand_gold, @extra_drops, @max_drops = nil, nil, nil
    end
  end
end

#==============================================================================
# ** Game_Troop
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - make_drop_items
#==============================================================================

class Game_Troop
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Array of Dropped Items
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mlgb_drpop_mkeitm_4rx1 make_drop_items
  def make_drop_items (*args)
    drop_items = mlgb_drpop_mkeitm_4rx1 (*args)
    for enemy in dead_members
      ie_drops = []
      for di in enemy.enemy.extra_drops
        next if di.kind == 0
        if di.denominator.is_a? (Float)
          next if rand (100) > di.denominator
        else
          next if rand(di.denominator) != 0
        end
        case di.kind
        when 1 then ie_drops.push($data_items[di.item_id])
        when 2 then ie_drops.push($data_weapons[di.weapon_id])
        when 3 then ie_drops.push($data_armors[di.armor_id])
        end
      end
      while ie_drops.size > enemy.enemy.max_drops
        ie_drops.delete_at (rand (ie_drops.size))
      end
      drop_items += ie_drops
    end
    return drop_items
  end
end

 

Comment '4'
  • ?
    크런키맛아듀크림 2010.09.16 22:40

    사용법이..

  • ?
    Alkaid 2010.09.16 22:58

    스크립트 헤더에 있습니다.  몬스터 데이터베이스 편집할 때 오른쪽 아래에 있는 노트창에다가 추가로 드롭할 아이템과 한번에 드롭할 갯수를 다음처럼 쓰면 됩니다:

     

    drop[아이템 유형 아이템 ID, 확률] <- 아이템 유형과 ID사이에 쉼표 없음에 주의

    max_drop[갯수]

  • ?
    시트르산 2010.09.17 00:47

    아항. 몹이 떨어뜨리는 아이템의 제한을 없애는게 가능한 스크립트였군요.

    유용할듯

  • ?
    잉여잉어빵 2010.09.18 16:37

    전 안되는데..


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
130 기타 게임시간&밤낮 54 file 허걱 2009.02.14 6111
129 기타 캐릭터 소개화면 16 file 좀비사냥꾼 2009.03.29 6044
128 기타 작은 게이지바 표시 스크립트 44 file 허걱 2009.02.05 5979
127 기타 빛 이펙트 71 file DEVIL<Li Patanis Roni Kraudus> 2008.06.06 5861
126 기타 몬스터 리얼한 효과 27 file 사람이라면? 2010.08.16 5074
125 기타 RPG 2000이나 RPG 2003처럼 전체화면으로 나오게 하는 스크립트(대박) 21 Man... 2008.10.28 4821
124 기타 rpg vx 렉 줄이는 스크립트 34 아방스 2008.03.09 4815
123 기타 게임 해상도를 조절 하는 스크립트 19 아방스 2008.01.21 4780
122 기타 아이디를 띄우기 20 12345678 2011.11.07 4627
121 기타 간단한 스크립트의 사용법 6 아방스 2008.03.09 4552
120 기타 책 읽기 스크립트 44 file 히류 2010.10.05 4506
119 기타 책 읽기 스크립트. 19 허걱 2009.01.31 4490
118 기타 태양 스크립트. 15 file 할렘 2009.02.20 4463
117 기타 로딩중 스크립트 24 file NO.0 2009.07.11 4462
116 기타 글씨표시 스크립트 32 file 허걱 2009.08.10 4421
115 기타 심플 마우스 시스템 1.5 애드온 11 file RMdude 2009.02.11 4325
114 기타 집안의 가구를 내마음대로 데코레이션하기 15 file EuclidE 2010.09.18 4303
113 기타 [자작] 횡스크롤 점프스크립트 18 file 좀비사냥꾼 2009.04.03 4276
112 기타 (이거 정말 좋군요) 말이나 용을 탈수있게 하는 스크립트. 31 file 아방스가 짱 2010.02.28 4261
111 기타 아이콘 캐릭터 17 file 허걱 2010.02.28 4225
Board Pagination Prev 1 2 3 4 5 6 7 Next
/ 7