| 
 
| 赞 | 8 |  
| VIP | 20 |  
| 好人卡 | 126 |  
| 积分 | 117 |  
| 经验 | 33282 |  
| 最后登录 | 2025-10-30 |  
| 在线时间 | 1683 小时 |  
 Lv4.逐梦者 
	梦石8 星屑3701 在线时间1683 小时注册时间2010-10-22帖子1067  
 | 
4楼
 
 
 楼主|
发表于 2010-10-30 23:33:17
|
只看该作者 
| 本帖最后由 fux2 于 2010-11-1 06:53 编辑 
 这个脚本:
 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 = "锻修"+$data_system.words.str 
    s3 = "锻修"+$data_system.words.dex
    s4 = "锻修"+$data_system.words.agi 
    s5 = "锻修"+$data_system.words.int 
    s6 = "确定锻修"
    s7 = "潜能重置"
    @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # 获取角色
    @actor = $game_party.actors[@actor_index]
    # 将角色的剩余点数带入
    $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]    
    # 初始化临时量
    $temp_str = 0
    $temp_dex = 0
    $temp_agi = 0
    $temp_int = 0
    $temp_hp = 0
    $temp_sp = 0
    #=========================================================================
    # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
    #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
    #=========================================================================
    # 每提升一次力量,提升多少附加能力
    #=========================================================================
    @str_hp = 2     # 每提升一次力量附加提升多少HP
    @str_sp = 2     # 每提升一次力量附加提升多少SP
    @str_dex = 1    # 每提升一次力量附加提升多少灵巧
    @str_agi = 1    # 每提升一次力量附加提升多少速度
    @str_int = 0    # 每提升一次力量附加提升多少魔力
    @str_str = 5    # 每提升一次力量附加提升多少力量
    #=========================================================================
    # 每提升一次灵巧,提升多少附加能力
    #=========================================================================
    @dex_hp = 3     # 每提升一次灵巧附加提升多少HP
    @dex_sp = 2     # 每提升一次灵巧附加提升多少SP
    @dex_str = 1    # 每提升一次灵巧附加提升多少力量
    @dex_agi = 1    # 每提升一次灵巧附加提升多少速度
    @dex_int = 0    # 每提升一次灵巧附加提升多少魔力
    @dex_dex = 5    # 每提升一次灵巧附加提升多少灵巧
    #=========================================================================
    # 每提升一次速度,提升多少附加能力
    #=========================================================================
    @agi_hp = 3     # 每提升一次速度附加提升多少HP
    @agi_sp = 2     # 每提升一次速度附加提升多少SP
    @agi_str = 1    # 每提升一次速度附加提升多少力量
    @agi_dex = 1    # 每提升一次速度附加提升多少灵巧
    @agi_int = 0    # 每提升一次速度附加提升多少魔力
    @agi_agi = 2    # 每提升一次速度附加提升多少速度
    #=========================================================================
    # 每提升一次魔力,提升多少附加能力
    #=========================================================================
    @int_hp = 1     # 每提升一次魔力附加提升多少HP
    @int_sp = 10    # 每提升一次魔力附加提升多少SP
    @int_str = 0   # 每提升一次魔力附加提升多少力量
    @int_dex = 0   # 每提升一次魔力附加提升多少灵巧
    @int_agi = 0   # 每提升一次魔力附加提升多少速度
    @int_int = 10   # 每提升一次魔力附加提升多少魔力
    #=========================================================================
    # 每提升一次体力,提升多少附加能力
    #=========================================================================
    @hp = 15       # 每提升一次体力提升多少HP
    @sp = 10       # 每提升一次体力提升多少SP
    @hp_str = 0   # 每提升一次体力提升多少力量
    @hp_dex = 0   # 每提升一次体力提升多少速度
    @hp_agi = 0   # 每提升一次体力提升多少灵巧
    @hp_int = 0   # 每提升一次体力提升多少魔力    
    # 定义说明文字
    @text_hp_sc = "体能-可以提升生存的能力,可以延长生存的时间-"
    @text_str_sc = $data_system.words.str + "-可以提升物理攻击和物理技能的威力-"
    @text_dex_sc = $data_system.words.dex + "-可以提升攻击的命中率和必杀-"
    @text_agi_sc = $data_system.words.agi + "-可以提升回避、命中、脱离成功率-"
    @text_int_sc = $data_system.words.int + "-可以提升魔法的效果,可以增加1点魔法-"
    @text_save = "刻录锻修情况并返回暗天"
    @text_reset= "重新分配锻修重点"
    @text_2 = "每提升一次此项能力,可以提升的结果:"
    @text_hp = "最大" + $data_system.words.hp + "值"
    @text_sp = "最大" + $data_system.words.sp + "值"
    @text_str = "最大" + $data_system.words.str + "值"
    @text_dex = "最大" + $data_system.words.dex + "值"
    @text_agi = "最大" + $data_system.words.agi + "值"
    @text_int = "最大" + $data_system.words.int + "值"
    s_disable
    # 生成状态窗口
    @lvup_window = Window_Lvup.new(@actor)
    @lvup_window.x = 128
    @lvup_window.y = 0    
    # 生成帮助窗口并初始化帮助文本
    @help_window = Window_Lvup_Help.new    
    # 执行过渡
    Graphics.transition(40, "Graphics/Transitions/" + $data_system.battle_transition)
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入信息
      Input.update
      # 刷新画面
      update
      # 如果切换画面就中断循环
      if $scene != self
        break
      end
    end
    # 准备过渡
    Graphics.freeze
    # 释放窗口
    @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
      $game_system.se_play($data_system.cancel_se)
      # 切换到地图画面
      $scene = Scene_Menu.new
      return
    end
    #=============================================================
    # 按下 C 键的情况下
    #=============================================================
    if Input.trigger?(Input::C)      
      if @command_window.index == 5
          # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 将角色的剩余点数带回
        $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
        # 将角色点数实际加上
        @actor.str += $temp_str
        @actor.dex += $temp_dex
        @actor.agi += $temp_agi
        @actor.int += $temp_int
        @actor.maxhp += $temp_hp
        @actor.maxsp += $temp_sp
        # 切换到地图画面
        $scene = Scene_Menu.new
        return
      end
      if @command_window.index == 6
          # 演奏确定 SE
        $game_system.se_play($data_system.cancel_se)
          # 将角色的剩余点数带入
        $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]    
          # 初始化临时量
        $temp_str = 0
        $temp_dex = 0
        $temp_agi = 0
        $temp_int = 0
        $temp_hp = 0
        $temp_sp = 0
        @lvup_window.refresh
        return
      end
      if $point == 0
        # 演奏冻结 SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @command_window.index
      when 0
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_hp += @hp
        $temp_sp += @sp
        $temp_str += @hp_str
        $temp_dex += @hp_dex
        $temp_agi += @hp_agi
        $temp_int += @hp_int
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      when 1
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_str += @str_str
        $temp_hp += @str_hp
        $temp_sp += @str_sp
        $temp_dex += @str_dex
        $temp_agi += @str_agi
        $temp_int += @str_int
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      when 2
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_dex += @dex_dex
        $temp_hp += @dex_hp
        $temp_sp += @dex_sp
        $temp_str += @dex_str
        $temp_agi += @dex_agi
        $temp_int += @dex_int
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      when 3
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_agi += @agi_agi
        $temp_hp += @agi_hp
        $temp_sp += @agi_sp
        $temp_str += @agi_str
        $temp_dex += @agi_dex
        $temp_int += @agi_int
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      when 4
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_int += @int_int
        $temp_hp += @int_hp
        $temp_sp += @int_sp
        $temp_str += @int_str
        $temp_dex += @int_dex
        $temp_agi += @int_agi
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      end
    end
    #=============================================================
    # 什么都没有按下的情况
    #=============================================================
    case @command_window.index    
    when 0  # 增加体力
      temptext1 = @text_hp + @hp.to_s + "点   " + @text_str + @hp_str.to_s + "点   " + @text_dex + @hp_dex.to_s + "点" 
      temptext2 = @text_sp + @sp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_int + @hp_int.to_s + "点"
      @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
    when 1  # 增加力量
      temptext1 = @text_hp + @str_hp.to_s + "点   " + @text_str + @str_str.to_s + "点   " + @text_dex + @str_dex.to_s + "点" 
      temptext2 = @text_sp + @str_sp.to_s + "点   " + @text_agi + @str_agi.to_s + "点   " + @text_int + @str_int.to_s + "点"
      @help_window.lvup_text(@text_str_sc , @text_2 , temptext1 , temptext2)
    when 2  # 增加灵巧
      temptext1 = @text_hp + @dex_hp.to_s + "点   " + @text_str + @dex_agi.to_s + "点   " + @text_dex + @dex_dex.to_s + "点" 
      temptext2 = @text_sp + @dex_sp.to_s + "点   " + @text_agi + @dex_agi.to_s + "点   " + @text_int + @dex_int.to_s + "点"
      @help_window.lvup_text(@text_dex_sc , @text_2 , temptext1 , temptext2)
    when 3  # 增加速度
      temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_str + @agi_str.to_s + "点   " + @text_dex + @agi_dex.to_s + "点" 
      temptext2 = @text_sp + @agi_sp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_int + @agi_int.to_s + "点"
      @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
    when 4  # 增加魔力
      temptext1 = @text_hp + @int_hp.to_s + "点   " + @text_str + @int_str.to_s + "点   " + @text_dex + @int_dex.to_s + "点" 
      temptext2 = @text_sp + @int_sp.to_s + "点   " + @text_agi + @int_agi.to_s + "点   " + @text_int + @int_int.to_s + "点"
      @help_window.lvup_text(@text_int_sc , @text_2 , temptext1 , temptext2)
    when 5 # 保存设定
      @help_window.lvup_text(@text_save)
    when 6 # 点数重置
      @help_window.lvup_text(@text_reset)     
    end
    #=============================================================
    # 按下R与L换人的情况
    #=============================================================      
    if Input.trigger?(Input::R)
      # 演奏光标 SE
      $game_system.se_play($data_system.cursor_se)
      # 移至下一位角色
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      # 切换到别的状态画面
      $scene = Scene_Lvup.new(@actor_index , @command_window.index)
      return
    end
    # 按下 L 键的情况下
    if Input.trigger?(Input::L)
      # 演奏光标 SE
      $game_system.se_play($data_system.cursor_se)
      # 移至上一位角色
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      # 切换到别的状态画面
      $scene = Scene_Lvup.new(@actor_index , @command_window.index)
      return
    end
  end  
  #--------------------------------------------------------------------------
  # ● 选项明暗判断
  #--------------------------------------------------------------------------
  def s_disable
    # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
    if $point == 0
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
      @command_window.disable_item(4)
    else
      @command_window.able_item(0)
      @command_window.able_item(1)      
      @command_window.able_item(2)
      @command_window.able_item(3)
      @command_window.able_item(4)
    end
end
 
 | 
 |