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
461 키입력 전체키 입력 스크립트 v4 by Cybersam 5 file 백호 2009.02.22 1948
460 키입력 Glitchfinder's Input Modules (XP/VX 공용) 2 Alkaid 2011.03.19 1952
459 이동 및 탈것 Super Simple Vehicle System Enhanced 8.0 by DerVVulfman 1 Alkaid 2010.12.12 1956
458 기타 [신기술 체험] 오투잼 스크립트 7 file 백호 2009.02.22 1959
457 전투 KGC_BattlerEffect(버틀러 효과) 2 file 백호 2009.02.22 1959
456 저장 세이브 & 로드 화면 개조 스크립트 file 백호 2009.02.21 1962
455 기타 [All RGSS] 윈도우 커서 숨기기/보이기 1 file Cheapmunk 2014.03.02 1963
454 메뉴 개별 메뉴 호출 단축키 스크립트 5 file 백호 2009.02.21 1965
453 HUD 맵 이름 뛰우기 10 WMN 2008.03.17 1966
452 상태/속성 KGC_StateIcon(스테이터스 아이콘 표시) 2 file 12345678 2010.02.03 1967
451 그래픽 MAWS: Modified Advanced Weather Script 1.2 by Agckuu Coceg 2 file Alkaid 2010.09.13 1969
450 기타 Project RGSS3 by joe5491 6 습작 2013.05.06 1970
449 저장 심플 세이브 로드(1개의 세이브 사용하기) 3 백호 2009.02.22 1972
448 메뉴 링 메뉴 Edited by Hypershadow180@rmxp.net 1 file 백호 2009.02.22 1975
447 스킬 스킬 레벨 스크립트 # 번역 진행중 6 빗자루씨 2010.02.11 1981
446 맵/타일 World Map 스크립트 1 file 백호 2009.02.21 1983
445 저장 Improved Save by gerrtunk 2 file Alkaid 2010.10.13 1983
444 장비 전투중에 장비변경 from RGSS Wiki 1 백호 2009.02.22 1988
443 기타 동료들이 기차처럼 줄줄 따라온다!? 7 file 백호 2009.02.21 1990
442 저장 렉없는 자동세이브(중복임??) 4 캉쿤 2011.09.12 1991
Board Pagination Prev 1 ... 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 ... 52 Next
/ 52