RMXP战斗解说

有没有类似《地球冒险》风格的战斗旁白脚本,适用于RMXP?我找到了这个论坛帖子,但链接似乎已经失效(Battle Narration

问题所在的那个网站位于一个早已停用的旧主机服务中,遗憾的是我也找不到它的任何踪迹。目前看来,似乎只能询问其他人是否因为某种原因在他们的硬盘上保留了该网站。

第二个选项是寻找另一个类似的网站,但我似乎也没能找到。有趣的是,我找到了另一个帖子,结果又指向了你发布的那个帖子…… :sweat_smile:

第三个选项是自己搭建一个,但我认为这恐怕不止需要5分钟。 :upside_down_face:

1 个赞

好的,我会继续寻找,但我也在尝试学习 Ruby,所以这可能是一个我需要自己实现的功能。

1 个赞

这是我 2020 年制作的一个脚本的不稳定版本,你可以随意修改。
这是一个战斗日志脚本,但我建议你再等一等,因为我目前正在编写一个脚本包,旨在重现《地球冒险》(EarthBound)中的大部分系统。
我正在重新利用 Cap’n Coco Charm 很久以前在 Starmen.net 上发布的一些脚本。总之,我可以考虑开发一个更完整的版本,但目前我先发给你这个,你可以随意修改。

#==============================================================================
# ** Moveto 的战斗日志 1.0 - 2020/10/28 **
#
#-------------------------------------------------
#  这个版本不太稳定,它是为一个被放弃的项目
#  创建的,但它可以正常工作——尽管尚未经过审查。
#==============================================================================

module MVBLSYS

  #-------
  # 配置
  #-------

  # 日志窗口位置
  X = 8
  Y = 8

  # 日志区域大小
  WIDTH  = 624
  HEIGHT = 82

  # 行数
  MAX_LINES = 4

  # 字体大小
  FONT_SIZE = 20

  # 打字速度
  # 1 = 更快
  # 2 = 正常
  # 3 = 慢速
  LETTER_SPEED = 2

  # 行间距
  LINE_HEIGHT = 20

  # 消息显示完毕后在屏幕上停留的时间
  MESSAGE_WAIT = 35

  #-------------
  # * 创建日志
  #-------------
  def self.create
    dispose

    @sprite = Sprite.new
    @sprite.x = X
    @sprite.y = Y
    @sprite.z = 9999

    @bitmap = Bitmap.new(WIDTH, HEIGHT)
    @sprite.bitmap = @bitmap

    @messages = []
    @current_text = ""
    @display_text = ""
    @text_index = 0
    @wait = 0
    @active = true

    refresh
  end

  #---------
  # * 更新
  #---------
  def self.update
    return if @sprite == nil
    return if @bitmap == nil

    # 如果没有正在输入的消息
    if @current_text == nil or @current_text == ""
      return
    end

    # 等待继续
    if @wait > 0
      @wait -= 1
      return
    end

    # 输入消息
    if @text_index < @current_text.length

      if Graphics.frame_count % LETTER_SPEED == 0
        @text_index += 1
        @display_text = @current_text[0, @text_index]
        refresh
      end

    else
      # 消息结束
      @wait = MESSAGE_WAIT
    end
  end

  #--------------
  # * 添加消息
  #--------------
  def self.add(text)
    return if text == nil

    text = text.to_s

    @messages = [] if @messages == nil

    @messages.push(text)

    while @messages.size > MAX_LINES
      @messages.shift
    end

    @current_text = text
    @display_text = ""
    @text_index = 0
    @wait = 0

    refresh
  end

  #---------------
  # * 显示消息
  #---------------
  def self.message(text)
    add(text)
  end

  #----------------------
  # * 更新绘图
  #----------------------
  def self.refresh
    return if @bitmap == nil

    @bitmap.clear

    # 日志背景
    @bitmap.fill_rect(
      0,
      0,
      WIDTH,
      HEIGHT,
      Color.new(0, 0, 0, 180)
    )

    # 边框
    border = Color.new(255, 255, 255, 255)

    @bitmap.fill_rect(0, 0, WIDTH, 2, border)
    @bitmap.fill_rect(0, HEIGHT - 2, WIDTH, 2, border)
    @bitmap.fill_rect(0, 0, 2, HEIGHT, border)
    @bitmap.fill_rect(WIDTH - 2, 0, 2, HEIGHT, border)

    # 字体
    @bitmap.font.name = "Arial"
    @bitmap.font.size = FONT_SIZE
    @bitmap.font.bold = false
    @bitmap.font.italic = false
    @bitmap.font.color = Color.new(255, 255, 255, 255)

    #------------------------
    # 绘制之前的消息
    #------------------------
    if @messages != nil

      count = @messages.size

      # 最后一条消息将被当前正在输入的版本替换
      if count > 0
        last_index = count - 1
      else
        last_index = -1
      end

      y = 5

      for i in 0...count

        text = @messages[i]

        # 如果是当前消息,使用已输入的版本
        if i == last_index and
           @current_text != nil and
           @current_text != ""

          text = @display_text
        end

        @bitmap.draw_text(
          10,
          y,
          WIDTH - 20,
          LINE_HEIGHT,
          text,
          0
        )

        y += LINE_HEIGHT
      end
    end
  end

  #----------------------
  # * 检查是否存在
  #----------------------
  def self.exist?
    return false if @sprite == nil
    return false if @bitmap == nil
    return true
  end

  #----------
  # * 清除
  #----------
  def self.clear
    @messages = []
    @current_text = ""
    @display_text = ""
    @text_index = 0
    @wait = 0

    refresh
  end

  #-----------------
  # * 移除日志
  #-----------------
  def self.dispose
    if @sprite != nil
      @sprite.bitmap = nil
      @sprite.dispose
      @sprite = nil
    end

    if @bitmap != nil
      @bitmap.dispose
      @bitmap = nil
    end

    @messages = []
    @current_text = ""
    @display_text = ""
    @text_index = 0
    @wait = 0
  end
end


#==============================================================================
# ** 战斗场景 (Scene_Battle)
#==============================================================================

class Scene_Battle

  #------------------
  # * 主处理
  #------------------
  alias mvbl_battle_log_main main

  def main

    # 在战斗开始前创建日志。
    MVBLSYS.create

    # 初始消息
    MVBLSYS.add("战斗开始了!")

    # 运行原始的 Scene_Battle
    mvbl_battle_log_main

    # 清理
    MVBLSYS.dispose
  end

  #--------------------------------------------------------------------------
  # * 帧更新
  #--------------------------------------------------------------------------
  alias mvbl_battle_log_update update

  def update

    # 更新原始战斗系统
    mvbl_battle_log_update

    # 更新日志
    MVBLSYS.update
  end

  #-------------
  # * 结束战斗
  #-------------
  alias mvbl_battle_log_battle_end battle_end

  def battle_end(result)

    MVBLSYS.dispose

    mvbl_battle_log_battle_end(result)
  end

  #---------------
  # * 基本动作
  #---------------
  alias mvbl_battle_log_basic_action make_basic_action_result

  def make_basic_action_result

    # 在执行动作前保存攻击者
    battler = @active_battler

    # 执行原始动作
    mvbl_battle_log_basic_action

    # 如果战斗者不存在
    return if battler == nil

    # 普通攻击
    if battler.current_action.basic == 0

      name = battler.name

      if name == nil or name == ""
        name = "敌人"
      end

      MVBLSYS.add(name + " 发动了攻击!")

      # 结果
      if @target_battlers != nil

        for target in @target_battlers

          next if target == nil

          if target.damage == "Miss"

            MVBLSYS.add("Miss!")

          elsif target.damage.is_a?(Numeric)

            if target.critical
              MVBLSYS.add("暴击!")
            end

            if target.damage < 0
              MVBLSYS.add(
                target.name + " 恢复了 " +
                (-target.damage).to_s + " HP!"
              )
            else
              MVBLSYS.add(
                target.name + " 受到 " +
                target.damage.to_s + " 点伤害!"
              )
            end
          end

          if target.hp <= 0
            MVBLSYS.add(target.name + " 倒下了!")
          end
        end
      end
    end
  end

  #---------------
  # * 技能动作
  #---------------
  alias mvbl_battle_log_skill_action make_skill_action_result

  def make_skill_action_result

    battler = @active_battler

    # 保存技能
    skill_id = nil

    if battler != nil
      skill_id = battler.current_action.skill_id
    end

    skill = nil

    if skill_id != nil
      skill = $data_skills[skill_id]
    end

    # 执行原始动作
    mvbl_battle_log_skill_action

    return if battler == nil
    return if skill == nil

    name = battler.name

    if name == nil or name == ""
      name = "敌人"
    end

    MVBLSYS.add(
      name + " 使用了 " + skill.name + "!"
    )

    # 结果
    if @target_battlers != nil

      for target in @target_battlers

        next if target == nil

        if target.damage == "Miss"

          MVBLSYS.add("Miss!")

        elsif target.damage.is_a?(Numeric)

          if target.critical
            MVBLSYS.add("暴击!")
          end

          if target.damage < 0

            MVBLSYS.add(
              target.name + " 恢复了 " +
              (-target.damage).to_s + " HP!"
            )

          elsif target.damage > 0

            MVBLSYS.add(
              target.name + " 受到 " +
              target.damage.to_s + " 点伤害!"
            )
          end
        end

        if target.hp <= 0
          MVBLSYS.add(target.name + " 倒下了!")
        end
      end
    end
  end

  #--------------------------------------------------------------------------
  # * 物品动作
  #--------------------------------------------------------------------------
  alias mvbl_battle_log_item_action make_item_action_result

  def make_item_action_result

    battler = @active_battler

    item_id = nil

    if battler != nil
      item_id = battler.current_action.item_id
    end

    item = nil

    if item_id != nil
      item = $data_items[item_id]
    end

    # 执行原始动作
    mvbl_battle_log_item_action

    return if battler == nil
    return if item == nil

    name = battler.name

    if name == nil or name == ""
      name = "敌人"
    end

    MVBLSYS.add(
      name + " 使用了 " + item.name + "!"
    )

    # 结果
    if @target_battlers != nil

      for target in @target_battlers

        next if target == nil

        if target.damage == "Miss"

          MVBLSYS.add("没有效果...")

        elsif target.damage.is_a?(Numeric)

          if target.damage < 0

            MVBLSYS.add(
              target.name + " 恢复了 " +
              (-target.damage).to_s + " HP!"
            )

          elsif target.damage > 0

            MVBLSYS.add(
              target.name + " 受到 " +
              target.damage.to_s + " 点伤害!"
            )
          end
        end

        if target.hp <= 0
          MVBLSYS.add(target.name + " 倒下了!")
        end
      end
    end
  end

end


#==============================================================================
# ** 游戏临时变量 (Game_Temp)
#------------------------------------------------------------------------------
#  允许通过事件调用日志。
#
#  示例:
#
#  $game_temp.battle_log("敌人看起来非常愤怒!")
#==============================================================================

class Game_Temp

  def battle_log(text)
    MVBLSYS.add(text)
  end

end

我还有一个旧的《地球冒险》“可可船长魅力起始包”项目;它相当不完整,但它是 RPG Maker XP 中最接近《地球冒险》的东西。我可以把项目发给你,因为可能只有我还保留着它。