设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3307|回复: 0
打印 上一主题 下一主题

[已经过期] 請問這個腳本要怎麼改才能從VX轉到VA使用?

[复制链接]

Lv2.观梦者

梦石
0
星屑
552
在线时间
464 小时
注册时间
2009-10-11
帖子
407
跳转到指定楼层
1
发表于 2012-2-14 08:14:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我想把RPGVX的一個腳本拿來使用,
可是似乎沒辦法直接使用在RPGVA上面...
請問應該改哪裡才可以應用在VA上呢??

module Sword
#=======================================
#★ 魔劍工舖 - 書籍閱讀 1.04
# http://blog.yam.com/a870053jjkj/
#=======================================
  ON, OFF, Sword16_Library = true, false, []
=begin
========================================
● 所需腳本
控制碼轉換:http://blog.yam.com/a870053jjkj/article/28082241(非必要)
========================================
● 控制碼(支援「控制碼轉換」中的控制碼)
\C[顏色代碼] : 同事件 [顯示文章] 的「\C」控制碼相同,變更設定好的顏色
\C[紅,綠,藍] : 自訂3原色,依照3原色來設置選項內容
\IC[圖片檔案名稱] : 顯示Icons資料夾中指定的圖片,VX為System資料夾
\V[變數編號] : 顯示指定編號的編號
\N[角色編號] : 顯示指定編號的角色名稱
\B : 文字加粗,在使用一次會恢復原狀
========================================
● 設置方法
呼叫書庫畫面:$scene = Sword_Library.new
開通書本全頁:$game_party.librarys(書本編號, true)
開通書本單頁:$game_party.librarys(書本編號, 頁數)
關閉書本全頁:$game_party.librarys(書本編號, false)
關閉書本單頁:$game_party.librarys(書本編號, -頁數)
開通關閉互換:$game_party.librarys(書本編號, nil)
========================================
=end
#=======================================
#● 使用者自定設置
Sword16_Width = 120 # 設定左邊選項窗口的寬度,相對的右邊內容窗口也會受影響
Sword16_Help = ['書庫', 1] # 上方幫助窗口的 ['內容', 位置],位置:0左;1中;2右
Sword16_Order = OFF # 書本的排列是否要照著自定設置的順序排列
Sword16_SE = ['Book', 50, 60] # 設定翻頁時的 ['SE檔案名稱', 音量, 節拍]
Sword16_Arrowhead = ['←', '→'] # 設定箭頭圖片檔案名稱,如沒該檔案就顯示該內容
Sword16_Pagination = 2 # 顯示目前頁數,0為不顯示;1為顯示;2為顯示(含一頁)
Sword16_SignX = 5 # 設定換頁符號的X座標離距離窗口邊緣多遠
Sword16_SignY = 318 # 設定換頁符號的出現的Y座標位置(以書本內容窗口為原點)
#--------------------------------------------------------------
Sword16_Library[1] = ['換頁範例']
Sword16_Library[1][1] = '★設置開始★
目前你正在觀看第一頁的內容
\c[6]按鍵盤方向鍵→可以切換到下一頁
' # ☆設置結束☆
  
Sword16_Library[1][2] = '★設置開始★
目前你正在觀看第二頁的內容
\c[4]按鍵盤方向鍵←可以切換到上一頁
\c[6]按鍵盤方向鍵→可以切換到下一頁
' # ☆設置結束☆

Sword16_Library[1][3] = '★設置開始★
目前你正在觀看第三頁的內容
\c[4]按鍵盤方向鍵←可以切換到上一頁
\c[6]按鍵盤方向鍵→可以切換到下一頁
' # ☆設置結束☆

Sword16_Library[1][4] = '★設置開始★
目前你正在觀看第四頁的內容(\c[255,0,0]這是最終頁\c[0])
\c[4]按鍵盤方向鍵←可以切換到上一頁
' # ☆設置結束☆
#--------------------------------------------------------------
Sword16_Library[2] = ['設定這裡']
Sword16_Library[2][1] = '★設置開始★
聽說Sword16_Help設成[\'\', 0]
則最上面的那條窗口就會不見!!
' # ☆設置結束☆

Sword16_Library[2][2] = '★設置開始★
\B\c[6]裝備名稱

\c[4](簡介)\B\c[0]

防禦 +9 迴避 +9 攻擊 +9 
爆擊 +9 敏捷 +9 爆擊 +9
精神 +9 器魂  2 
\c[0]白0\c[4]藍4\c[6]黃6\c[18]紅18\c[24]綠24\c[0]
屬性:無
效果:吸血1%

' # ☆設置結束☆
#--------------------------------------------------------------
Sword16_Library[3] = ['書本3']
Sword16_Library[3][1] = '★設置開始★
\c[99,00,99]\B只有一頁...\B\c[0]
因為沒有必要換頁...
所以沒有將\c[6]換頁箭頭\c[0]顯示出來
' # ☆設置結束☆
#=======================================
  $Sword ? $Sword[16] = true : $Sword = {16=>true} # 腳本使用標誌
  ($Sword_VX = false ; RPG::Weather rescue $Sword_VX = true) if $Sword_VX == nil
  Sword16_SE[0] = 'Audio/SE/' + Sword16_SE[0]
end
#=======================================
#■ 處理同伴的類別
class Game_Party
  include Sword # 連接自定設置
  attr_reader    :library_order # 書本排列順序
  attr_reader    :pages # 書本頁數收錄列表
  attr_accessor :library # 書本收錄標誌數組
  #-------------------------------------------------------------
  #● 初始化物件
  alias sword16_initialize initialize
  def initialize
    sword16_initialize
    @library_order, @pages = [], {}
    @library = Array.new(Sword16_Library.size - 1){|i| @pages = [] ; false}
  end
  #-------------------------------------------------------------
  #● 添加與移除書本的(書本編號, 標誌或書籍編號)
  def librarys(id, add)
    (pag = add ; add = true) if add.is_a?(Integer) # 如果指定數值就變換變量
    @library[id] = add == nil ? (not @library[id]) : add # 變更書本獲得狀態
    if @library[id] ; @library_order += [id] unless @library_order.include?(id) # 加入順序
      unless pag ; @pages[id] = Array.new(Sword16_Library[id].size - 1){|i| i + 1} # 全頁
      else ; @pages[id] += [pag] unless @pages[id].include?(pag) if pag > 0 # 添加頁數
        @pages[id] -= [pag.abs] if pag < 0 # 移除頁數
      end
    else ; @library_order -= [id] ; @pages[id] = [] # 移除順序並清除書本的頁數
    end
    @pages[id] = @pages[id].sort # 頁數順序修正
    @library[id] = false if @pages[id].empty? # 書本無任何一頁就移除書本
  end
end
#=======================================
#■ 書庫窗口
class WSword_Library < Window_Base
  include Sword # 連接自定設置
  #-------------------------------------------------------------
  #● 初始化物件(書本編號)
  def initialize(library_id)
    @xpvx = $Sword_VX ? [Graphics.width, Graphics.height, 54] : [640, 480, 64]
    @xpvx[2] = 0 if Sword16_Help[0].empty? # 如果沒幫助窗口就不依照幫助窗口高度
    super(Sword16_Width, @xpvx[2], @xpvx[0] - Sword16_Width, @xpvx[1] - @xpvx[2])
    self.contents = Bitmap.new(width - 32, height - 32)
    (1..$game_party.library.size).each do |i| # 顯示第1個要顯示的內容
      (refresh(library_id, $game_party.pages[library_id][0]) ; return) if $game_party.library
    end
  end
  #-------------------------------------------------------------
  #● 更新內容(書本編號, 頁數)
  def refresh(library_id, pagination)
    self.contents.clear ; return if pagination == 0 # 清除,如果無頁數就中斷
    self.contents.font.color = normal_color ; self.contents.font.bold = false
    ignore_row = true # 忽略第一行的標誌(清除「★設置開始★」)
    text = Sword16_Library[library_id][pagination] ; x = 4 ; y = 0
    text = text.gsub(/\\[Ii][Cc]\[([\w_\-]+)\]/){"\001[#{$1}]"}
    text = text.gsub(/\\[Cc]\[(\d+)[ \,]+(\d+)[ \,]+(\d+)\]/){"\002[#{$1},#{$2},#{$3}]"}
    text = text.gsub(/\\[Cc]\[(\d+)\]/){"\003[#{$1}]"}
    text = text.gsub(/\\[Bb]/){"\004"}
    text = text.gsub(/\\[Vv]\[(\d+)\]/){$game_variables[$1.to_i]}
    text = text.gsub(/\\[Nn]\[(\d+)\]/){$game_actors[$1.to_i].name}
    text = text.code_explain if $Sword[46] # 控制碼轉換
    while ((c = text.slice!(/./m)) != nil)
      case c
      when "\n" ; if ignore_row ; ignore_row = false ; else ; x = 4 ; y += 32 ; next ; end # 換行
      when "\001"
        text.sub!(/\[([\w_\-]+)\]/, '')
        icon = $Sword_VX ? Cache.system($1) : RPG::Cache.icon($1)
        self.contents.blt(x, y, icon, Rect.new(0, 0, 640, 480))
        x += icon.width # 代入圖片寬度
        next
      when "\002" ; text.sub!(/\[(\d+)\,(\d+)\,(\d+)\]/, '')
        self.contents.font.color = Color.new($1.to_i, $2.to_i, $3.to_i) ; next
      when "\003" ; text.sub!(/\[(\d+)\]/, '') ; self.contents.font.color = text_color($1.to_i) ; next
      when "\004" ; self.contents.font.bold = (not self.contents.font.bold) ; next
      end
      next if (ignore_row or c == "\n")
      self.contents.draw_text(x, y, 640 - 36 - Sword16_Width, 32, c)
      x += contents.text_size(c).width # 代入內容寬度
    end
  end
end
#=======================================
#■ 書庫頁數窗口
class WSword_LibraryPagination < Window_Base
  include Sword # 連接自定設置
  #-------------------------------------------------------------
  #● 初始化物件
  def initialize(library)
    @xpvx = $Sword_VX ? [Graphics.width, Graphics.height, 54] : [640, 480, 64]
    @xpvx[2] = 0 if Sword16_Help[0].empty? # 如果沒幫助窗口就不依照幫助窗口高度
    super(Sword16_Width - 16, @xpvx[2] + Sword16_SignY,
    @xpvx[0] - Sword16_Width + 32, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0 ; self.z = 5100
    $game_party.pages[library].size == 1 ? refresh(0) : refresh(2) if library
  end
  #-------------------------------------------------------------
  #● 更新內容
  def refresh(dir)
    self.contents.clear
    self.contents.font.color = normal_color ; self.contents.font.bold = true
    a = Sword16_Arrowhead
    cache = [RPG::Cache.icon(a[0])] rescue cache = [] # 偵測左鍵頭圖片
    cache += [RPG::Cache.icon(a[1])] rescue 0 # 偵測右鍵頭圖片
    if dir == 1 or dir == 3 ; if cache[0] # 上一頁符號的處理
      self.contents.blt(0 + Sword16_SignX, 0, cache[0], Rect.new(0, 0, 100, 100))
    else ; self.contents.draw_text(0 + Sword16_SignX, 0, 32, 32, a[0])
    end ; end
    if dir == 2 or dir == 3 ; if cache[1] # 下一頁符號的處理
      self.contents.blt(self.width - cache[1].width -
      Sword16_SignX - 32, 0, cache[1], Rect.new(0, 0, 100, 100))
    else ; self.contents.draw_text(0, 0, self.width - 32 - Sword16_SignX, 32, a[1], 2)
    end ; end
    self.contents.draw_text(0, 0, self.width - 32, 32, $scene.pagination.to_s, 1) if (
    Sword16_Pagination == 2 or (Sword16_Pagination == 1 and dir > 0)) # 目前頁數
  end
end
#=======================================
#■ 書庫畫面
class Sword_Library
  include Sword # 連接自定設置
  attr_reader    :pagination # 觀看的頁數
  #-------------------------------------------------------------
  #● 主處理
  def main
    # 產生窗口
    @library = [[], []] # 定義選項
    (Sword16_Order ? 1..$game_party.library.size : $game_party.library_order).each do |i|
      (@library[0].push(Sword16_Library[0]); @library[1].push(i)) if
      $game_party.library rescue next
    end
    @library[0] = [''] if @library[0].empty? # 如果沒符合的選項時,就空白
    @command_window = Window_Command.new(Sword16_Width, @library[0])#選項窗口
    @command_window.y = $Sword_VX ? 54 : 64 unless Sword16_Help[0].empty?
    @command_window.height = ($Sword_VX ? 416 : 480) - @command_window.y
    @library_wsword = WSword_Library.new(@library[1][0]) # 產生書庫窗口
    @pagination = $game_party.pages[library_id][0] if $game_party.pages[library_id] # 起始
    @librarypagi_wsword = WSword_LibraryPagination.new(@library[1][0]) # 頁數窗口
    unless Sword16_Help[0].empty? # 有設置窗口內容時
      @help_window = Window_Help.new  # 產生幫助窗口
      @help_window.set_text(Sword16_Help[0], Sword16_Help[1]) # 設置窗口內容
    end
    #○ 主循環
    Graphics.transition
    loop {Graphics.update ; Input.update ; update ; break if $scene != self} # 更新
    Graphics.freeze
    #○ 釋放窗口
    @command_window.dispose
    @library_wsword.dispose
    @librarypagi_wsword.dispose
    @help_window.dispose unless Sword16_Help[0].empty?
  end
  #-------------------------------------------------------------
  #● 更新畫面
  def update
    @command_window.update
    #○ 按鍵判斷
    p $game_party.pages[library_id] if Input.trigger?(Input::A)
    if Input.trigger?(Input::B)
      $Sword_VX ? Sound.play_cancel : $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new # 返回地圖
    elsif Input.repeat?(Input::UP) or Input.trigger?(Input::DOWN)
      return if (not library_id) or @library[0].size <= 1 # 非指定編號或只有一頁就中斷
      @pagination = $game_party.pages[library_id][0] # 變更為一開始的一頁
      @library_wsword.refresh(library_id, @pagination)
      $game_party.pages[library_id].size == 1 ?
      @librarypagi_wsword.refresh(0) : @librarypagi_wsword.refresh(2)
    elsif Input.repeat?(Input::LEFT) # 上一頁
      return unless library_id # 如果非指定編號就中斷
      if $game_party.pages[library_id].index(@pagination) != 0
        @pagination = $game_party.pages[library_id][
        $game_party.pages[library_id].index(@pagination) - 1]
        Audio.se_play(Sword16_SE[0], Sword16_SE[1], Sword16_SE[2]) rescue 0
        @library_wsword.refresh(library_id, @pagination)
        @pagination == $game_party.pages[library_id][0] ?
        @librarypagi_wsword.refresh(2) : @librarypagi_wsword.refresh(3)
      end
    elsif Input.trigger?(Input::RIGHT) # 下一頁
      return unless library_id # 如果非指定編號就中斷
      if $game_party.pages[library_id].index(@pagination) !=
      $game_party.pages[library_id].size - 1
        @pagination = $game_party.pages[library_id][
        $game_party.pages[library_id].index(@pagination) + 1]
        Audio.se_play(Sword16_SE[0], Sword16_SE[1], Sword16_SE[2]) rescue 0
        @library_wsword.refresh(library_id, @pagination)
        @pagination == $game_party.pages[library_id][-1] ?
        @librarypagi_wsword.refresh(1) : @librarypagi_wsword.refresh(3)
      end
    end
  end
  #-------------------------------------------------------------
  #● 獲取選項目前指著的書籍編號
  def library_id ; @library[1][@command_window.index] ; end
end
因为现实太残酷、所以我们都在打造虚幻的天堂。如果现实不再残酷,也是因为有这快乐的天堂。
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-6 06:48

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表