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 6202
921 전체화면 스크립트[해상도 스크립트랑 중복사용 불가] 24 file - 하늘 - 2009.08.06 3979
920 전투 RTAB 1.16ver 12 file 백호 2009.02.22 3962
919 장비 CSSR8-장비품 생산&강화 시스템 18 file 백호 2009.02.22 3959
918 영상 플래시 동영상 재생 스크립트 사용법 및 다운로드 8 아방스 2010.11.02 3919
917 아이템 심플 액알 [리젠, 아이템 드롭] 18 file 백호 2009.02.21 3917
916 HUD [VX 가능] 이벤트 이름 띄우기 41 file 독도2005 2009.08.22 3904
915 전투 XAS Hero Edition Ver. 3.91 3 프리즌커피 2011.12.23 3899
914 기타 [자작]데미지표시 19 file JACKY 2012.02.15 3844
913 스킬 약간 수정한 심플액알(크리티컬,스킬) 10 백호 2009.02.22 3836
912 이동 및 탈것 아하! 그렇구나의 3D 신기술 체험 2 23 아하!잘봤어요. 2010.02.28 3815
911 기타 3D스크립트 48 file ok하승헌 2010.02.18 3808
910 기타 [게이지바]HelloCoaVer4.0 업데이트 속도 변경 [오랜만의 업데이트] 30 file 코아 코스튬 2011.04.02 3791
909 전투 보행그래픽으로 싸우는 턴알 17 백호 2009.02.22 3782
908 파티 KGC-대규모파티 25 rgnrk001 2010.03.01 3774
907 이동 및 탈것 동료들끼리 따라오는 스크립트 41 file ◐아이흥행 2010.01.23 3714
906 [스마슈님 제공] 부활스크립트 19 file 아방스 2007.11.09 3708
905 기타 만화형태 말칸 스크립트 28 file 백호 2009.02.22 3706
904 저장 [ AutoSave ]오토세이브, 뜻 그대로 자동저장스크립트 17 file 제로스S2 2009.08.06 3699
903 sbabs - 몬스터 게이지 표시 스크립트 13 file 아방스 2007.11.09 3668
902 기타 [신기술 체험] RPGXP 3D 9 file 백호 2009.02.22 3637
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52