XP 스크립트

스크립트 호출로 아이템이나 돈을 얻으면서 창을 띄웁니다.
  스크립트 호출로 아이템을 얻으려면 이벤트 명령->스크립트에서:

아이템 입수:
items = { item_id => n, ... }
gain_items(items)

무기 입수:
weapons = { weapon_id => n, ... }
gain_weapons(weapons)

방어구 입수:
armors = { armor_id => n, ... }
gain_armors(armors)

돈 입수: gain_gold(amount)

두 가지 이상 입수하기:
items = { item_id => n, ... }
weapons = { weapon_id => n, ... }
armors = { armor_id => n, ... }
gain_combined(items, weapons, armors, gold_amount)


#==============================================================================
# ** Easy Item & Gold Gain
#------------------------------------------------------------------------------
# SephirothSpawn
# 2006-07-09
# Version 1
#------------------------------------------------------------------------------
# * Call Script Commands
#
#  ~ Gain Items
#    Call Script: items = { item_id => n, ... }
#                  gain_items(items)
#
#  ~ Gain Weapons
#    Call Script: weapons = { weapon_id => n, ... }
#                  gain_weapons(weapons)
#
#  ~ Gain Armors
#    Call Script: armors = { armor_id => n, ... }
#                  gain_armors(armors)
#
#  ~ Gain Gold
#    Call Script: gain_gold(amount)
#
#  ~ Gain Items, Weapons, Armors & Gold
#    Call Script: items = { item_id => n, ... }
#                  weapons = { weapon_id => n, ... }
#                  armors = { armor_id => n, ... }
#                  gain_combined(items, weapons, armors, gold_amount)
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Easy Item & Gold Gain', 'SephirothSpawn', 1, '2006-07-09')

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.state('Easy Item & Gold Gain')
 
#==============================================================================
# ** Window_AquireItem
#==============================================================================

class Window_AquireItem < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(kind, items)
    super(160, 128, 320, 96)
    item_max = 0
    # Finds Item Max
    items.each do |list|
      if list.is_a?(Hash)
        item_max += list.keys.size
      else
        item_max += 1
      end
    end
    # Creates Contents
    self.contents = Bitmap.new(width - 32, item_max * 32 + 32)
    self.opacity = 160
    refresh(kind, items)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(kind, items)
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 288, 32,
      'You Gained the Following Item(s)', 1)
    self.contents.font.color = normal_color
    y = 32
    case kind
    when 0 # Just Items
      items[0].each do |item_id, n|
        item = $data_items[item_id]
        next if item.nil?
        draw_item(y, item, n)
        y += 32
      end
    when 1 # Just Weapons
      items[0].each do |weapon_id, n|
        item = $data_weapons[weapon_id]
        next if item.nil?
        draw_item(y, item, n)
        y += 32
      end
    when 2 # Just Armors
      items[0].each do |armor_id, n|
        item = $data_armors[armor_id]
        next if item.nil?
        draw_item(y, item, n)
        y += 32
      end
    when 3 # Money
      draw_gold(y, items[0])
    when 4 # All
      items[0].each do |item_id, n|
        item = $data_items[item_id]
        next if item.nil?
        draw_item(y, item, n)
        y += 32
      end
      items[1].each do |weapon_id, n|
        item = $data_weapons[weapon_id]
        next if item.nil?
        draw_item(y, item, n)
        y += 32
      end
      items[2].each do |armor_id, n|
        item = $data_armors[armor_id]
        next if item.nil?
        draw_item(y, item, n)
        y += 32
      end
      draw_gold(y, items[3])
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(y, item, n)
    icon = RPG::Cache.icon(item.icon_name)
    self.contents.blt(4, y + 4, icon, Rect.new(0, 0, 24, 24))
    self.contents.draw_text(32, y, 288, 32, item.name)
    self.contents.draw_text(- 4, y, 288, 32, n.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Draw Gold
  #--------------------------------------------------------------------------
  def draw_gold(y, n)
    self.contents.draw_text(4, y, 320, 32, 'Gained Gold :')
    self.contents.draw_text(-4, y, 288, 32, n.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Frame update
  #--------------------------------------------------------------------------
  def update
    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

#==============================================================================
# ** Interpreter
#==============================================================================

class Interpreter
  #--------------------------------------------------------------------------
  # * Gain Item
  #--------------------------------------------------------------------------
  def gain_items(items = {})
    $game_system.se_play($data_system.decision_se)
    items.each {|id, n| $game_party.gain_item(id, n)}
    $scene.auto_item_aquire(0, items)
  end
  #--------------------------------------------------------------------------
  # * Gain Weapons
  #--------------------------------------------------------------------------
  def gain_weapons(weapons = {})
    $game_system.se_play($data_system.decision_se)
    weapons.each {|id, n| $game_party.gain_weapon(id, n)}
    $scene.auto_item_aquire(1, weapons)
  end
  #--------------------------------------------------------------------------
  # * Gain Armors
  #--------------------------------------------------------------------------
  def gain_armors(armors = {})
    $game_system.se_play($data_system.decision_se)
    armors.each {|id, n| $game_party.gain_armor(id, n)}
    $scene.auto_item_aquire(2, armors)
  end
  #--------------------------------------------------------------------------
  # * Gain Gold
  #--------------------------------------------------------------------------
  def gain_gold(amount)
    $game_system.se_play($data_system.decision_se)
    $game_party.gain_gold(amount)
    $scene.auto_item_aquire(3, amount)
  end
  #--------------------------------------------------------------------------
  # * Gain Combined
  #--------------------------------------------------------------------------
  def gain_combined(items = {}, weapons = {}, armors = {}, gold = 0)
    $game_system.se_play($data_system.decision_se)
    items.each {|id, n| $game_party.gain_item(id, n)}
    weapons.each {|id, n| $game_party.gain_weapon(id, n)}
    armors.each {|id, n| $game_party.gain_armor(id, n)}
    $scene.auto_item_aquire(4, items, weapons, armors, gold)
  end
end

#==============================================================================
# ** Scene_Map
#==============================================================================

class Scene_Map
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias seph_autoaqitem_scnmap_update update
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If Item Aquired Window On
    unless @autoaqitem_window.nil?
      update_auto_aquire
      return
    end
    # Original Update Method
    seph_autoaqitem_scnmap_update
  end
  #--------------------------------------------------------------------------
  # * Frame Update : Auto Aquired Item Window
  #--------------------------------------------------------------------------
  def update_auto_aquire
    # Update Map, System, Screen, Spriteset & Windows
    $game_map.update
    $game_system.map_interpreter.update
    $game_system.update
    $game_screen.update
    @spriteset.update
    @message_window.update
    @autoaqitem_window.update
    # If C Button is Pressed
    if Input.trigger?(Input::C)
      # Delete Item Aquired Windows
      @autoaqitem_window.dispose
      @autoaqitem_window = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Auto Item Aquire Start
  #--------------------------------------------------------------------------
  def auto_item_aquire(kind, *items)
    # Create Auto Item Aquire Window
    @autoaqitem_window = Window_AquireItem.new(kind, items)
  end
end

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

Who's 백호

?

이상혁입니다.

http://elab.kr


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
61 기타 Near Fantastica's SDK Test Bed 3 file 백호 2009.02.22 885
60 메뉴 Customizable Ring Menu by SephirothSpawn 백호 2009.02.22 884
59 기타 SG_Settings Control by sandgolem 백호 2009.02.22 884
58 기타 [XP/VX/VXA] Drago Core Engine Alkaid 2014.02.13 883
» 아이템 Easy Item & Gold Gain by SephirothSpawn (SDK호환) 백호 2009.02.22 880
56 기타 아래 스크립트에 대한 Guillaume777님의 개량판입니다. 백호 2009.02.22 880
55 기타 Dynamic Stores by Astro_mech@rmxp.net 1 file 백호 2009.02.22 878
54 온라인 인터넷 웹 상에서의 시간을 취득하는 스크립트 1 이우 2016.05.24 872
53 메뉴 1-Scene CMS 1.03 by LegACy@rmxp.org (SDK호환) file 백호 2009.02.22 871
52 기타 Difficulty Options by SephirothSpawn 백호 2009.02.22 869
51 기타 RM2K Facesets, Inn & Windowskin Colors by DerVVulfman@rmxp.org 1 file 백호 2009.02.22 866
50 스킬 [KGC] Skill Grouping 백호 2009.02.21 861
49 이동 및 탈것 SG_Wait for Move Completion Fix by sandgolem (SDK호환) 백호 2009.02.22 860
48 기타 Introduction & optional Splash 2.1 by SephirothSpawn (SDK호환) 1 백호 2009.02.22 860
47 기타 Quick Animations by SephirothSpawn (SDK호환) 백호 2009.02.22 851
46 기타 [XP/VX/VXA] Map Screenshot by LiTTleDRAgo 1 Alkaid 2014.02.13 850
45 아이템 SG_Escape Only Items by sandgolem (SDK호환) 백호 2009.02.22 850
44 이동 및 탈것 Memorize Location R2 by dubealex file 백호 2009.02.22 846
43 기타 Sized Events 0.1 by Toby@rmxp.org file 백호 2009.02.22 845
42 스킬 Grouping and Detail (Items/Skills) 1 file 백호 2009.02.21 839
Board Pagination Prev 1 ... 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 Next
/ 52