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 6159
981 오디오 WhiteFlute - AudioEX (XP/VX/VXA) file Alkaid 2012.12.26 1255
980 그래픽 WhiteFlute - BitmapEX 4 file JACKY 2012.12.10 2951
979 오디오 Audio Module Rewrite mciSendString 1.1 by DerVVulfman Alkaid 2012.09.18 1368
978 전투 Trickster씨의 전투 시스템 (SDK 필수?) Alkaid 2012.09.18 3257
977 스킬 Trickster's Bag of Skill Effects (SDK 필요) Alkaid 2012.09.17 1289
976 변수/스위치 Switchless Common Events by PK8(XP/VX/VXA) Alkaid 2012.09.15 1199
975 변수/스위치 Initial Switches and Variables by PK8 (XP/VX/VXA) Alkaid 2012.09.14 1296
974 변수/스위치 The Self Data Suite by PK8 (XP/VX/VXA) Alkaid 2012.09.14 1232
973 그래픽 부드럽게 화면이 움직이는 스크립트 입니다. 16 GangSin 2012.09.12 4590
972 맵/타일 Editor Tiles by PK8 (XP/VX/VXA) Alkaid 2012.09.11 1868
971 장비 Auto Equipment Optimization for Guillaume777's Multi Slot Script by DerVVulfman Alkaid 2012.09.09 1497
970 메뉴 Leidy's Ring Command Window 1.2 by DerVVulfman Alkaid 2012.09.09 1431
969 그래픽 Pictures below Characters by PK8 (XP/VXA) Alkaid 2012.09.07 1640
968 그래픽 Event Transparency by DerVVulfman (XP/VX/VXA) Alkaid 2012.09.01 1485
967 전투 Etude87_Custom_Slip_Damage_XP ver.1.0 5 습작 2012.08.26 1857
966 전투 Mr.Mo's ABS Ultimate 7.0 by DerVVulfman 4 Alkaid 2012.08.26 2587
965 그래픽 Composite Window Skins by PK8 (XP/VX/VXA) Alkaid 2012.08.26 1559
964 스킬 Miriam's Handicrafts! 1.3 by DerVVulfman Alkaid 2012.08.26 1204
963 전투 Minkoff's Animated Battlers - Enhanced 13.8 by DerVVulfman 1 Alkaid 2012.08.26 1832
962 메뉴 메뉴를 바꾸는 스크립트 14 №1 2012.08.04 4209
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