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

Project1

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

只显示活跃人状态的脚本战斗测试时脚本错误

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1 小时
注册时间
2007-7-28
帖子
17
跳转到指定楼层
1
发表于 2007-7-29 07:04:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
如题,还有,从头开始测试时不会有这个问题

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1 小时
注册时间
2007-7-28
帖子
17
2
 楼主| 发表于 2007-7-29 07:04:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
如题,还有,从头开始测试时不会有这个问题
头像被屏蔽

Lv1.梦旅人 (禁止发言)

圣魔

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-1-12
帖子
3395
3
发表于 2007-7-29 08:48:15 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

精灵族の天使

梦石
0
星屑
1712
在线时间
3039 小时
注册时间
2007-3-16
帖子
33731

开拓者贵宾

4
发表于 2007-7-29 14:09:31 | 只看该作者
PS一句:如果有必要的话,请上传范例工程。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1 小时
注册时间
2007-7-28
帖子
17
5
 楼主| 发表于 2007-7-29 17:12:05 | 只看该作者
脚本内容
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● HPメーター の描画
  #--------------------------------------------------------------------------
  def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
    w = width * actor.hp / [actor.maxhp,1].max
    hp_color_1 = Color.new(255, 0, 0, 192)
    hp_color_2 = Color.new(255, 255, 0, 192)
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
    x -= 1
    y += (height/4).floor
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
    x -= 1
    y += (height/4).ceil
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
    x -= 1
    y += (height/4).ceil
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  end
  #--------------------------------------------------------------------------
  # ● SPメーター の描画
  #--------------------------------------------------------------------------
  def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
    w = width * actor.sp / [actor.maxsp,1].max
    hp_color_1 = Color.new( 0, 0, 255, 192)
    hp_color_2 = Color.new( 0, 255, 255, 192)
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
    x -= 1
    y += (height/4).floor
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
    x -= 1
    y += (height/4).ceil
    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
    x -= 1
    y += (height/4).ceil
    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  end
  #--------------------------------------------------------------------------
  # ● 名前の描画
  #--------------------------------------------------------------------------
  alias xrxs_bp7_draw_actor_name draw_actor_name
  def draw_actor_name(actor, x, y)
    xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
  end
  #--------------------------------------------------------------------------
  # ● ステートの描画
  #--------------------------------------------------------------------------
  alias xrxs_bp7_draw_actor_state draw_actor_state
  def draw_actor_state(actor, x, y, width = 120)
    xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
  end
  #--------------------------------------------------------------------------
  # ● HP の描画
  #--------------------------------------------------------------------------
  alias xrxs_bp7_draw_actor_hp draw_actor_hp
  def draw_actor_hp(actor, x, y, width = 144)
    xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
  end
  #--------------------------------------------------------------------------
  # ● SP の描画
  #--------------------------------------------------------------------------
  alias xrxs_bp7_draw_actor_sp draw_actor_sp
  def draw_actor_sp(actor, x, y, width = 144)
    xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
  end
end
#==============================================================================
# ◇ 外部ライブラリ
#==============================================================================
class Window_Base
  #--------------------------------------------------------------------------
  # ● ライン描画 軽量版 by 桜雅 在土
  #--------------------------------------------------------------------------
  def draw_lineght(start_x, start_y, end_x, end_y, start_color)
    # 描写距離の計算。大きめに直角時の長さ。
    distance = (start_x - end_x).abs + (start_y - end_y).abs
    # 描写開始
    for i in 1..distance
      x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
      y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
      self.contents.set_pixel(x, y, start_color)
    end
  end
  #--------------------------------------------------------------------------
  # ● ライン描画 by 桜雅 在土
  #--------------------------------------------------------------------------
  def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
    # 描写距離の計算。大きめに直角時の長さ。
    distance = (start_x - end_x).abs + (start_y - end_y).abs
    # 描写開始
    if end_color == start_color
      for i in 1..distance
        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
        if width == 1
          self.contents.set_pixel(x, y, start_color)
        else
          self.contents.fill_rect(x, y, width, width, start_color)
        end
      end
    else
      for i in 1..distance
        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
        r = start_color.red * (distance-i)/distance + end_color.red * i/distance
        g = start_color.green * (distance-i)/distance + end_color.green * i/distance
        b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
        a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
        if width == 1
          self.contents.set_pixel(x, y, Color.new(r, g, b, a))
        else
          self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
        end
      end
    end
  end
end


#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
#  显示战斗画面同伴状态的窗口。
#==============================================================================
class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(0, 320, 160, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    @level_up_flags = [false, false, false, false]
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
155   actor = $game_party.actors[$status_window_contents]
    actor_x = 21
    self.contents.font.size = 18
    draw_actor_name(actor, 4, 0)
      # 歩行キャラグラフィックの描写
      draw_actor_graphic(actor, actor_x - 9, 116)
      # HP/SPメーターの描写
      draw_actor_hp_meter_line(actor, actor_x, 52, 96, 12)
      draw_actor_sp_meter_line(actor, actor_x, 84, 96, 12)
      # HP数値の描写
      self.contents.font.color = Color.new(0,0,0,192)
      self.contents.draw_text(actor_x, 40, 96, 24, actor.hp.to_s, 2)
      self.contents.font.color = actor.hp == 0 ? knockout_color :
      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
      self.contents.draw_text(actor_x-2, 38, 96, 24, actor.hp.to_s, 2)
      # SP数値の描写
      self.contents.font.color = Color.new(0,0,0,192)
      self.contents.draw_text(actor_x, 72, 96, 24, actor.sp.to_s, 2)
      self.contents.font.color = actor.sp == 0 ? knockout_color :
      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
      self.contents.draw_text(actor_x-2, 70, 96, 24, actor.sp.to_s, 2)
      # 用語「HP」と用語「SP」の描写
      self.contents.font.size = 18 # 用語「HP/SP」の文字の大きさ
      self.contents.font.color = Color.new(0,0,0,192)
      self.contents.draw_text(actor_x+2, 32, 196, 24, $data_system.words.hp)
      self.contents.draw_text(actor_x+2, 64, 196, 24, $data_system.words.sp)
      self.contents.font.color = system_color # 用語「HP/SP」の文字の色
      self.contents.draw_text(actor_x, 30, 196, 24, $data_system.words.hp)
      self.contents.draw_text(actor_x, 62, 196, 24, $data_system.words.sp)
      # ステートの描写
      draw_actor_state(actor, actor_x, 100)
      # 値を更新
  end
end

#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
#  处理地图画面的类。
#==============================================================================

class Scene_Map
  #--------------------------------------------------------------------------
  # ● 调用战斗
  #--------------------------------------------------------------------------
  alias call_new call_battle
  def call_battle
    call_new
    $status_window_contents = 0
  end
end

#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
#  处理战斗画面的类。
#==============================================================================
class Scene_Battle  
  #--------------------------------------------------------------------------
  # ● 设置角色指令窗口
  #--------------------------------------------------------------------------
  alias:phase3_setup_command_window_2:phase3_setup_command_window
  def phase3_setup_command_window
    phase3_setup_command_window_2
    # 设置角色指令窗口的位置
    @actor_command_window.x = 0
  end   
  #--------------------------------------------------------------------------
  # ● 开始同伴命令回合
  #--------------------------------------------------------------------------
  alias start_phase2_2 start_phase2
  def start_phase2
    $status_window_contents = 0
    @status_window.refresh
    start_phase2_2
  end
  #--------------------------------------------------------------------------
  # ● 转到输入下一个角色的命令
  #--------------------------------------------------------------------------
  def phase3_next_actor
    if @actor_index > -1 and @actor_index < $game_party.actors.size - 1
      $status_window_contents = @actor_index + 1
      @status_window.refresh
    end
    # 循环
    begin
      # 角色的明灭效果 OFF
      if @active_battler != nil
        @active_battler.blink = false
      end
      # 最后的角色的情况
      if @actor_index == $game_party.actors.size - 1
        # 开始主回合
        start_phase4
        return
      end
      # 推进角色索引
      @actor_index += 1
      @active_battler = $game_party.actors[@actor_index]
      @active_battler.blink = true
    # 如果角色是在无法接受指令的状态就再试
    end until @active_battler.inputable?
    # 设置角色的命令窗口
    phase3_setup_command_window
  end
  #--------------------------------------------------------------------------
  # ● 转向前一个角色的命令输入
  #--------------------------------------------------------------------------
  def phase3_prior_actor
    if @actor_index > 0
      $status_window_contents = @actor_index - 1
      @status_window.refresh
    end
    # 循环
    begin
      # 角色的明灭效果 OFF
      if @active_battler != nil
        @active_battler.blink = false
      end
      # 最初的角色的情况下
      if @actor_index == 0
        # 开始同伴指令回合
        start_phase2
        return
      end
      # 返回角色索引
      @actor_index -= 1
      @active_battler = $game_party.actors[@actor_index]
      @active_battler.blink = true
    # 如果角色是在无法接受指令的状态就再试
    end until @active_battler.inputable?
    # 设置角色的命令窗口
    phase3_setup_command_window
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (主回合步骤 1 : 准备行动)
  #--------------------------------------------------------------------------
  def update_phase4_step1
    # 隐藏帮助窗口
    @help_window.visible = false
    # 判定胜败
    if judge
      # 胜利或者失败的情况下 : 过程结束
      return
    end
    # 强制行动的战斗者不存在的情况下
    if $game_temp.forcing_battler == nil
      # 设置战斗事件
      setup_battle_event
      # 执行战斗事件中的情况下
      if $game_system.battle_interpreter.running?
        return
      end
    end
    # 强制行动的战斗者存在的情况下
    if $game_temp.forcing_battler != nil
      # 在头部添加后移动
      @action_battlers.delete($game_temp.forcing_battler)
      @action_battlers.unshift($game_temp.forcing_battler)
    end
    # 未行动的战斗者不存在的情况下 (全员已经行动)
    if @action_battlers.size == 0
      # 开始同伴命令回合
      start_phase2
      return
    end
    # 初始化动画 ID 和公共事件 ID
    @animation1_id = 0
    @animation2_id = 0
    @common_event_id = 0
    # 未行动的战斗者移动到序列的头部
    @active_battler = @action_battlers.shift
    # 如果已经在战斗之外的情况下
    if @active_battler.index == nil
      return
    end
    # 连续伤害
    if @active_battler.hp > 0 and @active_battler.slip_damage?
      @active_battler.slip_damage_effect
      @active_battler.damage_pop = true
    end
    # 自然解除状态
    @active_battler.remove_states_auto
    if @active_battler.is_a?(Game_Actor)
      $status_window_contents = @active_battler.index
    end
    # 刷新状态窗口
    @status_window.refresh
    # 移至步骤 2
    @phase4_step = 2
  end
end


正常从头测试时没有问题,但如果用战斗测试的话就显示脚本错误
155行TypeError
no implicit conversion fron nil to imteger
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1 小时
注册时间
2007-7-28
帖子
17
6
 楼主| 发表于 2007-7-29 17:13:50 | 只看该作者
我还使用了物品获得后自动显示的脚本
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-2 00:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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