XP 스크립트

현재 제가 퀘스트 창으로 쓰고 있는 스크립트입니다.
일루젼님께서 사용법이 필요하시다길래 올립니다.

사용법::
실행 스크립트는 $scene = Scene_Outline.new 입니다.
그러나 그냥 실행만 시켜서는 개요창에 제목이 표시되지 않습니다
그래서 따로 $game_system.outline_enable[0] = true를 스크립트로 실행해주셔야합니다.
그럼 첫번째 글을 읽을 수 있게 되고 $game_system.outline_enable[0] = true에서 [0]의 숫자를
바꿔주시면 다른 글도 표시됩니다.
단 첫번째 글의 번호가 0부터 시작합니다 두번째 글은 1, 세번째는 2가 되는거죠.
필요하시다면 예제도 올리겠습니다.

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆개요 - KGC_Outline◆
#_/----------------------------------------------------------------------------
#_/  개요를 열람하는 기능을 추가합니다.
#_/  Provides the function to show "Outline".
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ 커스터마이즈 항목 - Customize ★
#==============================================================================

module KGC
  # ◆개요 화면 배경 투과
  OLINE_BACK_TRANSPARENT = true
  # ◆스크롤 속도【단위:px】
  OLINE_SCROLL_SPEED = 8
  # ◆일련 번호를 묘화
  OLINE_SERIAL_NUMBER = false
  # ◆일련 번호의 자리수
  OLINE_SERIAL_NUMBER_DIGITS = 3
  # ◆무효인 개요는 표시하지 않는
  OLINE_HIDE_DISABLED = true
  # ◆완료 기호
  OLINE_COMPLETION_SYMBOL = "★"
  # ◆미완 기호
  OLINE_INCOMPLETION_SYMBOL = " "

  # ◆개요 내용
  #  ≪["타이틀", ["본문", ...]], ...≫
  #  본문은 , 배열의 각 요소가 1행에 상당.
  #    **** 제어 커멘드 ****
  #  \V[n]  : 변수 ID:n
  #  \G    : 소지금
  #  \N[n]  : ID:n 의 엑터명
  #  \EN[n] : ID:n 의 에너미명
  #  \IN[n] : ID:n 의 아이템명
  #  \WN[n] : ID:n 의 무기명
  #  \AN[n] : ID:n 의 방어용 기구명
  OLINE_CONTENTS = [
    ["(Main) '루스텐'촌장과의 만남",  # 제목
      ["[대지의 마을: 로렌] 중앙에 위치한 '루스텐' 촌장의 집으로",
      " 가서 '루스텐' 촌장에게 레뮤리아 대륙의 이야기를 들으라."]] #  내용
  ]  # -- Don't delete this line! --
end

#### OLINE_BACK_TRANSPARENT
### Makes the background of "Outline" transparency.

#### OLINE_SCROLL_SPEED
### Scroll speed. {Unit : pixel}

#### OLINE_SERIAL_NUMBER
### Draws the serial number.

#### OLINE_SERIAL_NUMBER_DIGITS
### Digits of the serial number.

#### OLINE_HIDE_DISABLED
### Hides disabled "Outline".

#### OLINE_COMPLETION_SYMBOL
### Completion symbol.

#### OLINE_INCOMPLETION_SYMBOL
### Incompletion symbol.


#### OLINE_CONTENTS
### Contents of "Outline".
#  << ["Title", ["Body", ...]], ... >>
#  In the "Body", each element of the array corresponds to one line.
#    **** Control statement ****
#  \V[n]  : Variable of ID:n
#  \G    : Money
#  \N[n]  : Actor's name of ID:n
#  \EN[n] : Enemies' name of ID:n
#  \IN[n] : Item's name of ID:n
#  \WN[n] : Weapon's name of ID:n
#  \AN[n] : Armor's name of ID:n

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["Outline"] = true

#--------------------------------------------------------------------------
# ● 개요 화면 호출
#--------------------------------------------------------------------------
def call_outline
  # 플레이어의 자세를 교정
  $game_player.straighten
  # 개요 화면으로 전환하고
  $scene = Scene_Outline.new(true)
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_System
#==============================================================================

class Game_System
  attr_accessor :outline_enable, :outline_complete
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  alias initialize_KGC_Outline initialize
  def initialize
    initialize_KGC_Outline

    @outline_enable = []
    @outline_complete = []
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Module - KGC_Outline
#------------------------------------------------------------------------------
#  개요 처리에 사용하는 메소드입니다.
#==============================================================================

module KGC_Outline
  #--------------------------------------------------------------------------
  # ● 제어 커멘드 처리
  #    string : 처리 대상 캐릭터 라인
  #--------------------------------------------------------------------------
  def self.apply_control_statement(string)
    buf = string.dup
    buf.gsub!(/\V[(d+)]/i) { $game_variables[$1.to_i].to_s }
    buf.gsub!(/\G/i) { $game_party.gold.to_s }
    buf.gsub!(/\N[(d+)]/i) { $game_actors[$1.to_i].name }
    buf.gsub!(/\EN[(d+)]/i) { $data_enemies[$1.to_i].name }
    buf.gsub!(/\IN[(d+)]/i) { $data_items[$1.to_i].name }
    buf.gsub!(/\WN[(d+)]/i) { $data_weapons[$1.to_i].name }
    buf.gsub!(/\AN[(d+)]/i) { $data_armors[$1.to_i].name }
    return buf
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_OutlineList
#------------------------------------------------------------------------------
#  개요 일람을 표시하는 윈도우입니다.
#==============================================================================

class Window_OutlineList < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    super(80, 40, 480, 400)
    self.back_opacity = 160 if KGC::OLINE_BACK_TRANSPARENT
    self.index = 0
    self.z = 1000
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 선택 개요 내용
  #--------------------------------------------------------------------------
  def outline
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  def refresh
    self.contents.dispose if self.contents != nil
    @data = []
    # 리스트 작성
    $game_system.outline_enable = [] if $game_system.outline_enable == nil
    $game_system.outline_complete = [] if $game_system.outline_complete == nil
    KGC::OLINE_CONTENTS.each_with_index { |oline, i|
      if $game_system.outline_enable[i]
        buf = oline
        buf << i
        @data << buf
      elsif !KGC::OLINE_HIDE_DISABLED
        @data << ["- - - - - - - -", nil, i]
      end
    }
    # 리스트 묘화
    @item_max = [@data.size, 1].max
    self.contents = Bitmap.new(self.width - 32, 32 * @item_max)
    if @data.size == 0
      @data << ["", nil, 0]
    else
      @data.each_index { |i| draw_item(i) }
    end
  end
  #--------------------------------------------------------------------------
  # ● 항목 묘화
  #--------------------------------------------------------------------------
  def draw_item(index)
    self.contents.fill_rect(0, 32 * index, self.width - 32, 32, Color.new(0, 0, 0, 0))
    # 타이틀 생성
    text = ($game_system.outline_complete[index] ?
      KGC::OLINE_COMPLETION_SYMBOL : KGC::OLINE_INCOMPLETION_SYMBOL) +
      (KGC::OLINE_SERIAL_NUMBER ? sprintf("%0*d : ",
      KGC::OLINE_SERIAL_NUMBER_DIGITS, @data[index][2] + 1) : "") +
      KGC_Outline::apply_control_statement(@data[index][0])
    # 묘화색 설정
    self.contents.font.color = $game_system.outline_enable[index] ?
      normal_color : disabled_color
    self.contents.draw_text(0, 32 * index, self.width - 32, 32, text)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_OutlineTitle
#------------------------------------------------------------------------------
#  개요의 제목을 표시하는 윈도우입니다.
#==============================================================================

class Window_OutlineTitle < Window_Base
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = 160 if KGC::OLINE_BACK_TRANSPARENT
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #    text  : 표시하는 캐릭터 라인
  #--------------------------------------------------------------------------
  def refresh(text)
    self.contents.clear
    text2 = KGC_Outline::apply_control_statement(text)
    self.contents.draw_text(0, 0, self.width - 32, 32, text2, 1)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Outline
#------------------------------------------------------------------------------
#  개요(의 내용)을 표시하는 윈도우입니다.
#==============================================================================

class Window_Outline < Window_Base
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 640, 416)
    self.back_opacity = 160 if KGC::OLINE_BACK_TRANSPARENT
    self.active = false
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #    oline : 개요
  #--------------------------------------------------------------------------
  def refresh(oline = nil)
    self.oy = 0
    self.contents.dispose if self.contents != nil
    return if oline == nil
    # 본문을 묘화
    self.contents = Bitmap.new(self.width - 32, 32 * oline.size)
    oline.each_with_index { |l ,i|
      next if l == nil
      text = KGC_Outline::apply_control_statement(l)
      self.contents.draw_text(0, i * 32, self.width - 32, 32, text)
    }
  end
  #--------------------------------------------------------------------------
  # ● 갱신
  #--------------------------------------------------------------------------
  def update
    super
    # 스크롤
    if self.active
      scroll_max = [self.contents.height - (self.height - 32), 0].max
      if Input.press?(Input::UP)
        self.oy = [self.oy - KGC::OLINE_SCROLL_SPEED, 0].max
      elsif Input.press?(Input::DOWN)
        self.oy = [self.oy + KGC::OLINE_SCROLL_SPEED, scroll_max].min
      elsif Input.repeat?(Input::L)
        self.oy = [self.oy - (self.height - 32), 0].max
      elsif Input.repeat?(Input::R)
        self.oy = [self.oy + (self.height - 32), scroll_max].min
      end
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Outline
#------------------------------------------------------------------------------
#  개요 화면의 처리를 실시하는 클래스입니다.
#==============================================================================

class Scene_Outline
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #    map_call : 맵으로부터의 호출 플래그
  #--------------------------------------------------------------------------
  def initialize(map_call = false)
    @map_call = map_call
  end
  #--------------------------------------------------------------------------
  # ● 메인 처리
  #--------------------------------------------------------------------------
  def main
    # 스프라이트 세트를 작성
    @spriteset = Spriteset_Map.new if KGC::OLINE_BACK_TRANSPARENT
    # 윈도우를 작성
    @list_window = Window_OutlineList.new
    @title_window = Window_OutlineTitle.new
    @content_window = Window_Outline.new
    # 트란지션 실행
    Graphics.transition
    # 메인 루프
    loop {
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    }
    # 트란지션 준비
    Graphics.freeze
    # 윈도우를 해방
    @list_window.dispose
    @title_window.dispose
    @content_window.dispose
    @spriteset.dispose if KGC::OLINE_BACK_TRANSPARENT
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    # 윈도우 갱신
    @list_window.update
    @title_window.update
    @content_window.update
    # 액티브 윈도우 조작
    if @list_window.active
      update_list
    elsif @content_window.active
      update_content
    end
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (리스트)
  #--------------------------------------------------------------------------
  def update_list
    # B 버튼이 밀렸을 경우
    if Input.trigger?(Input::B)
      # 캔슬 SE 을 연주
      $game_system.se_play($data_system.cancel_se)
      if @map_call
        # 맵 화면으로 전환하고
        $scene = Scene_Map.new
      else
        # 메뉴 화면으로 전환하고
        if $imported["MenuAlter"]
          index = KGC::MA_COMMANDS.index(12)
          if index != nil
            $scene = Scene_Menu.new(index)
          else
            $scene = Scene_Menu.new
          end
        else
          $scene = Scene_Menu.new
        end
      end
      return
    end
    # C 버튼이 밀렸을 경우
    if Input.trigger?(Input::C)
      outline = @list_window.outline
      # 열람할 수 없는 경우
      if outline[1] == nil
        # 버저 SE 를 연주
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # 결정 SE 을 연주
      $game_system.se_play($data_system.decision_se)
      # 개요를 갱신
      @title_window.refresh(outline[0])
      @content_window.refresh(outline[1])
      # 윈도우 변환
      @list_window.active = false
      @list_window.z = 0
      @content_window.active = true
      @content_window.z = 1000
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신 (본문)
  #--------------------------------------------------------------------------
  def update_content
    # B 버튼이 밀렸을 경우
    if Input.trigger?(Input::B)
      # 캔슬 SE 을 연주
      $game_system.se_play($data_system.cancel_se)
      # 윈도우 변환
      @list_window.active = true
      @list_window.z = 1000
      @content_window.active = false
      @content_window.z = 0
      return
    end
  end
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '2'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
921 기타 Defining Encounter Areas by RPG Advocate (사용법 첨부) file 백호 2009.02.22 1201
920 전투 DerVVulfman's addons for Mr.Mo's ABS file Alkaid 2010.09.10 1645
919 기타 Difficulty Options by SephirothSpawn 백호 2009.02.22 869
918 기타 Drago - Custom Resolution by LiTTleDRAgo Alkaid 2014.02.13 1110
917 그래픽 Drago - Custom Resolution II 1 Alkaid 2014.09.10 1004
916 기타 Dynamic Stores by Astro_mech@rmxp.net 1 file 백호 2009.02.22 878
915 아이템 Easy Item & Gold Gain by SephirothSpawn (SDK호환) 백호 2009.02.22 880
914 기타 Economy System by Nick@Creation Asylum 1 file 백호 2009.02.22 934
913 맵/타일 Editor Tiles by PK8 (XP/VX/VXA) Alkaid 2012.09.11 1868
912 기타 Encounter Control by SephirothSpawn (SDK호환) 4 file 백호 2009.02.22 1157
911 기타 endroll 주석 번역 6 file insertend 2010.05.15 1638
910 스킬 Equipment Skills 2.0 by SephirothSpawn file 백호 2009.02.22 1007
909 장비 Equipment Upgrade System 1.1 by Charlie Fleed Alkaid 2010.11.18 1928
908 기타 Etude87_Bone_Animation_Character ver.1.2 4 습작 2012.07.06 1255
907 전투 Etude87_Custom_Slip_Damage_XP ver.1.0 5 습작 2012.08.26 1857
906 메뉴 Etude87_Horror_Menu_XP ver.1.1 15 file 습작 2012.08.04 2762
905 메시지 Etude87_Item_Choice_XP ver.1.10 13 file 습작 2013.05.19 2178
904 맵/타일 Etude87_Map_Remember_XP ver.1.2 2 습작 2012.07.17 1614
903 변수/스위치 Etude87_Variables_XP 2 습작 2011.12.26 2104
902 메뉴 Event Spawner 1 file 백호 2009.02.22 980
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