查看: 1473|回复: 2

[已经解决] 請高手看配點腳本哪裡錯誤(已解決)

[复制链接]
梦石
0
星屑
50
在线时间
163 小时
注册时间
2012-3-3
回帖
36
发表于 2012-11-10 09:42:42 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 米血 于 2012-11-10 15:15 编辑

原本只有5種配點
我想要新增成6個配點值   "增加体力"."增加魔力","增加atk "."增加def "."增加agi "."增加spi"
於是就自己修改看看
但是一直有毛病
請高手幫忙看一下哪裡錯誤
謝謝


[pre lang="ruby" line="1"]#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

# 脚本使用设定:

LEVEL_UP_POINT = 2  # 每升一级所增加的点数
LEVEL_UP_VARIABLE = 100  # 储存角色点数的变量编号与角色id编号的差值
                         # 默认情况 = 100,
                         # 则是数据库里1号角色的加点数存于101号变量
                         # 3号角色的加点数存于103号变量。
                         # 你可以直接操作变量赠与角色可分配点数

# 每增加一次点数,各项能力值的变化:357-410行
                        
# 使用方法介绍:

# 本脚本不会取代原来的升级自动加点 也就是说,默认的升级还在,但可以用这个功能手动追加点数。
# 如果你想纯粹使用手动加点(而升级不提升能力),只要把数据库中角色升级能力,
# 1-99级全部等于一个相同数值就行了。

# 呼唤加点场景的方法:$scene = Scene_Lvup.new(角色编号,返回菜单编号)。
# 默认都是0号

# 加点场景中,page up,page down换人,如果想加点完毕后返回地图,
# 464行$scene = Scene_Menu.new(0)改为$scene = Scene_Map.new

# 推荐脚本搭配:魔法商店脚本,两者结合,制作自由型RPG

#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
#  一般的命令选择行窗口。(追加定义)
#==============================================================================
class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 项目有效化
  #     index : 项目编号
  #--------------------------------------------------------------------------
  def able_item(index)
    draw_item(index, normal_color)
  end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
#  处理角色的类。(再定义)
#==============================================================================

class Game_Actor < Game_Battler
  def level_up
    @level += 1
    $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
    for learning in self.class.learnings
      learn_skill(learning.skill_id) if learning.level == @level
    end
  end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  游戏中全部窗口的超级类(追加定义)
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● 描绘 HP
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     width : 描画目标的宽
  #--------------------------------------------------------------------------
  def draw_actor_hp_lvup(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x , y, 96, 32, "最大" + Vocab::hp)
    if $temp_hp == 0
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 120 , y, 48, 32, actor.maxhp.to_s, 2)
    else
      maxhp = actor.maxhp + $temp_hp
      self.contents.font.color = Color.new(255, 128, 128, 255)
      self.contents.draw_text(x + 120 , y, 48, 32, maxhp.to_s ,2)
      self.contents.font.color = normal_color      
      self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
      if $temp_hp >=0
        self.contents.font.color = Color.new(255, 128, 128, 255)
        self.contents.draw_text(x + 155, y, 36, 32, " +",2)
      else
        self.contents.font.color = Color.new(255,255,0,255)
        self.contents.draw_text(x + 155, y, 36, 32, " -",2)
      end
      self.contents.draw_text(x + 200, y, 36, 32, $temp_hp.to_s, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
    end
  end
  #--------------------------------------------------------------------------
  # ● 描绘 MP
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     width : 描画目标的宽
  #--------------------------------------------------------------------------
  def draw_actor_mp_lvup(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x , y, 96, 32, "最大" + Vocab::mp)
    if $temp_mp == 0
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 120 , y, 48, 32, actor.maxmp.to_s, 2)
    else
      maxmp = actor.maxmp + $temp_mp
      self.contents.font.color = Color.new(255, 128, 128, 255)
      self.contents.draw_text(x + 120 , y, 48, 32, maxmp.to_s ,2)
      self.contents.font.color = normal_color      
      self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
      if $temp_mp >=0
        self.contents.font.color = Color.new(255, 128, 128, 255)
        self.contents.draw_text(x + 155, y, 36, 32, " +",2)
      else
        self.contents.font.color = Color.new(255,255,0,255)
        self.contents.draw_text(x + 155, y, 36, 32, " -",2)
      end
      self.contents.draw_text(x + 200, y, 36, 32, $temp_mp.to_s, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
    end
  end
  #--------------------------------------------------------------------------
  # ● 描绘能力值
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     type  : 能力值种类 (0~4)
  #--------------------------------------------------------------------------
  def draw_actor_lvup(actor, x, y, type)   
    # 定义数字颜色
    lvup = normal_color
    upcolor = Color.new(255, 128, 128, 255)
    self.contents.font.color = normal_color   
    case type
    when 0
      parameter_name = Vocab::atk
      parameter_value = actor.atk
      parameter_value_temp = parameter_value + $temp_atk
      if $temp_atk != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_atk >= 0
          self.contents.font.color = lvup
          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
        else
          self.contents.font.color = Color.new(255,255,0,255)
          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
        end        
        self.contents.draw_text(x + 272, y, 80, 32, $temp_atk.abs.to_s,1)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
      end
    when 1
      parameter_name = Vocab::def
      parameter_value = actor.def
      parameter_value_temp = parameter_value + $temp_def
      if $temp_def != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_def >= 0
          self.contents.font.color = lvup
          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
        else
          self.contents.font.color = Color.new(255,255,0,255)
          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
        end        
        self.contents.draw_text(x + 272, y, 80, 32, $temp_def.abs.to_s,1)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
      end
    when 2
      parameter_name = Vocab::agi
      parameter_value = actor.agi
      parameter_value_temp = parameter_value + $temp_agi
      if $temp_agi != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_agi >= 0
          self.contents.font.color = lvup
          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
        else
          self.contents.font.color = Color.new(255,255,0,255)
          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
        end        
        self.contents.draw_text(x + 272, y, 80, 32, $temp_agi.abs.to_s,1)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
      end
    when 3
      parameter_name = Vocab::spi
      parameter_value = actor.spi
      parameter_value_temp = parameter_value + $temp_spi
      if $temp_spi != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_spi >= 0
          self.contents.font.color = lvup
          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
        else
          self.contents.font.color = Color.new(255,255,0,255)
          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
        end        
        self.contents.draw_text(x + 272, y, 80, 32, $temp_spi.abs.to_s,1)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
      end
    when 4
      parameter_name = "剩余点数"
      parameter_value = $point
      if $point != 0
        lvup = upcolor
      end
    end   
    self.contents.font.size = 16 if type == 4
    self.contents.font.color = system_color
    if type != 4 then
      self.contents.draw_text(x, y, 120, 32, parameter_name)
    else
      self.contents.draw_text(x, y, 120, 24, parameter_name)
    end
    self.contents.font.color = normal_color
    if type != 4
      self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s)   
    else
      self.contents.draw_text(x + 68, y, 36, 24, parameter_value.to_s)   
    end
    if type != 4
      self.contents.draw_text(x + 150, y, 36, 32, "→")
    end  
    self.contents.font.color = lvup
    self.contents.draw_text(x + 180, y, 60, 32, parameter_value_temp.to_s)
    self.contents.font.color = normal_color        
  end
end

class Window_Lvpoint < Window_Base
  def initialize
    super(0,198,128,58)
    refresh
  end
  def refresh
    self.contents.clear
    draw_actor_lvup(@actor, 0, 0, 4)
  end
end
#==============================================================================
# ■ Window_lvup
#------------------------------------------------------------------------------
#  显示升级状态窗口。
#==============================================================================
class Window_Lvup < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     actor : 角色
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 0, 416, 256)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end  
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_graphic(@actor, 30, 80)
    draw_actor_name(@actor, 4, 0)
    draw_actor_class(@actor, 96, 0)
    draw_actor_level(@actor, 224, 0)
    draw_actor_state(@actor, 96, 32)   
    draw_actor_hp_lvup(@actor, 96, 32)
    draw_actor_mp_lvup(@actor, 96, 64)
    draw_actor_lvup(@actor, 4, 96, 0)
    draw_actor_lvup(@actor, 4, 128, 1)
    draw_actor_lvup(@actor, 4, 160, 2)
    draw_actor_lvup(@actor, 4, 192, 3)
  end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
#  特技及物品的说明、角色的状态显示的窗口。
#==============================================================================
class Window_Lvup_Help < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(0, 256, 544, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    @test = "" #——这个东西用来检测,节约内存专用
  end  
  #--------------------------------------------------------------------------
  # ● 设置文本
  #--------------------------------------------------------------------------
  def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil)
    if @test != text1
      @test = text1
    else
      return
    end   
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, self.width - 40, 32, text1)
    if text2 != nil
      self.contents.draw_text(4 , 32, self.width - 40, 32, text2)
    end
    self.contents.font.size -= 4
    if text3 != nil
      self.contents.draw_text(4 , 64, self.width - 40, 32, text3)
    end
    if text4 != nil
      self.contents.draw_text(4 , 96, self.width - 40, 32, text4)
    end
    self.contents.font.size += 4
  end
end
#==============================================================================
# ■ Scene_lvup
#------------------------------------------------------------------------------
#  处理升级画面的类。
#==============================================================================
class Scene_Lvup
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     actor_index : 角色索引
  #     menu_index : 选项起始位置
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0 , menu_index = 0)
    @actor_index = actor_index
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # ● 主处理
  #--------------------------------------------------------------------------
  def main
    s1 = "增加体力"
    s2 = "增加魔力"
    s3 = "增加"+Vocab::atk
    s4 = "增加"+Vocab::def
    s5 = "增加"+Vocab::agi
    s6 = "增加"+Vocab::spi
    s7 = "确认加点"
    s8 = "点数重置"
    @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7, s8])
    @command_window.index = @menu_index
    # 获取角色
    @actor = $game_party.members[@actor_index]
    # 将角色的剩余点数带入
    $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
    # 初始化临时量
    $temp_atk = 0
    $temp_def = 0
    $temp_agi = 0
    $temp_spi = 0
    $temp_hp = 0
    $temp_mp = 0
    #=========================================================================
    # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
    #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
    #=========================================================================
    # 每提升一次力量,提升多少附加能力
    #=========================================================================
    @atk_hp = 2     # 每提升一次力量附加提升多少HP
    @atk_mp = 1     # 每提升一次力量附加提升多少MP
    @atk_def = 0    # 每提升一次力量附加提升多少防御
    @atk_agi = 0    # 每提升一次力量附加提升多少速度
    @atk_spi = 0    # 每提升一次力量附加提升多少魔力
    @atk_atk = 2    # 每提升一次力量附加提升多少力量
    #=========================================================================
    # 每提升一次防御,提升多少附加能力
    #=========================================================================
    @def_hp = 2     # 每提升一次灵巧附加提升多少HP
    @def_mp = 1     # 每提升一次灵巧附加提升多少MP
    @def_atk = 0    # 每提升一次灵巧附加提升多少力量
    @def_agi = 0    # 每提升一次灵巧附加提升多少速度
    @def_spi = 0    # 每提升一次灵巧附加提升多少魔力
    @def_def = 2    # 每提升一次灵巧附加提升多少防御
    #=========================================================================
    # 每提升一次速度,提升多少附加能力
    #=========================================================================
    @agi_hp = 1     # 每提升一次速度附加提升多少HP
    @agi_mp = 2     # 每提升一次速度附加提升多少MP
    @agi_atk = 0    # 每提升一次速度附加提升多少力量
    @agi_def = 0    # 每提升一次速度附加提升多少防御
    @agi_spi = 0    # 每提升一次速度附加提升多少魔力
    @agi_agi = 2    # 每提升一次速度附加提升多少速度
    #=========================================================================
    # 每提升一次魔力,提升多少附加能力
    #=========================================================================
    @spi_hp = 1     # 每提升一次魔力附加提升多少HP
    @spi_mp = 2    # 每提升一次魔力附加提升多少MP
    @spi_atk = 0   # 每提升一次魔力附加提升多少力量
    @spi_def = 0   # 每提升一次魔力附加提升多少防御
    @spi_agi = 0   # 每提升一次魔力附加提升多少速度
    @spi_spi = 2   # 每提升一次魔力附加提升多少魔力
    #=========================================================================
    # 每提升一次体力,提升多少附加能力
    #=========================================================================
    @hp = 10       # 每提升一次体力提升多少HP
    @mp = 1       # 每提升一次体力提升多少MP
    @hp_atk = 0   # 每提升一次体力提升多少力量
    @hp_def = 0   # 每提升一次体力提升多少速度
    @hp_agi = 0   # 每提升一次体力提升多少灵巧
    @hp_spi = 0   # 每提升一次体力提升多少魔力   
    #=========================================================================
    # 每提升一次魔力,提升多少附加能力
    #=========================================================================
    @mp = 1       # 每提升一次体力提升多少HP
    @mp = 10       # 每提升一次体力提升多少MP
    @mp_atk = 0   # 每提升一次体力提升多少力量
    @mp_def = 0   # 每提升一次体力提升多少速度
    @mp_agi = 0   # 每提升一次体力提升多少灵巧
    @mp_spi = 0   # 每提升一次体力提升多少魔力  
    # 定义说明文字
    @text_hp_sc = "体力可以增加生存的能力,可以延长生存的时间!"
    @text_mp_sc = "体力可以增加生存的魔力,可以延长生存的时间!"
    @text_atk_sc = Vocab::atk + "可以增加物理攻击和物理技能的威力!"
    @text_def_sc = Vocab::def + "可以提高物理防御能力!"
    @text_agi_sc = Vocab::agi + "可以提高回避、命中、逃跑成功率!"
    @text_spi_sc = Vocab::spi + "可以提高吟唱魔法的威力!"
    @text_save = "保存分配情况并返回游戏"
    @text_reset= "重新分配能力点数"
    @text_2 = "每增加一次此项能力值,可以提升能力值"
    @text_hp = "最大" + Vocab::hp + "值"
    @text_mp = "最大" + Vocab::mp + "值"
    @text_atk = "最大" + Vocab::atk + "值"
    @text_def = "最大" + Vocab::def + "值"
    @text_agi = "最大" + Vocab::agi + "值"
    @text_spi = "最大" + Vocab::spi + "值"
    s_disable
    # 生成状态窗口
    @lvup_window = Window_Lvup.new(@actor)
    @lvup_window.x = 128
    @lvup_window.y = 0   
    @lvpoint_window = Window_Lvpoint.new
    # 生成帮助窗口并初始化帮助文本
    @help_window = Window_Lvup_Help.new   
    # 执行过渡
    Graphics.transition
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入信息
      Input.update
      # 刷新画面
      update
      # 如果切换画面就中断循环
      if $scene != self
        break
      end
    end
    # 准备过渡
    Graphics.freeze
    # 释放窗口
    @lvpoint_window.dispose
    @command_window.dispose
    @lvup_window.dispose
    @help_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    # 刷新窗口
    @command_window.update
    # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
    s_disable
    @lvup_window.update
    #=============================================================
    # 按下 B 键的情况下
    #=============================================================
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      Sound.play_cancel
      # 切换到地图画面
      $scene = Scene_Map.new
      return
    end
    #=============================================================
    # 按下 C 键的情况下
    #=============================================================
    if Input.trigger?(Input::C)      
      if @command_window.index == 6
          # 演奏确定 SE
        Sound.play_decision
        # 将角色的剩余点数带回
        $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
        # 将角色点数实际加上
        @actor.atk += $temp_atk
        @actor.def += $temp_def
        @actor.agi += $temp_agi
        @actor.spi += $temp_spi
        @actor.maxhp += $temp_hp
        @actor.maxmp += $temp_mp
        # 切换到地图画面
        $scene = Scene_Map.new
        return
      end
      if @command_window.index == 7
          # 演奏确定 SE
        Sound.play_decision
          # 将角色的剩余点数带入
        $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
          # 初始化临时量
        $temp_atk = 0
        $temp_def = 0
        $temp_agi = 0
        $temp_spi = 0
        $temp_hp = 0
        $temp_mp = 0
        @lvup_window.refresh
        @lvpoint_window.refresh
        return
      end
      if $point == 0
        # 演奏冻结 SE
        Sound.play_buzzer
        return
      end
      case @command_window.index
      when 0
        # 演奏确定 SE
        Sound.play_decision
        $temp_hp += @hp
        $temp_mp += @mp
        $temp_atk += @hp_atk
        $temp_def += @hp_def
        $temp_agi += @hp_agi
        $temp_spi += @hp_spi
        $point -= 1
        @lvup_window.refresh
        @lvpoint_window.refresh
        s_disable
        return
      when 1
        # 演奏确定 SE
        Sound.play_decision
        $temp_atk += @atk_atk
        $temp_hp += @atk_hp
        $temp_mp += @atk_mp
        $temp_def += @atk_def
        $temp_agi += @atk_agi
        $temp_spi += @atk_spi
        $point -= 1
        @lvup_window.refresh
        @lvpoint_window.refresh
        s_disable
        return
      when 2
        # 演奏确定 SE
        Sound.play_decision
        $temp_def += @def_def
        $temp_hp += @def_hp
        $temp_mp += @def_mp
        $temp_atk += @def_atk
        $temp_agi += @def_agi
        $temp_spi += @def_spi
        $point -= 1
        @lvup_window.refresh
        @lvpoint_window.refresh
        s_disable
        return
      when 3
        # 演奏确定 SE
        Sound.play_decision
        $temp_agi += @agi_agi
        $temp_hp += @agi_hp
        $temp_mp += @agi_mp
        $temp_atk += @agi_atk
        $temp_def += @agi_def
        $temp_spi += @agi_spi
        $point -= 1
        @lvup_window.refresh
        @lvpoint_window.refresh
        s_disable
        return
      when 4
        # 演奏确定 SE
        Sound.play_decision
        $temp_spi += @spi_spi
        $temp_hp += @spi_hp
        $temp_mp += @spi_mp
        $temp_atk += @spi_atk
        $temp_def += @spi_def
        $temp_agi += @spi_agi
        $point -= 1
        @lvup_window.refresh
        @lvpoint_window.refresh
        s_disable
        return
      end
    end
    #=============================================================
    # 什么都没有按下的情况
    #=============================================================
    case @command_window.index   
    when 0  # 增加体力
      temptext1 = @text_hp + @hp.to_s + "点   " + @text_atk + @hp_atk.to_s + "点   " + @text_def + @hp_def.to_s + "点"
      temptext2 = @text_mp + @mp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_spi + @hp_spi.to_s + "点"
      @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
    when 1  # 增加魔力
      temptext1 = @text_hp + @hp.to_s + "点   " + @text_atk + @hp_atk.to_s + "点   " + @text_def + @hp_def.to_s + "点"
      temptext2 = @text_mp + @mp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_spi + @hp_spi.to_s + "点"
      @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
    when 2  # 增加力量
      temptext1 = @text_hp + @atk_hp.to_s + "点   " + @text_atk + @atk_atk.to_s + "点   " + @text_def + @atk_def.to_s + "点"
      temptext2 = @text_mp + @atk_mp.to_s + "点   " + @text_agi + @atk_agi.to_s + "点   " + @text_spi + @atk_spi.to_s + "点"
      @help_window.lvup_text(@text_atk_sc , @text_2 , temptext1 , temptext2)
    when 3  # 增加防御
      temptext1 = @text_hp + @def_hp.to_s + "点   " + @text_atk + @def_agi.to_s + "点   " + @text_def + @def_def.to_s + "点"
      temptext2 = @text_mp + @def_mp.to_s + "点   " + @text_agi + @def_agi.to_s + "点   " + @text_spi + @def_spi.to_s + "点"
      @help_window.lvup_text(@text_def_sc , @text_2 , temptext1 , temptext2)
    when 4  # 增加速度
      temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_atk + @agi_atk.to_s + "点   " + @text_def + @agi_def.to_s + "点"
      temptext2 = @text_mp + @agi_mp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_spi + @agi_spi.to_s + "点"
      @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
    when 5  # 增加魔力
      temptext1 = @text_hp + @spi_hp.to_s + "点   " + @text_atk + @spi_atk.to_s + "点   " + @text_def + @spi_def.to_s + "点"
      temptext2 = @text_mp + @spi_mp.to_s + "点   " + @text_agi + @spi_agi.to_s + "点   " + @text_spi + @spi_spi.to_s + "点"
      @help_window.lvup_text(@text_spi_sc , @text_2 , temptext1 , temptext2)
    when 6 # 保存设定
      @help_window.lvup_text(@text_save)
    when 7 # 点数重置
      @help_window.lvup_text(@text_reset)     
    end
    #=============================================================
    # 按下R与L换人的情况
    #=============================================================      
    if Input.trigger?(Input::R)
      # 演奏光标 SE
      Sound.play_cursor
      # 移至下一位角色
      @actor_index += 1
      @actor_index %= $game_party.members.size
      # 切换到别的状态画面
      $scene = Scene_Lvup.new(@actor_index , @command_window.index)
      return
    end
    # 按下 L 键的情况下
    if Input.trigger?(Input::L)
      # 演奏光标 SE
      Sound.play_cursor
      # 移至上一位角色
      @actor_index += $game_party.members.size - 1
      @actor_index %= $game_party.members.size
      # 切换到别的状态画面
      $scene = Scene_Lvup.new(@actor_index , @command_window.index)
      return
    end
  end  
  #--------------------------------------------------------------------------
  # ● 选项明暗判断
  #--------------------------------------------------------------------------
  def s_disable
    # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
    if $point == 0
      enabled = false
    else
      enabled = true
    end
      @command_window.draw_item(0,enabled)
      @command_window.draw_item(1,enabled)
      @command_window.draw_item(2,enabled)
      @command_window.draw_item(3,enabled)
      @command_window.draw_item(4,enabled)
      @command_window.draw_item(5,enabled)
  end
end[/pre]
梦石
0
星屑
48
在线时间
2459 小时
注册时间
2011-12-18
回帖
1419
发表于 2012-11-10 12:35:57 | 显示全部楼层
其实根本懒得看你这个脚本到底出错在什么地方,你应该给个错误提示的截图。
不过我正好有这个脚本并且满足你的需求,直接给你了,其中的数值你自己改改就行。
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. # 脚本使用设定:

  5. LEVEL_UP_POINT = 3  # 每升一级所增加的点数
  6. LEVEL_UP_VARIABLE = 1000 # 储存角色点数的变量编号与角色id编号的差值
  7.                          # 默认情况 = 100,
  8.                          # 则是数据库里1号角色的加点数存于101号变量
  9.                          # 3号角色的加点数存于103号变量。
  10.                          # 你可以直接操作变量赠与角色可分配点数

  11. # 每增加一次点数,各项能力值的变化:357-410行
  12.                         
  13. # 使用方法介绍:

  14. # 本脚本不会取代原来的升级自动加点 也就是说,默认的升级还在,但可以用这个功能手动追加点数。
  15. # 如果你想纯粹使用手动加点(而升级不提升能力),只要把数据库中角色升级能力,
  16. # 1-99级全部等于一个相同数值就行了。

  17. # 呼唤加点场景的方法:$scene = Scene_Lvup.new(角色编号,返回菜单编号)。
  18. # 默认都是0号

  19. # 加点场景中,page up,page down换人,如果想加点完毕后返回地图,
  20. # 464行$scene = Scene_Menu.new(0)改为$scene = Scene_Map.new

  21. # 推荐脚本搭配:魔法商店脚本,两者结合,制作自由型RPG

  22. #==============================================================================
  23. # ■ Window_Command
  24. #------------------------------------------------------------------------------
  25. #  一般的命令选择行窗口。(追加定义)
  26. #==============================================================================
  27. class Window_Command < Window_Selectable
  28.   #--------------------------------------------------------------------------
  29.   # ● 项目有效化
  30.   #     index : 项目编号
  31.   #--------------------------------------------------------------------------

  32.   def able_item(index)
  33.     draw_item(index, normal_color)
  34.   end
  35. end
  36. #==============================================================================
  37. # ■ Game_Actor
  38. #------------------------------------------------------------------------------
  39. #  处理角色的类。(再定义)
  40. #==============================================================================

  41. class Game_Actor < Game_Battler
  42.   def level_up
  43.     @level += 1
  44.         @hp = maxhp
  45.     @mp = maxmp
  46.     $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
  47.     for learning in self.class.learnings
  48.       learn_skill(learning.skill_id) if learning.level == @level
  49.     end
  50.   end
  51. end
  52. #==============================================================================
  53. # ■ Window_Base
  54. #------------------------------------------------------------------------------
  55. #  游戏中全部窗口的超级类(追加定义)
  56. #==============================================================================
  57. class Window_Base < Window
  58.   #--------------------------------------------------------------------------
  59.   # ● 描绘 HP
  60.   #     actor : 角色
  61.   #     x     : 描画目标 X 坐标
  62.   #     y     : 描画目标 Y 坐标
  63.   #     width : 描画目标的宽
  64.   #--------------------------------------------------------------------------
  65.   def draw_actor_hp_lvup(actor, x, y)
  66.     self.contents.font.color = system_color
  67.     self.contents.draw_text(x , y, 96, 32, "" + "")
  68.     if $temp_hp == 0
  69.       self.contents.font.color = normal_color
  70.       self.contents.draw_text(x + 60 , y, 48, 32, actor.maxhp.to_s, 2)
  71.     else
  72.       maxhp = actor.maxhp + $temp_hp
  73.       self.contents.font.color = Color.new(255, 128, 128, 255)
  74.       self.contents.draw_text(x + 60 , y, 48, 32, maxhp.to_s ,2)
  75.       self.contents.font.color = normal_color      
  76.       self.contents.draw_text(x + 95, y, 36, 32, "( ", 2)
  77.       if $temp_hp >=0
  78.         self.contents.font.color = Color.new(255, 128, 128, 255)
  79.         self.contents.draw_text(x + 95, y, 36, 32, " +",2)
  80.       else
  81.         self.contents.font.color = Color.new(255,255,0,255)
  82.         self.contents.draw_text(x + 95, y, 36, 32, " -",2)
  83.       end
  84.       self.contents.draw_text(x + 140, y, 36, 32, $temp_hp.to_s, 2)
  85.       self.contents.font.color = normal_color
  86.       self.contents.draw_text(x + 155, y, 36, 32, ")", 2)
  87.     end
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● 描绘 MP
  91.   #     actor : 角色
  92.   #     x     : 描画目标 X 坐标
  93.   #     y     : 描画目标 Y 坐标
  94.   #     width : 描画目标的宽
  95.   #--------------------------------------------------------------------------
  96.   def draw_actor_mp_lvup(actor, x, y)
  97.     self.contents.font.color = system_color
  98.     self.contents.draw_text(x , y, 96, 32, "" +"")
  99.     if $temp_mp == 0
  100.       self.contents.font.color = normal_color
  101.       self.contents.draw_text(x + 60 , y, 48, 32, actor.maxmp.to_s, 2)
  102.     else
  103.       maxmp = actor.maxmp + $temp_mp
  104.       self.contents.font.color = Color.new(255, 128, 128, 255)
  105.       self.contents.draw_text(x + 60 , y, 48, 32, maxmp.to_s ,2)
  106.       self.contents.font.color = normal_color      
  107.       self.contents.draw_text(x + 95, y, 36, 32, "( ", 2)
  108.       if $temp_mp >=0
  109.         self.contents.font.color = Color.new(255, 128, 128, 255)
  110.         self.contents.draw_text(x + 95, y, 36, 32, " +",2)
  111.       else
  112.         self.contents.font.color = Color.new(255,255,0,255)
  113.         self.contents.draw_text(x + 95, y, 36, 32, " -",2)
  114.       end
  115.       self.contents.draw_text(x + 140, y, 36, 32, $temp_mp.to_s, 2)
  116.       self.contents.font.color = normal_color
  117.       self.contents.draw_text(x + 155, y, 36, 32, ")", 2)
  118.     end
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 描绘能力值
  122.   #     actor : 角色
  123.   #     x     : 描画目标 X 坐标
  124.   #     y     : 描画目标 Y 坐标
  125.   #     type  : 能力值种类 (0~4)
  126.   #--------------------------------------------------------------------------
  127.   def draw_actor_lvup(actor, x, y, type)   
  128.     # 定义数字颜色
  129.     lvup = normal_color
  130.     upcolor = Color.new(255, 128, 128, 255)
  131.     self.contents.font.color = normal_color   
  132.     case type
  133.     when 0
  134.       parameter_name = Vocab::atk
  135.       parameter_value = actor.atk
  136.       parameter_value_temp = parameter_value + $temp_atk
  137.       if $temp_atk != 0
  138.         lvup = upcolor
  139.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  140.         if $temp_atk >= 0
  141.           self.contents.font.color = lvup
  142.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  143.         else
  144.           self.contents.font.color = Color.new(255,255,0,255)
  145.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  146.         end        
  147.         self.contents.draw_text(x + 272, y, 80, 32, $temp_atk.abs.to_s,1)
  148.         self.contents.font.color = normal_color
  149.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  150.       end
  151.     when 1
  152.       parameter_name = Vocab::def
  153.       parameter_value = actor.def
  154.       parameter_value_temp = parameter_value + $temp_def
  155.       if $temp_def != 0
  156.         lvup = upcolor
  157.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  158.         if $temp_def >= 0
  159.           self.contents.font.color = lvup
  160.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  161.         else
  162.           self.contents.font.color = Color.new(255,255,0,255)
  163.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  164.         end        
  165.         self.contents.draw_text(x + 272, y, 80, 32, $temp_def.abs.to_s,1)
  166.         self.contents.font.color = normal_color
  167.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  168.       end
  169.     when 2
  170.       parameter_name = Vocab::agi
  171.       parameter_value = actor.agi
  172.       parameter_value_temp = parameter_value + $temp_agi
  173.       if $temp_agi != 0
  174.         lvup = upcolor
  175.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  176.         if $temp_agi >= 0
  177.           self.contents.font.color = lvup
  178.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  179.         else
  180.           self.contents.font.color = Color.new(255,255,0,255)
  181.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  182.         end        
  183.         self.contents.draw_text(x + 272, y, 80, 32, $temp_agi.abs.to_s,1)
  184.         self.contents.font.color = normal_color
  185.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  186.       end
  187.     when 3
  188.       parameter_name = Vocab::spi
  189.       parameter_value = actor.spi
  190.       parameter_value_temp = parameter_value + $temp_spi
  191.       if $temp_spi != 0
  192.         lvup = upcolor
  193.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  194.         if $temp_spi >= 0
  195.           self.contents.font.color = lvup
  196.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  197.         else
  198.           self.contents.font.color = Color.new(255,255,0,255)
  199.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  200.         end        
  201.         self.contents.draw_text(x + 272, y, 80, 32, $temp_spi.abs.to_s,1)
  202.         self.contents.font.color = normal_color
  203.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  204.       end
  205.     when 4
  206.       parameter_name = "剩余点数"
  207.       parameter_value = $point
  208.       if $point != 0
  209.         lvup = upcolor
  210.       end
  211.     end   
  212.     self.contents.font.size = 16 if type == 4
  213.     self.contents.font.color = system_color
  214.     if type != 4 then
  215.       self.contents.draw_text(x, y, 120, 32, "")
  216.     else
  217.       self.contents.draw_text(x, y, 120, 24, "")
  218.     end
  219.     self.contents.font.color = normal_color
  220.     if type != 4
  221.       self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s)   
  222.     else
  223.       self.contents.draw_text(x + 68, y, 36, 24, parameter_value.to_s)   
  224.     end
  225.     if type != 4
  226.       self.contents.draw_text(x + 180, y, 36, 32, "")
  227.     end  
  228.     self.contents.font.color = lvup
  229.     self.contents.draw_text(x + 210, y, 60, 32, parameter_value_temp.to_s)
  230.     self.contents.font.color = normal_color        
  231.   end
  232. end

  233. class Window_Lvpoint < Window_Base
  234.   def initialize
  235.     super(40,198+69,128,58)
  236.     self.opacity = 0
  237.     refresh
  238.   end
  239.   def refresh
  240.     self.contents.clear
  241.     draw_actor_lvup(@actor, 0, 0, 4)
  242.   end
  243. end
  244. #==============================================================================
  245. # ■ Window_lvup
  246. #------------------------------------------------------------------------------
  247. #  显示升级状态窗口。
  248. #==============================================================================
  249. class Window_Lvup < Window_Base
  250.   #--------------------------------------------------------------------------
  251.   # ● 初始化对像
  252.   #     actor : 角色
  253.   #--------------------------------------------------------------------------
  254.   def initialize(actor)
  255.     super(0, 0, 416, 256+24)  
  256.     self.contents = Bitmap.new(width - 32, height - 32)
  257.     self.opacity = 0
  258.     @actor = actor
  259.     refresh
  260.   end  
  261.   #--------------------------------------------------------------------------
  262.   # ● 刷新
  263.   #--------------------------------------------------------------------------
  264.   def refresh


  265.     self.contents.clear
  266.     draw_actor_graphic(@actor, 30, 80)
  267.     draw_actor_name(@actor, 4, 0)
  268.     draw_actor_class(@actor, 96, 0)
  269.     draw_actor_level(@actor, 224, 0)
  270.     draw_actor_state(@actor, 96, 32)   
  271.     draw_actor_hp_lvup(@actor, 96, 32)
  272.     draw_actor_mp_lvup(@actor, 96, 64)
  273.     draw_actor_lvup(@actor, 4, 96, 0)
  274.     draw_actor_lvup(@actor, 4, 128, 1)
  275.     draw_actor_lvup(@actor, 4, 160, 2)
  276.     draw_actor_lvup(@actor, 4, 192, 3)
  277.   end
  278. end
  279. #==============================================================================
  280. # ■ Window_Help
  281. #------------------------------------------------------------------------------
  282. #  特技及物品的说明、角色的状态显示的窗口。
  283. #==============================================================================
  284. class Window_Lvup_Help < Window_Base
  285.   #--------------------------------------------------------------------------
  286.   # ● 初始化对像
  287.   #--------------------------------------------------------------------------
  288.   def initialize
  289.     super(68, 256+64, 544, 160)
  290.     self.contents = Bitmap.new(width - 32, height - 32)
  291.     self.opacity = 0
  292.     @test = "" #——这个东西用来检测,节约内存专用
  293.   end  
  294.   #--------------------------------------------------------------------------
  295.   # ● 设置文本
  296.   #--------------------------------------------------------------------------
  297.   def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil)
  298.     if @test != text1
  299.       @test = text1
  300.     else
  301.       return
  302.     end   
  303.     self.contents.clear
  304.     self.contents.font.color = normal_color
  305.     self.contents.draw_text(4, 0, self.width - 40, 32, text1)
  306.     if text2 != nil
  307.       self.contents.draw_text(4 , 32, self.width - 40, 32, text2)
  308.     end
  309.     self.contents.font.size -= 4
  310.     if text3 != nil
  311.       self.contents.draw_text(4 , 64, self.width - 40, 32, text3)
  312.     end
  313.     if text4 != nil
  314.       self.contents.draw_text(4 , 96, self.width - 40, 32, text4)
  315.     end
  316.     self.contents.font.size += 4
  317.   end
  318. end
  319. #==============================================================================
  320. # ■ Scene_lvup
  321. #------------------------------------------------------------------------------
  322. #  处理升级画面的类。
  323. #==============================================================================
  324. class Scene_Lvup
  325.   #--------------------------------------------------------------------------
  326.   # ● 初始化对像
  327.   #     actor_index : 角色索引
  328.   #     menu_index : 选项起始位置
  329.   #--------------------------------------------------------------------------
  330.   def initialize(actor_index = 0 , menu_index = nil)
  331.     @actor_index = actor_index
  332.     @menu_index = menu_index
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ● 主处理
  336.   #--------------------------------------------------------------------------
  337.   def main
  338.     s1 = "增加生命"
  339.     s2 = "增加魔力"
  340.     s3 = "增加攻击"
  341.     s4 = "增加防御"
  342.     s5 = "增加敏捷"
  343.     s6 = "增加智力"
  344.     s7 = "确认分配"
  345.     s8 = "点数重置"
  346.     @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7, s8])
  347.     @command_window.x=20
  348.     @command_window.y=33
  349.     @command_window.opacity = 0
  350.     #@command_window.index = @menu_index
  351.     # 获取角色
  352.     @actor = $game_party.members[@actor_index]
  353.     # 将角色的剩余点数带入
  354.     $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  355.     # 初始化临时量
  356.     $temp_atk = 0
  357.     $temp_def = 0
  358.     $temp_agi = 0
  359.     $temp_spi = 0
  360.     $temp_hp = 0
  361.     $temp_mp = 0
  362.     #=========================================================================
  363.     # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
  364.     #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
  365.     #=========================================================================
  366.     # 每提升一次HP,提升多少附加能力
  367.     #=========================================================================
  368.     @hp_hp = 10     # 每提升一次力量附加提升多少HP
  369.     @hp_mp = 0     # 每提升一次力量附加提升多少MP
  370.     @hp_def = 0    # 每提升一次力量附加提升多少灵巧
  371.     @hp_agi = 0    # 每提升一次力量附加提升多少速度
  372.     @hp_spi = 0    # 每提升一次力量附加提升多少魔力
  373.     @hp_atk = 0    # 每提升一次力量附加提升多少力量
  374.     #=========================================================================
  375.     # 每提升一次MP,提升多少附加能力
  376.     #=========================================================================
  377.     @mp_hp = 0     # 每提升一次力量附加提升多少HP
  378.     @mp_mp = 5     # 每提升一次力量附加提升多少MP
  379.     @mp_def = 0    # 每提升一次力量附加提升多少灵巧
  380.     @mp_agi = 0    # 每提升一次力量附加提升多少速度
  381.     @mp_spi = 0    # 每提升一次力量附加提升多少魔力
  382.     @mp_atk = 0    # 每提升一次力量附加提升多少力量
  383.     #=========================================================================
  384.     # 每提升一次力量,提升多少附加能力
  385.     #=========================================================================
  386.     @atk_hp = 0     # 每提升一次力量附加提升多少HP
  387.     @atk_mp = 0     # 每提升一次力量附加提升多少MP
  388.     @atk_def = 0    # 每提升一次力量附加提升多少灵巧
  389.     @atk_agi = 0    # 每提升一次力量附加提升多少速度
  390.     @atk_spi = 0    # 每提升一次力量附加提升多少魔力
  391.     @atk_atk = 2    # 每提升一次力量附加提升多少力量
  392.     #=========================================================================
  393.     # 每提升一次灵巧,提升多少附加能力
  394.     #=========================================================================
  395.     @def_hp = 0     # 每提升一次灵巧附加提升多少HP
  396.     @def_mp = 0     # 每提升一次灵巧附加提升多少MP
  397.     @def_atk = 0    # 每提升一次灵巧附加提升多少力量
  398.     @def_agi = 0    # 每提升一次灵巧附加提升多少速度
  399.     @def_spi = 0    # 每提升一次灵巧附加提升多少魔力
  400.     @def_def = 2    # 每提升一次灵巧附加提升多少灵巧
  401.     #=========================================================================
  402.     # 每提升一次速度,提升多少附加能力
  403.     #=========================================================================
  404.     @agi_hp = 0     # 每提升一次速度附加提升多少HP
  405.     @agi_mp = 0     # 每提升一次速度附加提升多少MP
  406.     @agi_atk = 0    # 每提升一次速度附加提升多少力量
  407.     @agi_def = 0    # 每提升一次速度附加提升多少灵巧
  408.     @agi_spi = 0    # 每提升一次速度附加提升多少魔力
  409.     @agi_agi = 2    # 每提升一次速度附加提升多少速度
  410.     #=========================================================================
  411.     # 每提升一次魔力,提升多少附加能力
  412.     #=========================================================================
  413.     @spi_hp = 0     # 每提升一次魔力附加提升多少HP
  414.     @spi_mp = 0    # 每提升一次魔力附加提升多少MP
  415.     @spi_atk = 0   # 每提升一次魔力附加提升多少力量
  416.     @spi_def = 0   # 每提升一次魔力附加提升多少灵巧
  417.     @spi_agi = 0   # 每提升一次魔力附加提升多少速度
  418.     @spi_spi = 2   # 每提升一次魔力附加提升多少魔力
  419.     # 定义说明文字
  420.     @text_hp_sc = "生命可以增加生存的能力,可以延长生存的时间!"
  421.     @text_mp_sc = "体力可以增加MP"
  422.     @text_atk_sc = Vocab::atk + "可以增加物理攻击和物理技能的威力!"
  423.     @text_def_sc = Vocab::def + "可以提高对物理攻击的减免"
  424.     @text_agi_sc = Vocab::agi + "可以提高回避、命中、暴击以及逃跑成功率!"
  425.     @text_spi_sc = Vocab::spi + "可以提高魔法的效果!"
  426.     @text_save = "保存分配情况并返回游戏"
  427.     @text_reset= "重新分配能力点数"
  428.     @text_2 = "每增加一次此项能力,可以提升的能力值"
  429.     @text_hp = "" + Vocab::hp + "值"
  430.     @text_mp = "" + Vocab::mp + "值"
  431.     @text_atk = "最大" + Vocab::atk + "值"
  432.     @text_def = "最大" + Vocab::def + "值"
  433.     @text_spi = "最大" + Vocab::spi + "值"
  434.     @text_agi = "最大" + Vocab::agi + "值"
  435.     s_disable
  436.     # 生成状态窗口
  437.     @lvup_window = Window_Lvup.new(@actor)
  438.     @lvup_window.x = 246
  439.     @lvup_window.y = 0   
  440.     @lvpoint_window = Window_Lvpoint.new
  441.     # 生成帮助窗口并初始化帮助文本
  442.     @help_window = Window_Lvup_Help.new   
  443.     @jd = Sprite.new
  444.     @jd.bitmap = Cache.system("Lvup_window")
  445.     # 执行过渡
  446.     Graphics.transition
  447.     # 主循环
  448.     loop do
  449.       # 刷新游戏画面
  450.       Graphics.update
  451.       # 刷新输入信息
  452.       Input.update
  453.       # 刷新画面
  454.       update
  455.       # 如果切换画面就中断循环
  456.       if $scene != self
  457.         break
  458.       end
  459.     end
  460.     # 准备过渡

  461.     Graphics.freeze
  462.     # 释放窗口
  463.     @jd.dispose
  464.     @lvpoint_window.dispose
  465.     @command_window.dispose
  466.     @lvup_window.dispose
  467.     @help_window.dispose
  468.   end
  469.   
  470.   #def return_scene
  471.    # if @menu_index
  472.     #  $scene = Scene_Menu.new(@menu_index)
  473.     #else
  474.      # $scene = Scene_Menu.new(4)
  475.     #end
  476.   #end
  477.   
  478.   #--------------------------------------------------------------------------
  479.   # ● 刷新画面
  480.   #--------------------------------------------------------------------------
  481.   def update
  482.     # 刷新窗口
  483.     @command_window.update
  484.     # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
  485.     s_disable
  486.     @lvup_window.update
  487.     #=============================================================
  488.     # 按下 B 键的情况下
  489.     #=============================================================
  490.     if Input.trigger?(Input::B)
  491.       # 演奏取消 SE
  492.       Sound.play_cancel
  493.       # 将角色的剩余点数带回

  494.       
  495.       $scene = Scene_Menu.new(4)
  496. #      return_scene
  497.       return
  498.     end
  499.     #=============================================================
  500.     # 按下 C 键的情况下
  501.     #=============================================================
  502.     if Input.trigger?(Input::C)      
  503.        if @command_window.index == 6
  504.            # 演奏确定 SE
  505.          Sound.play_decision
  506.         # 将角色的剩余点数带回
  507.          $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
  508.          # 将角色点数实际加上
  509.          @actor.atk += $temp_atk
  510.          @actor.def += $temp_def
  511.          @actor.agi += $temp_agi
  512.         @actor.spi += $temp_spi
  513.          @actor.maxhp += $temp_hp
  514.          @actor.maxmp += $temp_mp
  515.          
  516.         $scene = Scene_Lvup.new
  517.         # return_scene
  518.          return
  519.       end
  520.       if @command_window.index == 7
  521.           # 演奏确定 SE
  522.         Sound.play_decision
  523.           # 将角色的剩余点数带入
  524.         $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  525.           # 初始化临时量
  526.         $temp_atk = 0
  527.         $temp_def = 0
  528.         $temp_agi = 0
  529.         $temp_spi = 0
  530.         $temp_hp = 0
  531.         $temp_mp = 0
  532.         @lvup_window.refresh
  533.         @lvpoint_window.refresh
  534.         return
  535.       end
  536.       if $point == 0
  537.         # 演奏冻结 SE
  538.         Sound.play_buzzer
  539.         return
  540.       end
  541.       case @command_window.index
  542.       when 0
  543.         # 演奏确定 SE
  544.         Sound.play_decision
  545.         $temp_hp += @hp_hp
  546.         $temp_mp += @hp_mp
  547.         $temp_atk += @hp_atk
  548.         $temp_def += @hp_def
  549.         $temp_agi += @hp_agi
  550.         $temp_spi += @hp_spi
  551.         $point -= 1
  552.         @lvup_window.refresh
  553.         @lvpoint_window.refresh
  554.         s_disable
  555.         return
  556.       when 1
  557.         # 演奏确定 SE
  558.         Sound.play_decision
  559.         $temp_mp += @mp_mp
  560.         $temp_hp += @mp_hp
  561.         $temp_atk += @mp_atk
  562.         $temp_def += @mp_def
  563.         $temp_agi += @mp_agi
  564.         $temp_spi += @mp_spi
  565.         $point -= 1
  566.         @lvup_window.refresh
  567.         @lvpoint_window.refresh
  568.         s_disable
  569.         return
  570.       when 2
  571.         # 演奏确定 SE
  572.         Sound.play_decision
  573.         $temp_atk += @atk_atk
  574.         $temp_hp += @atk_hp
  575.         $temp_mp += @atk_mp
  576.         $temp_def += @atk_def
  577.         $temp_agi += @atk_agi
  578.         $temp_spi += @atk_spi
  579.         $point -= 1
  580.         @lvup_window.refresh
  581.         @lvpoint_window.refresh
  582.         s_disable
  583.         return
  584.       when 3
  585.         # 演奏确定 SE
  586.         Sound.play_decision
  587.         $temp_def += @def_def
  588.         $temp_hp += @def_hp
  589.         $temp_mp += @def_mp
  590.         $temp_atk += @def_atk
  591.         $temp_agi += @def_agi
  592.         $temp_spi += @def_spi
  593.         $point -= 1
  594.         @lvup_window.refresh
  595.         @lvpoint_window.refresh
  596.         s_disable
  597.         return
  598.       when 4
  599.         # 演奏确定 SE
  600.         Sound.play_decision
  601.         $temp_agi += @agi_agi
  602.         $temp_hp += @agi_hp
  603.         $temp_mp += @agi_mp
  604.         $temp_atk += @agi_atk
  605.         $temp_def += @agi_def
  606.         $temp_spi += @agi_spi
  607.         $point -= 1
  608.         @lvup_window.refresh
  609.         @lvpoint_window.refresh
  610.         s_disable
  611.         return
  612.       when 5
  613.         # 演奏确定 SE
  614.         Sound.play_decision
  615.         $temp_spi += @spi_spi
  616.         $temp_hp += @spi_hp
  617.         $temp_mp += @spi_mp
  618.         $temp_atk += @spi_atk
  619.         $temp_def += @spi_def
  620.         $temp_agi += @spi_agi
  621.         $point -= 1
  622.         @lvup_window.refresh
  623.         @lvpoint_window.refresh
  624.         s_disable
  625.         return
  626.       when 6
  627.         # 演奏确定 SE
  628.         Sound.play_decision
  629.         $temp_agi += @spi_agi
  630.         $temp_hp += @spi_hp
  631.         $temp_mp += @spi_mp
  632.         $temp_atk += @spi_atk
  633.         $temp_def += @spi_def
  634.         $temp_spi += @spi_spi
  635.         $point -= 1
  636.         @lvup_window.refresh
  637.         @lvpoint_window.refresh
  638.         s_disable
  639.         return
  640.       end
  641.     end
  642.     #=============================================================
  643.     # 什么都没有按下的情况
  644.     #=============================================================
  645.     case @command_window.index   
  646.     when 0  # 增加生命
  647.       temptext1 = @text_hp + @hp_hp.to_s + "点   " + @text_atk + @hp_atk.to_s + "点   " + @text_def + @hp_def.to_s + "点"
  648.       temptext2 = @text_mp + @hp_mp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_spi + @hp_spi.to_s + "点"
  649.       @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
  650.     when 1  # 增加体力
  651.       temptext1 = @text_hp + @mp_hp.to_s + "点   " + @text_atk + @hp_atk.to_s + "点   " + @text_def + @hp_def.to_s + "点"
  652.       temptext2 = @text_mp + @mp_mp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_spi + @hp_spi.to_s + "点"
  653.       @help_window.lvup_text(@text_mp_sc , @text_2 , temptext1 , temptext2)
  654.     when 2  # 增加力量
  655.       temptext1 = @text_hp + @atk_hp.to_s + "点   " + @text_atk + @atk_atk.to_s + "点   " + @text_def + @atk_def.to_s + "点"
  656.       temptext2 = @text_mp + @atk_mp.to_s + "点   " + @text_agi + @atk_agi.to_s + "点   " + @text_spi + @atk_spi.to_s + "点"
  657.       @help_window.lvup_text(@text_atk_sc , @text_2 , temptext1 , temptext2)
  658.     when 3  # 增加防御
  659.       temptext1 = @text_hp + @def_hp.to_s + "点   " + @text_atk + @def_agi.to_s + "点   " + @text_def + @def_def.to_s + "点"
  660.       temptext2 = @text_mp + @def_mp.to_s + "点   " + @text_agi + @def_agi.to_s + "点   " + @text_spi + @def_spi.to_s + "点"
  661.       @help_window.lvup_text(@text_def_sc , @text_2 , temptext1 , temptext2)
  662.     when 4  # 增加速度
  663.       temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_atk + @agi_atk.to_s + "点   " + @text_def + @agi_def.to_s + "点"
  664.       temptext2 = @text_mp + @agi_mp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_spi + @agi_spi.to_s + "点"
  665.       @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
  666.     when 5  # 增加魔力
  667.       temptext1 = @text_hp + @spi_hp.to_s + "点   " + @text_atk + @spi_atk.to_s + "点   " + @text_def + @spi_def.to_s + "点"
  668.       temptext2 = @text_mp + @spi_mp.to_s + "点   " + @text_agi + @spi_agi.to_s + "点   " + @text_spi + @spi_spi.to_s + "点"
  669.       @help_window.lvup_text(@text_spi_sc , @text_2 , temptext1 , temptext2)
  670.     when 6 # 保存设定
  671.       @help_window.lvup_text(@text_save)
  672.     when 7 # 点数重置
  673.       @help_window.lvup_text(@text_reset)     
  674.     end
  675.     #=============================================================
  676.     # 按下R与L换人的情况
  677.     #=============================================================      
  678.     if Input.trigger?(Input::R)
  679.       # 演奏光标 SE
  680.       Sound.play_cursor
  681.       # 移至下一位角色
  682.       @actor_index += 1
  683.       @actor_index %= $game_party.members.size
  684.       # 切换到别的状态画面
  685.       #$scene = Scene_Lvup.new(@actor_index , @command_window.index)
  686.       $scene = Scene_Lvup.new(@actor_index , @meun_index)
  687.       return
  688.     end
  689.     # 按下 L 键的情况下
  690.     if Input.trigger?(Input::L)
  691.       # 演奏光标 SE
  692.       Sound.play_cursor
  693.       # 移至上一位角色
  694.       @actor_index += $game_party.members.size - 1
  695.       @actor_index %= $game_party.members.size
  696.       # 切换到别的状态画面
  697.       #$scene = Scene_Lvup.new(@actor_index , @command_window.index)
  698.       $scene = Scene_Lvup.new(@actor_index , @menu_index)
  699.       return
  700.     end
  701.   end  
  702.   #--------------------------------------------------------------------------
  703.   # ● 选项明暗判断
  704.   #--------------------------------------------------------------------------
  705.   def s_disable
  706.     # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
  707.     if $point == 0
  708.       enabled = false
  709.     else
  710.       enabled = true
  711.     end
  712.       @command_window.draw_item(0,enabled)
  713.       @command_window.draw_item(1,enabled)
  714.       @command_window.draw_item(2,enabled)
  715.       @command_window.draw_item(3,enabled)
  716.       @command_window.draw_item(4,enabled)
  717.       @command_window.draw_item(5,enabled)
  718.   end
  719. end
复制代码

评分

参与人数 1星屑 +120 收起 理由
咕噜 + 120 精品文章

查看全部评分

这是一个深不见底的坑,这是一个广袤无边的坑,我才刚刚放上了一抔泥土……

《六道·陈国篇》开坑了……↓点我
回复

使用道具 举报

梦石
0
星屑
50
在线时间
163 小时
注册时间
2012-3-3
回帖
36
 楼主| 发表于 2012-11-10 15:14:43 | 显示全部楼层
謝謝a364774426的提供
正式所需要的腳本
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部