查看: 3189|回复: 3

[已经解决] [結帖]戰鬥場景的說明視窗內的文字

[复制链接]
david_ng223 该用户已被删除
发表于 2019-12-11 10:41:57 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
梦石
0
星屑
735
在线时间
42 小时
注册时间
2019-11-26
回帖
24
发表于 2019-12-11 17:08:13 | 显示全部楼层
可以啊,你在Scene_Battle的update方法中不停地更新说明视窗内文字的x坐标或者y坐标就好了
回复

使用道具 举报

梦石
1
星屑
14374
在线时间
2109 小时
注册时间
2017-9-28
回帖
607
发表于 2019-12-11 18:21:59 | 显示全部楼层
脚本1#==============================================================================
# ■ 滑动(In/Out)战斗信息 (VX Ace用)
#------------------------------------------------------------------------------
# 制作者     : CanariAlternate
# 主页名   : カルトの鳥篭
# 主页URL  : http://canarialt.blog.fc2.com
#------------------------------------------------------------------------------
# ■ 概要 : 战斗信息滑动进入和退出。
#
# ■ 需要脚本 : 无
#
# ■ 位置 : 「Scene_Battle」之下。
#------------------------------------------------------------------------------
# 更新履歴 : 2012/10/02 Ver1.00 基礎部分の製作が完了する。
#            2012/10/05 Ver1.01 バトルログをこのスクリプトで表示する機能を実装
#            2013/02/19 Ver1.02 説明文の表記方法などを他と統一した。
#==============================================================================

$imported ||= {}
$imported[:CanariAlternate_Window_MessageLog] = true

#==============================================================================
# ■ Calt
#------------------------------------------------------------------------------
#  CanariAlternateが製作したスクリプト用のモジュールです。
#==============================================================================
module Calt
  #-----------------------------------------------------------------------------
  # ★このスクリプトでバトルログを表示させる。
  Alternate_Window_BattleLog = true
  #-----------------------------------------------------------------------------
end

if Calt::Alternate_Window_BattleLog
  $imported[:CanariAlternate_Window_BattleLog] = true
  #==============================================================================
  # ■ Scene_Battle
  #------------------------------------------------------------------------------
  #  バトル画面の処理を行うクラスです。
  #==============================================================================
  class Scene_Battle < Scene_Base
    #--------------------------------------------------------------------------
    # ● フレーム更新(基本)[追加]
    #--------------------------------------------------------------------------
    alias _update_basic_alter_battle_log update_basic
    def update_basic
      _update_basic_alter_battle_log
      @log_window.update  # バトルログを更新
    end
  end
  Window_MessageLog = Window_BattleLog        # 別名(変更を共有)
else
  Window_MessageLog = Window_BattleLog.clone  # クローン
end

#==============================================================================
# ■ Window_MessageLog
#------------------------------------------------------------------------------
#  ログを表示する機能の設定を定義しています。
#==============================================================================
class Window_MessageLog
  #--------------------------------------------------------------------------
  # ● ラインを移動する速度(行をつめる速度)         ※縦にスライドする速度
  def now_speed           ; return 3                                    ; end
  #--------------------------------------------------------------------------
  # ● ラインを消去する速度(画面外へのスライド速度) ※縦にスライドする速度
  def del_speed           ; return 4                                    ; end
  #--------------------------------------------------------------------------
  # ● ラインを追加する速度(画面内へのスライド速度) ※横にスライドする速度
  def add_speed           ; return 96                                   ; end
  #--------------------------------------------------------------------------
  # ● 追加するラインの始点(x座標)
  def add_line_start_x    ; return contents_width                       ; end
  #--------------------------------------------------------------------------
  # ● 消去するラインの終点(y座標)
  def del_line_end_y      ; return -line_height                         ; end
  #--------------------------------------------------------------------------
  # ● 最大行数の取得
  def max_line_number     ; return 6                                    ; end
  #--------------------------------------------------------------------------
  # ● 消去中のラインの不透明度  (透明) 0 ~ 255 (不透明)
  def del_opacity         ; return 64                                   ; end
  #--------------------------------------------------------------------------
  # ● 背景ビットマップの取得
  def get_back_bitmap(line_rect)
    ##back_bitmap = Bitmap.new("Graphics/System/" + "画像名") # 画像を読み込み
    ##return back_bitmap
   
    back_bitmap = Bitmap.new(line_rect.width, line_rect.height) # ビットマップを生成
    color_l = left_color  # ラインの左端の色を取得
    color_r = right_color # ラインの右端の色を取得
    # 左から右へグラデーションさせながら塗りつぶし
    back_bitmap.gradient_fill_rect(line_rect, color_l, color_r)
   
    # これだけだと寂しいので少し装飾(枠をつける)
    color_l.alpha += 64
    color_r.alpha += 64
    frame_rect = Rect.new(0, 0, line_rect.width, 1)
    back_bitmap.gradient_fill_rect(frame_rect, color_l, color_r) # 上の枠を描画
    frame_rect.y = line_rect.height - 1
    back_bitmap.gradient_fill_rect(frame_rect, color_l, color_r) # 下の枠を描画
    frame_rect = Rect.new(0, 0, 1, line_rect.height)
    back_bitmap.fill_rect(frame_rect, color_l)                   # 左の枠を描画
    frame_rect.x = line_rect.width - 1
    back_bitmap.fill_rect(frame_rect, color_r)                   # 右の枠を描画
   
    return back_bitmap
  end
  #--------------------------------------------------------------------------
  # ● ラインの左端の色     (red, green, blue, alpha)
  def left_color          ; return Color.new(255, 128, 64, 128)         ; end
  #--------------------------------------------------------------------------
  # ● ラインの右端の色     (red, green, blue, alpha)
  def right_color         ; return Color.new(255, 255, 255, 32)         ; end
  #--------------------------------------------------------------------------
  # ● ラインの幅を取得
  def line_width          ; return contents_width - 16                  ; end
  #--------------------------------------------------------------------------
  # ● ラインの高さを取得
  def line_height         ; return 24                                   ; end
  #--------------------------------------------------------------------------
  # ● ウィンドウ幅の初期値を取得
  def window_width        ; return Graphics.width                       ; end
  #--------------------------------------------------------------------------
  # ● ウィンドウ高さの初期値を取得
  def window_height       ; return fitting_height(max_line_number)      ; end
  #--------------------------------------------------------------------------
  # ● ウィンドウの初期設定
  def window_parameter
    ##self.windowskin = Cache.system("Window")  # ウィンドウスキンの変更
    self.z              = 100   # Z座標
    self.opacity        = 0     # 透明度
    self.arrows_visible = false # カーソルは表示しない
  end
  #--------------------------------------------------------------------------
  # ● 標準パディングサイズの取得
  def standard_padding    ; return 0                                    ; end
  #--------------------------------------------------------------------------
  # ● ウィンドウ内容の幅を計算
  def contents_width      ; return width  - standard_padding * 2        ; end
  #--------------------------------------------------------------------------
  # ● ウィンドウ内容の高さを計算
  def contents_height     ; return height - standard_padding * 2        ; end
  #--------------------------------------------------------------------------
  # ● 余白(x座標)
  def padding_x           ; return 0                                    ; end
  #--------------------------------------------------------------------------
  # ● 余白(y座標)
  def padding_y           ; return 8                                    ; end
  #--------------------------------------------------------------------------
  # ● ラインのテキストの余白(x座標)
  def text_padding_x      ; return 16                                   ; end
  #--------------------------------------------------------------------------
  # ● ラインのテキストの余白(y座標)
  def text_padding_y      ; return 0                                    ; end
  #--------------------------------------------------------------------------
  # ● ラインとラインの間隔
  def line_spacing        ; return 4                                    ; end
  #--------------------------------------------------------------------------
end

#==============================================================================
# ■ Window_MessageLog
#------------------------------------------------------------------------------
#  ログを表示する機能を制御するメソッドを定義しています。
#==============================================================================
class Window_MessageLog
  #--------------------------------------------------------------------------
  # ● 最下行の文章の取得
  def last_text           ; return line_text(@exist_lines[-1])          ; end
  #--------------------------------------------------------------------------
  # ● データ行数の取得
  def line_number         ; return @exist_lines.size                    ; end
  #--------------------------------------------------------------------------
  # ● 一行戻る
  def back_one            ; del_line(@exist_lines.pop)                  ; end
  #--------------------------------------------------------------------------
  # ● 指定した行を消去
  def del_text(gyou)      ; del_line(@exist_lines.delete_at(gyou - 1))  ; end
  #--------------------------------------------------------------------------
  # ● 指定した行に戻る
  def back_to(line_index) ; back_one while line_number > line_index     ; end
  #--------------------------------------------------------------------------
  # ● 一行シフト
  def shift_one
    @shift_lines[@exist_lines.shift] = del_line_end_y
    @change_lines = true
  end
  #--------------------------------------------------------------------------
  # ● クリア
  def clear
    @num_wait = 0
    @dying_lines += @exist_lines
    @exist_lines.clear
    @entry_lines.clear
  end
  #--------------------------------------------------------------------------
  # ● 文章の追加(行を指定するとその行に追加)
  def add_text(text, line_index = line_number)
    shift_one unless line_number < max_line_number # 行数が上限以上
    add_line(text, line_index)
  end
  #--------------------------------------------------------------------------
  # ● 文章の置き換え
  def replace_text(text)
    back_one
    add_text(text)
  end
  #--------------------------------------------------------------------------
end

#==============================================================================
# ■ Window_MessageLog
#------------------------------------------------------------------------------
#  ログを表示する機能の処理で使用する変数の操作?取得を定義しています。
#==============================================================================
class Window_MessageLog
  #--------------------------------------------------------------------------
  # ● 定数
  #--------------------------------------------------------------------------
  Text   = 0  # テキストのインデックス
  Back   = 1  # 背景のスプライトのインデクッス
  Window = 2  # 文章のウィンドウのインデックス
  #--------------------------------------------------------------------------
  # ● 指定行数に適合するウィンドウの高さを計算
  #--------------------------------------------------------------------------
  def fitting_height(line_index)
    return line_position_y(line_index) + standard_padding * 2
  end
  #--------------------------------------------------------------------------
  # ● 指定行数に適合するラインの高さを計算
  #--------------------------------------------------------------------------
  def line_position_y(line_index)
    return padding_y + (line_height + line_spacing) * line_index
  end
  #--------------------------------------------------------------------------
  # ● ラインの背景スプライトを取得
  #--------------------------------------------------------------------------
  def line_text(window_index)
    return @line_windows[window_index][Text]
  end
  #--------------------------------------------------------------------------
  # ● ラインの背景スプライトを取得
  #--------------------------------------------------------------------------
  def line_back(window_index)
    return @line_windows[window_index][Back]
  end
  #--------------------------------------------------------------------------
  # ● ラインの文章ウィンドウを取得
  #--------------------------------------------------------------------------
  def line_window(window_index)
    return @line_windows[window_index][Window]
  end
  #--------------------------------------------------------------------------
  # ● ラインのx座標を設定
  #--------------------------------------------------------------------------
  def set_line_window_x(window_index, new_x)
    @line_windows[window_index][Back].x   = new_x
    @line_windows[window_index][Window].x = new_x
  end
  #--------------------------------------------------------------------------
  # ● ラインのy座標を設定
  #--------------------------------------------------------------------------
  def set_line_window_y(window_index, new_y)
    @line_windows[window_index][Back].y   = new_y
    @line_windows[window_index][Window].y = new_y
  end
  #--------------------------------------------------------------------------
  # ● ラインのx座標に加算
  #--------------------------------------------------------------------------
  def add_line_window_x(window_index, add_x)
    @line_windows[window_index][Back].x   += add_x
    @line_windows[window_index][Window].x += add_x
  end
  #--------------------------------------------------------------------------
  # ● ラインのy座標に加算
  #--------------------------------------------------------------------------
  def add_line_window_y(window_index, add_y)
    @line_windows[window_index][Back].y   += add_y
    @line_windows[window_index][Window].y += add_y
  end
  #--------------------------------------------------------------------------
  # ● ラインのx座標を取得
  #--------------------------------------------------------------------------
  def line_window_x(window_index)
    return @line_windows[window_index][Window].x
  end
  #--------------------------------------------------------------------------
  # ● ラインのy座標を取得
  #--------------------------------------------------------------------------
  def line_window_y(window_index)
    return @line_windows[window_index][Window].y
  end
end

#==============================================================================
# ■ Window_MessageLog
#------------------------------------------------------------------------------
#  ログを表示する機能の処理を定義しています。
#==============================================================================
class Window_MessageLog
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x = 0, y = 0, width = window_width, height = window_height)
    super(x, y, width, height)
    window_parameter      # このウィンドウの初期値を設定
    create_lines_viewport # ラインが枠内から出ないようにするビューポートを生成
    create_back_bitmap    # ラインの背景Bitmapを生成
   
    @death_sentence = []  # 消去中に状態を変更するウィンドウを記憶する変数
    @change_lines = false # ライン状態の変更を記憶する変数
    @num_wait = 0         # バトルログのウェイトで使用する変数
   
    # ラインの状態リスト
    @exist_lines = [] # 表示中(空文含む)
    @entry_lines = [] # 追加中
    @dying_lines = [] # 消去中
    @shift_lines = {} # 移動中(ハッシュ)
   
    # ラインを描画する為のウィンドウとスプライトのセットの配列を準備
    @line_windows = Array.new(max_line_number * 3) do |i|
      @shift_lines = false # ハッシュにKeyを登録する
      create_line_window_set
    end
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    super
    dispose_back_bitmap
    dispose_line_windows
    dispose_lines_viewport
  end
  #--------------------------------------------------------------------------
  # ● ラインのビューポートを生成
  #--------------------------------------------------------------------------
  def create_lines_viewport
    @lines_viewport = Viewport.new(0, 0, contents_width, contents_height)
    @lines_viewport.rect.x = self.x + standard_padding
    @lines_viewport.rect.y = self.y + standard_padding
    @lines_viewport.z      = self.z
  end
  #--------------------------------------------------------------------------
  # ● ラインの背景になるビットマップを生成
  #--------------------------------------------------------------------------
  def create_back_bitmap
    line_rect = Rect.new(0, 0, line_width, line_height) # ラインの矩形
    @back_bitmap = get_back_bitmap(line_rect)           # Bitmapの取得
  end
  #--------------------------------------------------------------------------
  # ● ラインの背景になるスプライトの生成
  #--------------------------------------------------------------------------
  def create_back_sprite
    back_sprite = Sprite.new(@lines_viewport)
    back_sprite.bitmap  = @back_bitmap
    back_sprite.visible = false
    back_sprite.z       = 150
    return back_sprite
  end
  #--------------------------------------------------------------------------
  # ● テキストを表示するウィンドウの生成
  #--------------------------------------------------------------------------
  def create_line_window
    line_window = Window_MessageLine.new(0, 0, line_width, line_height)
    line_window.viewport = @lines_viewport
    line_window.visible  = false
    line_window.z        = 200
    return line_window
  end
  #--------------------------------------------------------------------------
  # ● テキストとウィンドウと背景の配列を生成
  #--------------------------------------------------------------------------
  def create_line_window_set
    return [nil, create_back_sprite, create_line_window]
  end
  #--------------------------------------------------------------------------
  # ● 背景ビットマップの解放
  #--------------------------------------------------------------------------
  def dispose_back_bitmap
    @back_bitmap.dispose
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウと背景の解放
  #--------------------------------------------------------------------------
  def dispose_line_windows
    @line_windows.each do |window_set|
      window_set[Back].dispose   # 背景のスプライトを解放
      window_set[Window].dispose # 文章のウィンドウを解放
    end
  end
  #--------------------------------------------------------------------------
  # ● ラインのビューポートの解放
  #--------------------------------------------------------------------------
  def dispose_lines_viewport
    @lines_viewport.dispose
  end
  #--------------------------------------------------------------------------
  # ● ラインのビューポートの同期と更新
  #--------------------------------------------------------------------------
  def update_lines_viewport
    # 移動しない場合は更新不要。それに同期させるより移動する際に更新する方が良い。
    @lines_viewport.rect.x = self.x + standard_padding
    @lines_viewport.rect.y = self.y + standard_padding
    @lines_viewport.z      = self.z
    @lines_viewport.rect.width  = contents_width
    @lines_viewport.rect.height = contents_height
    @lines_viewport.visible     = self.visible
    ##@lines_viewport.update  # フラッシュは使用しないので更新はしない
  end
  #--------------------------------------------------------------------------
  # ● 更新処理
  #--------------------------------------------------------------------------
  def update
    super
    check_shift_line if @change_lines # ライン状態が操作されている
    @death_sentence.reject! { |window_index| execution(window_index) }
    ##update_lines_viewport # ラインのビューポートの同期と更新
    @dying_lines.each_index { |index| dying_line_process(index) }
    @entry_lines.each_index { |index| entry_line_process(index) }
    @shift_lines.each { |key, value| shift_line_process(key, value) if value }
   
    ##@line_windows.each do |window_set|  # 波形描画などはしないので更新しない
    ##  window_set[Back].update   # 背景のスプライトを更新
    ##  window_set[Window].update # 文章のウィンドウを更新
    ##end
  end
  #--------------------------------------------------------------------------
  # ● ラインを追加する処理
  #--------------------------------------------------------------------------
  def add_line(text, line_index)
    window_index = nil
    @line_windows.each_index do |i| # 待機中のウィンドウを探索
      break window_index = i unless @line_windows[Text]
    end
    unless window_index # 待機中のウィンドウが存在しない場合
      @shift_lines[@line_windows.size] = false  # ハッシュにKeyを登録する
      @line_windows.push create_line_window_set # 新たにウィンドウを生成して追加
      window_index = @line_windows.size
    end
   
    # 表示中のリストに登録
    if line_index < line_number
      @exist_lines.insert(line_index, window_index) # 途中に挿入
    else
      line_index = line_number
      @exist_lines.push window_index                # 末尾に追加
    end
   
    # ラインの位置を設定
    set_line_window_x(window_index, add_line_start_x)
    set_line_window_y(window_index, line_position_y(line_index))
   
    # ラインの可視化と文章の描画
    @line_windows[window_index][Text] = text  # 描画する文章を記憶
    line_back(window_index).opacity   = 255   # 背景の透明度を初期化
    line_back(window_index).z         = 150   # z座標を初期化
    line_window(window_index).z       = 200   # z座標を初期化
    line_window(window_index).draw_text_ex(text_padding_x, text_padding_y, text) # 文章を描画
    line_window(window_index).contents_opacity = 255  # 文章の透明度を初期化
   
    # ラインの表示
    unless text.empty?  # 空文は表示しない
      line_back(window_index).visible   = true
      line_window(window_index).visible = true
      @entry_lines.push window_index  # 追加中のリストに登録
    end
   
    @change_lines = true  # ライン状態の変更を記憶
  end
  #--------------------------------------------------------------------------
  # ● ラインの消去を予約する処理
  #--------------------------------------------------------------------------
  def del_line(window_index)
    @death_sentence.push window_index # 消去を予約
    @change_lines = true  # ライン状態の変更を記憶
  end
  #--------------------------------------------------------------------------
  # ● ラインを消去中にする処理
  #--------------------------------------------------------------------------
  def execution(window_index)
    line_back(window_index).opacity            = del_opacity # 背景を半透明に
    line_window(window_index).contents_opacity = del_opacity # 文章を半透明に
    line_back(window_index).z   = 50  # 表示位置を奥に設定
    line_window(window_index).z = 100 # 表示位置を奥に設定
    @dying_lines.push window_index  # 消去中のリストに登録
    return true
  end
  #--------------------------------------------------------------------------
  # ● ラインを消去する処理
  #--------------------------------------------------------------------------
  def dead_line(window_index)
    @line_windows[window_index][Text] = nil   # 文章の記憶を初期化
    line_back(window_index).visible   = false # ラインの背景を非表示
    line_window(window_index).visible = false # ラインの文章を非表示
    line_window(window_index).contents.clear  # 文章のBitmapを初期化
  end
  #--------------------------------------------------------------------------
  # ● シフトするラインを探索
  #--------------------------------------------------------------------------
  def check_shift_line
    @change_lines = false # ライン状態の変更の記憶を初期化
    @exist_lines.each_index do |line_index|
      window_index = @exist_lines[line_index] # ウィンドウのインデックスを取得
      position_y   = line_position_y(line_index)    # 移動先を取得
      if position_y != line_window_y(window_index)  # 移動先が現在地以外
        @shift_lines[window_index] = position_y # 移動中のリストに登録
      elsif value = @shift_lines[window_index]  # 既に移動先が登録済
        @shift_lines[window_index] = false unless value == del_line_end_y # 消去シフト以外は解除
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● ラインを行数に従って定位置へ移動する処理
  #--------------------------------------------------------------------------
  def shift_line_process(window_index, position_y)
    line_y = line_window_y(window_index)
    if (line_y - position_y).abs >= now_speed
      slide_y = line_y < position_y ? now_speed : -now_speed
      add_line_window_y(window_index, slide_y)    # ウィンドウを移動
    else
      set_line_window_y(window_index, position_y) # ウィンドウの位置を設定
      @shift_lines[window_index] = false
      if position_y == del_line_end_y # 消去シフト移動の場合
        dead_line(window_index)           # ラインを消去
        @dying_lines.delete(window_index) # 消去中のリストから消去
        @entry_lines.delete(window_index) # 追加中のリストから消去
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 追加されたラインを画面内へ移動する処理
  #--------------------------------------------------------------------------
  def entry_line_process(index)
    window_index = @entry_lines[index]  # ウィンドウのインデックスを取得
    line_x = line_window_x(window_index)  # ラインのx座標を取得
    if (line_x - padding_x).abs >= add_speed
      slide_x = line_x < padding_x ? add_speed : -add_speed
      add_line_window_x(window_index, slide_x)    # ウィンドウを移動
    else
      set_line_window_x(window_index, padding_x)  # ウィンドウの位置を設定
      @entry_lines.delete_at(index) # 追加中のリストから消去
    end
  end
  #--------------------------------------------------------------------------
  # ● ラインを画面外へ移動させて消去する処理
  #--------------------------------------------------------------------------
  def dying_line_process(index)
    window_index = @dying_lines[index] # ウィンドウのインデックスを取得
    line_y = line_window_y(window_index)
    if (line_y - del_line_end_y).abs >= del_speed
      slide_y = line_y < del_line_end_y ? now_speed : -now_speed
      add_line_window_y(window_index, slide_y)  # ウィンドウを移動
    else
      dead_line(window_index)             # ラインを消去
      @dying_lines.delete_at(index)       # 消去中のリストから消去
      @entry_lines.delete(window_index)   # 追加中のリストから消去
      @shift_lines[window_index] = false  # 移動中のリストから消去
    end
  end
end

#==============================================================================
# ■ Window_MessageLine
#------------------------------------------------------------------------------
#  テキストを表示するスプライトのクラスです。スプライトもどき。
#==============================================================================
class Window_MessageLine < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super
    self.arrows_visible = false # カーソルは表示しない
    self.opacity        = 0     # 文字の描画以外は不要
  end
  #--------------------------------------------------------------------------
  # ● 標準パディングサイズの取得
  #--------------------------------------------------------------------------
  def standard_padding
    return 0                    # 余白を確保する必要はなし
  end
end


脚本2#==============================================================================
# ** 滚动战斗信息 v1.3
# ** by R_Valkyrie
#------------------------------------------------------------------------------
# Plug-n-Play.
# Free to use for non-commercial and commercial, just give credit to me.
#==============================================================================

#==============================================================================
# ** Settings
#==============================================================================

module SCROLLING_BATTLE_LOG

  LOG_X = 0          #战斗信息窗口x坐标
  
  LOG_Y = 0          #战斗信息窗口y坐标
  
  LOG_WIDTH = 544    #战斗信息窗口宽度
  
  LOG_HEIGHT = 6     #战斗信息窗口高度(有多少行)
                     
  LOG_OPACITY = 60   #不透明度
  
  LOG_SPEED = 60     #各个信息之间的等待时间.
  
  SCROLL_SPEED = 3   #滚动速度修正值,数值越小,速度越快. 设定为 0 代表瞬间滚动
  
  TEXT_ALIGNMENT = 0 #文字对齐方式.
                     # 0 = 右, 1 = 中, 2 = 左.

  USE_WINDOW = false #是否使用窗口替代横线.

end

#==============================================================================
# Don't edit anything below this line unless you know what you're doing.
#==============================================================================

#==============================================================================
# ** Window_BattleLog
#==============================================================================

class Window_BattleLog < Window_Selectable
  include SCROLLING_BATTLE_LOG
  def initialize
    super(LOG_X, LOG_Y, LOG_WIDTH, window_height)
    self.z = 200
    self.opacity = 0
    self.arrows_visible = false
    @lines = []
    @num_wait = 0
    create_back_bitmap
    create_back_sprite
    refresh
  end
  def max_line_number
    return 500
  end
  def clear
    self.oy = 0
    @lines.clear
    refresh
  end
  def back_one
    #
  end
  def add_text(text)
    if @lines.size > (LOG_HEIGHT - 1)
      distance = line_height
      speed = (SCROLL_SPEED == 0) ? line_height : SCROLL_SPEED
      until distance == 0 do
        self.oy += (distance < speed) ? distance : speed
        distance -= (distance < speed) ? distance : speed
        Graphics.update
      end
    end
    @lines.push(text)
    refresh
  end
  def refresh
    draw_background if @lines.size < (LOG_HEIGHT + 1)
    contents.clear
    @lines.size.times {|i| draw_line(i) }
  end
  def back_opacity
    USE_WINDOW ? 0 : LOG_OPACITY
  end
  def draw_line(line_number)
    rect = item_rect_for_text(line_number)
    contents.clear_rect(rect)
    text_width = LOG_WIDTH - (standard_padding * 2)
    ta = TEXT_ALIGNMENT
    wx = ta == 2 ? -2 : rect.x
    draw_text(wx, rect.y, text_width, line_height, @lines[line_number], ta)
  end
  def message_speed
    return LOG_SPEED
  end
  def wait_and_clear
    #
  end
  def display_current_state(subject)
    unless subject.most_important_state_text.empty?
      add_text(subject.name + subject.most_important_state_text)
      wait
    end
  end
  def display_action_results(target, item)
    if target.result.used
      display_critical(target, item)
      display_damage(target, item)
      display_affected_status(target, item)
      display_failure(target, item)
    end
  end
  def display_affected_status(target, item)
    if target.result.status_affected?
      display_changed_states(target)
      display_changed_buffs(target)
    end
  end
  def display_auto_affected_status(target)
    if target.result.status_affected?
      display_affected_status(target, nil)
    end
  end
  def display_added_states(target)
    target.result.added_state_objects.each do |state|
      state_msg = target.actor? ? state.message1 : state.message2
      target.perform_collapse_effect if state.id == target.death_state_id
      next if state_msg.empty?
      add_text(target.name + state_msg)
      wait
      wait_for_effect
    end
  end
  def display_removed_states(target)
    target.result.removed_state_objects.each do |state|
      next if state.message4.empty?
      add_text(target.name + state.message4)
      wait
    end
  end
  def display_buffs(target, buffs, fmt)
    buffs.each do |param_id|
      add_text(sprintf(fmt, target.name, Vocab::param(param_id)))
      wait
    end
  end
end

class Window_DummyLog < Window_BattleLog
  def max_line_number
    return LOG_HEIGHT
  end
  def add_text(text)
    #
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  include SCROLLING_BATTLE_LOG
  alias update_message_open_and_clear_log update_message_open
  def update_message_open
    if $game_message.busy?
      @log_window.clear
      @log_window.close
      @dummy_window.close
    end
    update_message_open_and_clear_log
  end
  alias create_all_windows_with_dummy create_all_windows
  def create_all_windows
    create_dummy_window
    create_all_windows_with_dummy
  end
  def create_dummy_window
    @dummy_window = Window_DummyLog.new
    @dummy_window.z = 199
    @dummy_window.openness = 0
    @dummy_window.opacity = 255
  end
  alias turn_start_with_dummy turn_start
  def turn_start
    @log_window.open
    @dummy_window.open if USE_WINDOW == true
    turn_start_with_dummy
  end
  def turn_end
    all_battle_members.each do |battler|
      battler.on_turn_end
      refresh_status
      @log_window.display_auto_affected_status(battler)
    end
    @log_window.clear
    @dummy_window.close
    BattleManager.turn_end
    process_event
    start_party_command_selection
  end
  def process_action
    return if scene_changing?
    if !@subject || !@subject.current_action
      @subject = BattleManager.next_subject
    end
    return turn_end unless @subject
    if @subject.current_action
      @subject.current_action.prepare
      if @subject.current_action.valid?
        @status_window.open
        @log_window.open
        @dummy_window.open if USE_WINDOW == true
        execute_action
      end
      @subject.remove_current_action
    end
    process_action_end unless @subject.current_action
  end
end

#==============================================================================
# End of script.
#==============================================================================
VA外站脚本汉化群:226308173   |    部分远古文件备份:https://wwzv.lanzoue.com/b02rac5pc  密码:acgm
回复

使用道具 举报

梦石
0
星屑
7
在线时间
11 小时
注册时间
2019-12-20
回帖
13
发表于 2019-12-20 22:48:44 | 显示全部楼层
感谢3楼的脚本 谢谢啦
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部