Ace 스크립트

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

  적이 드롭하는 아이템의 갯수를 확장하는 스크립트입니다.  일단 사용법은 스크립트의 헤더를 보기 바랍니다(같은 사람이 만든 VX용과 비슷함).


- 이 스크립트로 추가한 드롭 아이템은 몬스터 도감류 스크립트 사용시 도감에 등록되지 않을 수 있습니다.  또한 일부 스크립트와 호환성에 문제가 있을 수도 있습니다.

#==============================================================================
#    Drop Options [VXA]
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: December 19, 2011
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  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 three 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; 
#     (c) you can use percentile rather than denominator based drops; and
#     (d) 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 correctly 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.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  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 I (for Item), W (for Weapon), or A (for
#                     Armor).
#        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[i1, 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[a5, 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[w3, 100%]
#      \drop[w4, 100%]
#      \max_drop[1]
#    Then that means that the enemy will definitely drop either Weapon 3 
#   (Spear) or Weapon 4 (Short Sword), 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.
#==============================================================================

$imported = {} unless $imported
$imported[:MADropOptions] = true

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

class RPG::Enemy
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Gold
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias ma_drpopt_gold_2go9 gold
  def gold(*args, &block)
    (rand(ma_random_gold + 1)) + ma_drpopt_gold_2go9(*args, &block)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Random Gold
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def ma_random_gold
    (@ma_rand_gold = self.note[/\\GOLD\[(\d+)\]/i] != nil ? $1.to_i : 0) if !@ma_rand_gold
    @ma_rand_gold
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Extra Drops
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def ma_extra_drops
    if @ma_extra_drops.nil?
      @ma_extra_drops = []
      self.note.scan(/\\DROP\[\s*([IWA])\s*(\d+),?\s*(\d+)(%?)\s*\]/i).each { |match|
        drop = RPG::Enemy::DropItem.new
        i = ['I', 'W', 'A'].index(match[0].upcase)
        drop.kind = i.nil? ? 0 : i + 1
        drop.data_id = match[1].to_i
        drop.denominator = match[3].empty? ? match[2].to_i : match[2].to_f
        @ma_extra_drops.push(drop)
      }
    end
    @ma_extra_drops
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Max Drops
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def ma_max_drops
    if !@ma_max_drops
      @ma_max_drops = self.note[/\\MAX[ _]DROPS?\[(\d+)\]/i].nil? ? 999 : $1.to_i
    end
    @ma_max_drops
  end
end

#==============================================================================
# ** Game_Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - make_drop_items
#    new method - ma_make_extra_drops
#==============================================================================

class Game_Enemy
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Make Drop Items
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mlg_dropopt_makedrops_5rx9 make_drop_items
  def make_drop_items(*args, &block)
    # Run Original Method and add the new drops
    mlg_dropopt_makedrops_5rx9(*args, &block) + ma_make_extra_drops
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Make Extra Drops
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def ma_make_extra_drops
    result = []
    enemy.ma_extra_drops.each { |di|
      if di.kind > 0 
        bool = di.denominator.is_a?(Integer) ? (rand * di.denominator < drop_item_rate) : (rand(100) < (di.denominator * drop_item_rate))
        result.push(item_object(di.kind, di.data_id)) if bool
      end
    }
    while result.size > enemy.ma_max_drops
      result.delete_at(rand(result.size))
    end
    result
  end
end





  • ?
    Bluesky(新) 2012.09.17 14:39
    사용 방법이 아래와 같나요?
    /drop i1, 100% ( 아이템 1번이 100%로 드롭된다 )
    /drop w1, 100% ( 무기 1번이 100%로 드롭된다 )
    /drop a1, 100% ( 방어구 1번이 100%로 드롭된다 )
    /max_drop[1] ( 위에 있는 3가지 중 1가지만 드롭된다 )
    /gold[100] ( 금 100이 드롭된다 )

    이것은 모두 적군 캐릭터 - 메모에 적는 것. 맞나요?
  • ?
    Alkaid 2012.09.18 07:59
    /max_drop[]은 한번에 드롭할 수 있는 최대 가짓수입니다. /gold[100]이라고 쓰면 랜덤으로 0~100사이의 금액이 추가로 들어오는 것을 의미하죠.
  • ?
    Rico 2016.01.09 17:02
    아래 블루스카이님의 댓글내용 명령어를 몬스터마다의 메모란에 /drop i1, 100% 이런식으로 쓰는건가..
    예컨대 슬라임 몬스터의 메모장에 /drop i1, 21% 를 쓰면 슬라임에게서 1번 아이템이 21%로 드랍인가요?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 5111
공지 RPG VX ACE 유용한 링크 모음 16 아방스 2012.01.03 28933
217 HUD 화폐단위 표시 구분 5 file 허걱 2014.03.19 2938
216 이름입력 한글 이름입력창 23 file 에틴 2012.01.23 11681
215 메시지 한국어 조사처리 스크립트 7 Ilike게임 2012.10.09 3605
214 메시지 한국어 조사 처리 스크립트 (140130) 2 치리 2014.01.31 2649
213 메뉴 파티 개별 인벤토리 스크립트 안나카레리나 2018.06.25 743
212 메시지 텍스트 사운드 이펙트 ( Text Sound Effect ) 10 file 미루 2013.01.10 4346
211 타이틀/게임오버 타이틀 화면 없이 게임을 시작하게 만드는법. 6 마에르드 2012.02.11 4587
210 타이틀/게임오버 타이틀 스크린 커스터마이징 11 file 라실비아 2013.08.12 5155
209 키입력 키 입력 확장 - 전체키 + 마우스입력 40 file 허걱 2012.12.15 5783
208 기타 크리스탈 엔진 : 포켓몬 배틀 시스템 7 file 스리아씨 2013.09.24 3894
207 전투 콤보 카운팅 시스템 4 아르피쥐 2011.12.18 4589
206 타이틀/게임오버 코아 코스튬씨의 랜덤 타이틀 출력 스크립트를 VX Ace용으로 변환 (테스트용) 1 Alkaid 2011.12.29 3189
205 타이틀/게임오버 코아 코스튬씨의 랜덤 타이틀 스크립트를 VX Ace용으로 변환 (완성판) 2 Alkaid 2012.01.25 3981
204 그래픽 커스텀 아이콘 적용하기 2 file 간로 2015.09.28 2724
203 직업 직업 경험치+능력치 설정 확장 7 file zubako 2015.01.27 3988
202 이동 및 탈것 지상 탈것 스크립트 6 file 미루 2013.01.07 4579
201 전투 전투시 나오는 메세지 삭제 10 Nintendo 2012.03.03 4358
200 이름입력 전체키 + 조합한글 + 이름입력처리 변경 47 file 허걱 2012.07.04 8201
199 메뉴 저장금지시 메뉴에 저장 안 뜨게 하기 5 file Bunny_Boy 2013.08.24 2520
198 장비 장비 장착을 통한 스킬 습득 및 삭제 4 아이미르 2012.02.05 3597
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 Next
/ 11