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
34 아이템 아이템 소지수 한계돌파(중복일 확률 높음) 3 캉쿤 2011.09.13 1478
33 아이템 Categorized Items Menu 1.3 by albertfish 1 file Alkaid 2010.09.09 1795
32 아이템 아이템창변경 27 카르닉스 2010.02.26 3631
31 아이템 아이템소지수 한계돌파 (중복일지도) 12 카르닉스 2010.02.26 1498
30 아이템 [LPG] 아이템 상세정보 - ◇ Last Update : 2009/08/11 ◇ 11 file Claymore 2009.08.16 3307
29 아이템 CSSR14-아이템 합성 3 file 백호 2009.02.22 2833
28 아이템 아이템 사용 클래스 한정 스크립트! 2 백호 2009.02.22 1146
27 아이템 지정한 아이템 갯수 제한 3 백호 2009.02.22 1282
26 아이템 아이템 단축키로 구입 스크립트 3 백호 2009.02.22 1243
25 아이템 [신기술 체험] 인벤토리 8 file 백호 2009.02.22 2962
» 아이템 Easy Item & Gold Gain by SephirothSpawn (SDK호환) 백호 2009.02.22 880
23 아이템 Additional Item Drop by SephirothSpawn (SDK호환) 1 백호 2009.02.22 891
22 아이템 SG_Item Break by sandgolem (SDK호환) 백호 2009.02.22 897
21 아이템 SG_Escape Only Items by sandgolem (SDK호환) 백호 2009.02.22 850
20 아이템 SG_Hide free item cose by sandgolem (SDK호환) 백호 2009.02.22 935
19 아이템 Item Acquired Window by SiliconHero@rmxp.net 백호 2009.02.22 1096
18 아이템 아이템 인벤토리 2 file 백호 2009.02.22 3354
17 아이템 아이템을 얻으면 자동으로 아이템 입수 메세지윈도우 띄우기 4 백호 2009.02.22 2279
16 아이템 소지/구입 아이템 갯수 99개 이상 가능(약간 수정) 2 백호 2009.02.22 1103
15 아이템 아이템 정리기능 S크립T 1 file 백호 2009.02.21 1080
Board Pagination Prev 1 2 Next
/ 2