查看: 2111|回复: 8

[已经解决] 去除菜单中存档按钮

[复制链接]
梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-5-4
回帖
5
发表于 2013-5-5 08:59:44 | 显示全部楼层 |阅读模式

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

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

×
用了这个脚本后就不知道怎么去除菜单中的"存档"了,求教啊!!!{:2_264:}

  1. ==============================================================================
  2. # ** Scene_Menu
  3. #------------------------------------------------------------------------------
  4. #  這個類用來執行顯示ESC選單畫面的程式。
  5. #==============================================================================

  6. class Scene_Menu < Scene_Base
  7.   #--------------------------------------------------------------------------
  8.   # * 物件初始化
  9.   #     menu_index : 命令游標的起始位置
  10.   #--------------------------------------------------------------------------
  11.   def initialize(menu_index = 0)
  12.     @menu_index = menu_index
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # * 程式開始
  16.   #--------------------------------------------------------------------------
  17.   def start
  18.     super
  19.     create_menu_background
  20.     create_command_window
  21.     @gold_window = Window_Gold.new(0, 360)
  22.     @status_window = Window_MenuStatus.new(160, 0)
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # * 程式中止
  26.   #--------------------------------------------------------------------------
  27.   def terminate
  28.     super
  29.     dispose_menu_background
  30.     @command_window.dispose
  31.     @gold_window.dispose
  32.     @status_window.dispose
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # * 更新幀
  36.   #--------------------------------------------------------------------------
  37.   def update
  38.     super
  39.     update_menu_background
  40.     @command_window.update
  41.     @gold_window.update
  42.     @status_window.update
  43.     if @command_window.active
  44.       update_command_selection
  45.     elsif @status_window.active
  46.       update_actor_selection
  47.     end
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # * 創建命令視窗
  51.   #--------------------------------------------------------------------------
  52.   def create_command_window
  53.     s1 = Vocab::item
  54.     s2 = Vocab::skill
  55.     s3 = Vocab::equip
  56.     s4 = Vocab::status
  57.     s5 = Vocab::save
  58.     s6 = "升级加点"
  59.     s7 = "任务"
  60.     s8 = Vocab::game_end
  61.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6,s7,s8])
  62.     @command_window.index = @menu_index
  63.     if $game_party.members.size == 0          # 如果無人在隊
  64.       @command_window.draw_item(0, false)     # 禁用[用品]
  65.       @command_window.draw_item(1, false)     # 禁用[技能]
  66.       @command_window.draw_item(2, false)     # 禁用[整備]
  67.       @command_window.draw_item(3, false)     # 禁用[狀態]
  68.     end
  69.     if $game_system.save_disabled             # 如果禁止存檔
  70.       @command_window.draw_item(4, false)     # 禁用[存檔]
  71.     end
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # * 更新指令選擇輸入資訊
  75.   #--------------------------------------------------------------------------
  76.   def update_command_selection
  77.     if Input.trigger?(Input::B)
  78.       Sound.play_cancel
  79.       $scene = Scene_Map.new
  80.     elsif Input.trigger?(Input::C)
  81.       if $game_party.members.size == 0 and @command_window.index < 4
  82.         Sound.play_buzzer
  83.         return
  84.       elsif $game_system.save_disabled and @command_window.index == 4
  85.         Sound.play_buzzer
  86.         return
  87.       end
  88.       Sound.play_decision
  89.       case @command_window.index
  90.       when 0      # 用品
  91.         $scene = Scene_Item.new
  92.       when 1,2,3  # 技能,整備,狀態
  93.         start_actor_selection
  94.       when 4      # 存檔        
  95.         $scene = Scene_File.new(true, false, false)
  96.         when 5 #加点
  97.       $scene = Scene_Lvup.new
  98.       when 6 #任务
  99.       $scene = Scene_Task.new(6)
  100.       when 7      # 結束遊戲
  101.         $scene = Scene_End.new
  102.       end
  103.     end
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # * 開始接收主角選擇指令輸入資訊
  107.   #--------------------------------------------------------------------------
  108.   def start_actor_selection
  109.     @command_window.active = false
  110.     @status_window.active = true
  111.     if $game_party.last_actor_index < @status_window.item_max
  112.       @status_window.index = $game_party.last_actor_index
  113.     else
  114.       @status_window.index = 0
  115.     end
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # * 停止接收主角選擇指令輸入資訊
  119.   #--------------------------------------------------------------------------
  120.   def end_actor_selection
  121.     @command_window.active = true
  122.     @status_window.active = false
  123.     @status_window.index = -1
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # * 更新主角選擇指令輸入資訊
  127.   #--------------------------------------------------------------------------
  128.   def update_actor_selection
  129.     if Input.trigger?(Input::B)
  130.       Sound.play_cancel
  131.       end_actor_selection
  132.     elsif Input.trigger?(Input::C)
  133.       $game_party.last_actor_index = @status_window.index
  134.       Sound.play_decision
  135.       case @command_window.index
  136.       when 1  # 技能
  137.         $scene = Scene_Skill.new(@status_window.index)
  138.       when 2  # 整備
  139.         $scene = Scene_Equip.new(@status_window.index)
  140.       when 3  # 狀態
  141.         $scene = Scene_Status.new(@status_window.index)
  142.       end
  143.     end
  144.   end
  145. end
复制代码

还有,脚本我是直接黏贴上去的 = =、
梦石
0
星屑
50
在线时间
25 小时
注册时间
2013-4-4
回帖
14
发表于 2013-5-5 09:15:31 | 显示全部楼层
這個之前有人問過了 請善用搜索功能 點我傳送 或我
回复

使用道具 举报

梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-5-4
回帖
5
 楼主| 发表于 2013-5-5 10:38:57 | 显示全部楼层
bacnfun 发表于 2013-5-5 09:15
這個之前有人問過了 請善用搜索功能 點我傳送 或我

如果是原版的话我会改,但是这个添加了“升级加点”脚本等,再那样改的话“状态”就变成“存档”了。{:2_248:}
回复

使用道具 举报

送快递的水表员

梦石
10
星屑
5264
在线时间
3305 小时
注册时间
2012-6-27
回帖
7028

开拓者贵宾

发表于 2013-5-5 11:41:36 | 显示全部楼层
  1. #==============================================================================
  2. # ** Scene_Menu
  3. #------------------------------------------------------------------------------
  4. #  這個類用來執行顯示ESC選單畫面的程式。
  5. #==============================================================================

  6. class Scene_Menu < Scene_Base
  7.   #--------------------------------------------------------------------------
  8.   # * 物件初始化
  9.   #     menu_index : 命令游標的起始位置
  10.   #--------------------------------------------------------------------------
  11.   def initialize(menu_index = 0)
  12.     @menu_index = menu_index
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # * 程式開始
  16.   #--------------------------------------------------------------------------
  17.   def start
  18.     super
  19.     create_menu_background
  20.     create_command_window
  21.     @gold_window = Window_Gold.new(0, 360)
  22.     @status_window = Window_MenuStatus.new(160, 0)
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # * 程式中止
  26.   #--------------------------------------------------------------------------
  27.   def terminate
  28.     super
  29.     dispose_menu_background
  30.     @command_window.dispose
  31.     @gold_window.dispose
  32.     @status_window.dispose
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # * 更新幀
  36.   #--------------------------------------------------------------------------
  37.   def update
  38.     super
  39.     update_menu_background
  40.     @command_window.update
  41.     @gold_window.update
  42.     @status_window.update
  43.     if @command_window.active
  44.       update_command_selection
  45.     elsif @status_window.active
  46.       update_actor_selection
  47.     end
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # * 創建命令視窗
  51.   #--------------------------------------------------------------------------
  52.   def create_command_window
  53.     s1 = Vocab::item
  54.     s2 = Vocab::skill
  55.     s3 = Vocab::equip
  56.     s4 = Vocab::status
  57. #    s5 = Vocab::save
  58.     s5 = "升级加点"
  59.     s6 = "任务"
  60.     s7 = Vocab::game_end
  61.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6,s7])
  62.     @command_window.index = @menu_index
  63.     if $game_party.members.size == 0          # 如果無人在隊
  64.       @command_window.draw_item(0, false)     # 禁用[用品]
  65.       @command_window.draw_item(1, false)     # 禁用[技能]
  66.       @command_window.draw_item(2, false)     # 禁用[整備]
  67.       @command_window.draw_item(3, false)     # 禁用[狀態]
  68.     end
  69. #    if $game_system.save_disabled             # 如果禁止存檔
  70. #      @command_window.draw_item(4, false)     # 禁用[存檔]
  71. #    end
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # * 更新指令選擇輸入資訊
  75.   #--------------------------------------------------------------------------
  76.   def update_command_selection
  77.     if Input.trigger?(Input::B)
  78.       Sound.play_cancel
  79.       $scene = Scene_Map.new
  80.     elsif Input.trigger?(Input::C)
  81.       if $game_party.members.size == 0 and @command_window.index < 4
  82.         Sound.play_buzzer
  83.         return
  84.       elsif $game_system.save_disabled and @command_window.index == 4
  85.         Sound.play_buzzer
  86.         return
  87.       end
  88.       Sound.play_decision
  89.       case @command_window.index
  90.       when 0      # 用品
  91.         $scene = Scene_Item.new
  92.       when 1,2,3  # 技能,整備,狀態
  93.         start_actor_selection
  94. #      when 4      # 存檔        
  95. #        $scene = Scene_File.new(true, false, false)
  96.       when 4      #加点
  97.         $scene = Scene_Lvup.new
  98.       when 5      #任务
  99.         $scene = Scene_Task.new(5)
  100.       when 6      # 結束遊戲
  101.         $scene = Scene_End.new
  102.       end
  103.     end
  104.   end
  105.   #--------------------------------------------------------------------------
  106.   # * 開始接收主角選擇指令輸入資訊
  107.   #--------------------------------------------------------------------------
  108.   def start_actor_selection
  109.     @command_window.active = false
  110.     @status_window.active = true
  111.     if $game_party.last_actor_index < @status_window.item_max
  112.       @status_window.index = $game_party.last_actor_index
  113.     else
  114.       @status_window.index = 0
  115.     end
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # * 停止接收主角選擇指令輸入資訊
  119.   #--------------------------------------------------------------------------
  120.   def end_actor_selection
  121.     @command_window.active = true
  122.     @status_window.active = false
  123.     @status_window.index = -1
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # * 更新主角選擇指令輸入資訊
  127.   #--------------------------------------------------------------------------
  128.   def update_actor_selection
  129.     if Input.trigger?(Input::B)
  130.       Sound.play_cancel
  131.       end_actor_selection
  132.     elsif Input.trigger?(Input::C)
  133.       $game_party.last_actor_index = @status_window.index
  134.       Sound.play_decision
  135.       case @command_window.index
  136.       when 1  # 技能
  137.         $scene = Scene_Skill.new(@status_window.index)
  138.       when 2  # 整備
  139.         $scene = Scene_Equip.new(@status_window.index)
  140.       when 3  # 狀態
  141.         $scene = Scene_Status.new(@status_window.index)
  142.       end
  143.     end
  144.   end
  145. end
复制代码
现在行了否?
另:因为LZ并未给出升级加点一类的脚本,所以有些细节问题无法修复,例如返回时的光标在哪行的问题,更改方式参见:
http://rpg.blue/thread-302402-1-1.html     第三楼
回复

使用道具 举报

梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-5-4
回帖
5
 楼主| 发表于 2013-5-6 21:02:09 | 显示全部楼层
Password 发表于 2013-5-5 11:41
现在行了否?
另:因为LZ并未给出升级加点一类的脚本,所以有些细节问题无法修复,例如返回时的光标在哪行 ...

谢谢,不过这个脚本有点小瑕疵。就是每次点击“升级加点”然后退出时,自动移动到“任务”按钮了。若果能修复就完美了!{:2_275:}
QQ截图20130506135450.png
回复

使用道具 举报

梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-5-4
回帖
5
 楼主| 发表于 2013-5-6 21:03:40 | 显示全部楼层
2432051798 发表于 2013-5-6 21:02
谢谢,不过这个脚本有点小瑕疵。就是每次点击“升级加点”然后退出时,自动移动到“任务”按钮了。若果能 ...

那个主角的称号我弄错了,不要在意。本来是看着“对不起”我是个NPC比较地图,不小心把称号搞错了= =
回复

使用道具 举报

送快递的水表员

梦石
10
星屑
5264
在线时间
3305 小时
注册时间
2012-6-27
回帖
7028

开拓者贵宾

发表于 2013-5-6 21:33:50 | 显示全部楼层
本帖最后由 Password 于 2013-5-6 21:38 编辑
2432051798 发表于 2013-5-6 21:02
谢谢,不过这个脚本有点小瑕疵。就是每次点击“升级加点”然后退出时,自动移动到“任务”按钮了。若果能 ...


那么能否给出升级加点脚本?那个要在那里改,很简单的。

如果我没猜错,点“任务”和“结束游戏”后也会有同样问题,这样吧,你全局搜索:$scene = Scene_Menu.new
然后把在任务系统、加点系统和Scene_End 脚本里这句的后面的括号里的数字都减一就好了。

评分

参与人数 1星屑 +100 收起 理由
怪蜀黍 + 100 又是这个问题

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-5-4
回帖
5
 楼主| 发表于 2013-5-6 22:27:51 | 显示全部楼层
Password 发表于 2013-5-6 21:33
那么能否给出升级加点脚本?那个要在那里改,很简单的。

如果我没猜错,点“任务”和“结束游戏”后也会 ...

这是升级加点脚本,非常感谢{:2_36:}
#==============================================================================
# 本脚本来自(不能发链接,所以我给删了,抱歉= =),使用和转载请保留此信息
#==============================================================================

# 脚本使用设定:

LEVEL_UP_POINT = 3  # 每升一级所增加的点数
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 = "增加HP"
    s2 = "增加"+Vocab::atk
    s3 = "增加"+Vocab::def
    s4 = "增加"+Vocab::agi
    s5 = "增加"+Vocab::spi
    s6 = "确认加点"
    s7 = "重新分配"
    @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7])
    @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 = 0     # 每提升一次力量附加提升多少MP
    @atk_def = 0    # 每提升一次力量附加提升多少防御
    @atk_agi = 0    # 每提升一次力量附加提升多少速度
    @atk_spi = 0    # 每提升一次力量附加提升多少魔力
    @atk_atk = 1    # 每提升一次力量附加提升多少力量
    #=========================================================================
    # 每提升一次防御,提升多少附加能力
    #=========================================================================
    @def_hp = 2     # 每提升一次灵巧附加提升多少HP
    @def_mp = 2     # 每提升一次灵巧附加提升多少MP
    @def_atk = 0    # 每提升一次灵巧附加提升多少力量
    @def_agi = 0    # 每提升一次灵巧附加提升多少速度
    @def_spi = 0    # 每提升一次灵巧附加提升多少魔力
    @def_def = 1    # 每提升一次灵巧附加提升多少防御
    #=========================================================================
    # 每提升一次速度,提升多少附加能力
    #=========================================================================
    @agi_hp = 1     # 每提升一次速度附加提升多少HP
    @agi_mp = 1     # 每提升一次速度附加提升多少MP
    @agi_atk = 0    # 每提升一次速度附加提升多少力量
    @agi_def = 0    # 每提升一次速度附加提升多少防御
    @agi_spi = 0    # 每提升一次速度附加提升多少魔力
    @agi_agi = 1    # 每提升一次速度附加提升多少速度
    #=========================================================================
    # 每提升一次魔力,提升多少附加能力
    #=========================================================================
    @spi_hp = 0     # 每提升一次魔力附加提升多少HP
    @spi_mp = 5    # 每提升一次魔力附加提升多少MP
    @spi_atk = 0   # 每提升一次魔力附加提升多少力量
    @spi_def = 0   # 每提升一次魔力附加提升多少防御
    @spi_agi = 0   # 每提升一次魔力附加提升多少速度
    @spi_spi = 1   # 每提升一次魔力附加提升多少魔力
    #=========================================================================
    # 每提升一次体力,提升多少附加能力
    #=========================================================================
    @hp = 10       # 每提升一次体力提升多少HP
    @mp =  1      # 每提升一次体力提升多少MP
    @hp_atk = 0   # 每提升一次体力提升多少力量
    @hp_def = 0   # 每提升一次体力提升多少速度
    @hp_agi = 0   # 每提升一次体力提升多少灵巧
    @hp_spi = 0   # 每提升一次体力提升多少魔力   
    # 定义说明文字
    @text_hp_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_Menu.new(5)#x是选项光标位置  从0开始算
      return
    end
    #=============================================================
    # 按下 C 键的情况下
    #=============================================================
    if Input.trigger?(Input::C)      
      if @command_window.index == 5
          # 演奏确定 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_Lvup.new(@actor_index , @command_window.index)
        return
      end
      if @command_window.index == 6
          # 演奏确定 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 + @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 2  # 增加防御
      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 3  # 增加速度
      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 4  # 增加魔力
      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 5 # 保存设定
      @help_window.lvup_text(@text_save)
    when 6 # 点数重置
      @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)
  end
end
回复

使用道具 举报

梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-5-4
回帖
5
 楼主| 发表于 2013-5-6 22:29:41 | 显示全部楼层
2432051798 发表于 2013-5-6 22:27
这是升级加点脚本,非常感谢
#============================================================== ...

= = 搞错了,sorry
  1. #==============================================================================
  2. # 本脚本来自,使用和转载请保留此信息
  3. #==============================================================================

  4. # 脚本使用设定:

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

  231. class Window_Lvpoint < Window_Base
  232.   def initialize
  233.     super(0,198,128,58)
  234.     refresh
  235.   end
  236.   def refresh
  237.     self.contents.clear
  238.     draw_actor_lvup(@actor, 0, 0, 4)
  239.   end
  240. end
  241. #==============================================================================
  242. # ■ Window_lvup
  243. #------------------------------------------------------------------------------
  244. #  显示升级状态窗口。
  245. #==============================================================================
  246. class Window_Lvup < Window_Base
  247.   #--------------------------------------------------------------------------
  248.   # ● 初始化对像
  249.   #     actor : 角色
  250.   #--------------------------------------------------------------------------
  251.   def initialize(actor)
  252.     super(0, 0, 416, 256)
  253.     self.contents = Bitmap.new(width - 32, height - 32)
  254.     @actor = actor
  255.     refresh
  256.   end  
  257.   #--------------------------------------------------------------------------
  258.   # ● 刷新
  259.   #--------------------------------------------------------------------------
  260.   def refresh
  261.     self.contents.clear
  262.     draw_actor_graphic(@actor, 30, 80)
  263.     draw_actor_name(@actor, 4, 0)
  264.     draw_actor_class(@actor, 96, 0)
  265.     draw_actor_level(@actor, 224, 0)
  266.     draw_actor_state(@actor, 96, 32)   
  267.     draw_actor_hp_lvup(@actor, 96, 32)
  268.     draw_actor_mp_lvup(@actor, 96, 64)
  269.     draw_actor_lvup(@actor, 4, 96, 0)
  270.     draw_actor_lvup(@actor, 4, 128, 1)
  271.     draw_actor_lvup(@actor, 4, 160, 2)
  272.     draw_actor_lvup(@actor, 4, 192, 3)
  273.   end
  274. end
  275. #==============================================================================
  276. # ■ Window_Help
  277. #------------------------------------------------------------------------------
  278. #  特技及物品的说明、角色的状态显示的窗口。
  279. #==============================================================================
  280. class Window_Lvup_Help < Window_Base
  281.   #--------------------------------------------------------------------------
  282.   # ● 初始化对像
  283.   #--------------------------------------------------------------------------
  284.   def initialize
  285.     super(0, 256, 544, 160)
  286.     self.contents = Bitmap.new(width - 32, height - 32)
  287.     @test = "" #——这个东西用来检测,节约内存专用
  288.   end  
  289.   #--------------------------------------------------------------------------
  290.   # ● 设置文本
  291.   #--------------------------------------------------------------------------
  292.   def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil)
  293.     if @test != text1
  294.       @test = text1
  295.     else
  296.       return
  297.     end   
  298.     self.contents.clear
  299.     self.contents.font.color = normal_color
  300.     self.contents.draw_text(4, 0, self.width - 40, 32, text1)
  301.     if text2 != nil
  302.       self.contents.draw_text(4 , 32, self.width - 40, 32, text2)
  303.     end
  304.     self.contents.font.size -= 4
  305.     if text3 != nil
  306.       self.contents.draw_text(4 , 64, self.width - 40, 32, text3)
  307.     end
  308.     if text4 != nil
  309.       self.contents.draw_text(4 , 96, self.width - 40, 32, text4)
  310.     end
  311.     self.contents.font.size += 4
  312.   end
  313. end
  314. #==============================================================================
  315. # ■ Scene_lvup
  316. #------------------------------------------------------------------------------
  317. #  处理升级画面的类。
  318. #==============================================================================
  319. class Scene_Lvup
  320.   #--------------------------------------------------------------------------
  321.   # ● 初始化对像
  322.   #     actor_index : 角色索引
  323.   #     menu_index : 选项起始位置
  324.   #--------------------------------------------------------------------------
  325.   def initialize(actor_index = 0 , menu_index = 0)
  326.     @actor_index = actor_index
  327.     @menu_index = menu_index
  328.   end
  329.   #--------------------------------------------------------------------------
  330.   # ● 主处理
  331.   #--------------------------------------------------------------------------
  332.   def main
  333.     s1 = "增加HP"
  334.     s2 = "增加"+Vocab::atk
  335.     s3 = "增加"+Vocab::def
  336.     s4 = "增加"+Vocab::agi
  337.     s5 = "增加"+Vocab::spi
  338.     s6 = "确认加点"
  339.     s7 = "重新分配"
  340.     @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7])
  341.     @command_window.index = @menu_index
  342.     # 获取角色
  343.     @actor = $game_party.members[@actor_index]
  344.     # 将角色的剩余点数带入
  345.     $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  346.     # 初始化临时量
  347.     $temp_atk = 0
  348.     $temp_def = 0
  349.     $temp_agi = 0
  350.     $temp_spi = 0
  351.     $temp_hp = 0
  352.     $temp_mp = 0
  353.     #=========================================================================
  354.     # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
  355.     #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
  356.     #=========================================================================
  357.     # 每提升一次力量,提升多少附加能力
  358.     #=========================================================================
  359.     @atk_hp = 2     # 每提升一次力量附加提升多少HP
  360.     @atk_mp = 0     # 每提升一次力量附加提升多少MP
  361.     @atk_def = 0    # 每提升一次力量附加提升多少防御
  362.     @atk_agi = 0    # 每提升一次力量附加提升多少速度
  363.     @atk_spi = 0    # 每提升一次力量附加提升多少魔力
  364.     @atk_atk = 1    # 每提升一次力量附加提升多少力量
  365.     #=========================================================================
  366.     # 每提升一次防御,提升多少附加能力
  367.     #=========================================================================
  368.     @def_hp = 2     # 每提升一次灵巧附加提升多少HP
  369.     @def_mp = 2     # 每提升一次灵巧附加提升多少MP
  370.     @def_atk = 0    # 每提升一次灵巧附加提升多少力量
  371.     @def_agi = 0    # 每提升一次灵巧附加提升多少速度
  372.     @def_spi = 0    # 每提升一次灵巧附加提升多少魔力
  373.     @def_def = 1    # 每提升一次灵巧附加提升多少防御
  374.     #=========================================================================
  375.     # 每提升一次速度,提升多少附加能力
  376.     #=========================================================================
  377.     @agi_hp = 1     # 每提升一次速度附加提升多少HP
  378.     @agi_mp = 1     # 每提升一次速度附加提升多少MP
  379.     @agi_atk = 0    # 每提升一次速度附加提升多少力量
  380.     @agi_def = 0    # 每提升一次速度附加提升多少防御
  381.     @agi_spi = 0    # 每提升一次速度附加提升多少魔力
  382.     @agi_agi = 1    # 每提升一次速度附加提升多少速度
  383.     #=========================================================================
  384.     # 每提升一次魔力,提升多少附加能力
  385.     #=========================================================================
  386.     @spi_hp = 0     # 每提升一次魔力附加提升多少HP
  387.     @spi_mp = 5    # 每提升一次魔力附加提升多少MP
  388.     @spi_atk = 0   # 每提升一次魔力附加提升多少力量
  389.     @spi_def = 0   # 每提升一次魔力附加提升多少防御
  390.     @spi_agi = 0   # 每提升一次魔力附加提升多少速度
  391.     @spi_spi = 1   # 每提升一次魔力附加提升多少魔力
  392.     #=========================================================================
  393.     # 每提升一次体力,提升多少附加能力
  394.     #=========================================================================
  395.     @hp = 10       # 每提升一次体力提升多少HP
  396.     @mp =  1      # 每提升一次体力提升多少MP
  397.     @hp_atk = 0   # 每提升一次体力提升多少力量
  398.     @hp_def = 0   # 每提升一次体力提升多少速度
  399.     @hp_agi = 0   # 每提升一次体力提升多少灵巧
  400.     @hp_spi = 0   # 每提升一次体力提升多少魔力   
  401.     # 定义说明文字
  402.     @text_hp_sc = "体力可以增加生存的能力,可以延长生存的时间!"
  403.     @text_atk_sc = Vocab::atk + "可以增加物理攻击和物理技能的威力!"
  404.     @text_def_sc = Vocab::def + "可以提高物理防御能力!"
  405.     @text_agi_sc = Vocab::agi + "可以提高回避、命中、逃跑成功率!"
  406.     @text_spi_sc = Vocab::spi + "可以提高吟唱魔法的威力!"
  407.     @text_save = "保存分配情况并返回游戏"
  408.     @text_reset= "重新分配能力点数"
  409.     @text_2 = "每增加一次此项能力值,可以提升能力值"
  410.     @text_hp = "最大" + Vocab::hp + "值"
  411.     @text_mp = "最大" + Vocab::mp + "值"
  412.     @text_atk = "最大" + Vocab::atk + "值"
  413.     @text_def = "最大" + Vocab::def + "值"
  414.     @text_agi = "最大" + Vocab::agi + "值"
  415.     @text_spi = "最大" + Vocab::spi + "值"
  416.     s_disable
  417.     # 生成状态窗口
  418.     @lvup_window = Window_Lvup.new(@actor)
  419.     @lvup_window.x = 128
  420.     @lvup_window.y = 0   
  421.     @lvpoint_window = Window_Lvpoint.new
  422.     # 生成帮助窗口并初始化帮助文本
  423.     @help_window = Window_Lvup_Help.new   
  424.     # 执行过渡
  425.     Graphics.transition
  426.     # 主循环
  427.     loop do
  428.       # 刷新游戏画面
  429.       Graphics.update
  430.       # 刷新输入信息
  431.       Input.update
  432.       # 刷新画面
  433.       update
  434.       # 如果切换画面就中断循环
  435.       if $scene != self
  436.         break
  437.       end
  438.     end
  439.     # 准备过渡
  440.     Graphics.freeze
  441.     # 释放窗口
  442.     @lvpoint_window.dispose
  443.     @command_window.dispose
  444.     @lvup_window.dispose
  445.     @help_window.dispose
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # ● 刷新画面
  449.   #--------------------------------------------------------------------------
  450.   def update
  451.     # 刷新窗口
  452.     @command_window.update
  453.     # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
  454.     s_disable
  455.     @lvup_window.update
  456.     #=============================================================
  457.     # 按下 B 键的情况下
  458.     #=============================================================
  459.     if Input.trigger?(Input::B)
  460.       # 演奏取消 SE
  461.       Sound.play_cancel
  462.       # 切换画面
  463.       $scene = Scene_Menu.new(5)#x是选项光标位置  从0开始算
  464.       return
  465.     end
  466.     #=============================================================
  467.     # 按下 C 键的情况下
  468.     #=============================================================
  469.     if Input.trigger?(Input::C)      
  470.       if @command_window.index == 5
  471.           # 演奏确定 SE
  472.         Sound.play_decision
  473.         # 将角色的剩余点数带回
  474.         $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
  475.         # 将角色点数实际加上
  476.         @actor.atk += $temp_atk
  477.         @actor.def += $temp_def
  478.         @actor.agi += $temp_agi
  479.         @actor.spi += $temp_spi
  480.         @actor.maxhp += $temp_hp
  481.         @actor.maxmp += $temp_mp
  482.         # 切换画面
  483.         $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  484.         return
  485.       end
  486.       if @command_window.index == 6
  487.           # 演奏确定 SE
  488.         Sound.play_decision
  489.           # 将角色的剩余点数带入
  490.         $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  491.           # 初始化临时量
  492.         $temp_atk = 0
  493.         $temp_def = 0
  494.         $temp_agi = 0
  495.         $temp_spi = 0
  496.         $temp_hp = 0
  497.         $temp_mp = 0
  498.         @lvup_window.refresh
  499.         @lvpoint_window.refresh
  500.         return
  501.       end
  502.       if $point == 0
  503.         # 演奏冻结 SE
  504.         Sound.play_buzzer
  505.         return
  506.       end
  507.       case @command_window.index
  508.       when 0
  509.         # 演奏确定 SE
  510.         Sound.play_decision
  511.         $temp_hp += @hp
  512.         $temp_mp += @mp
  513.         $temp_atk += @hp_atk
  514.         $temp_def += @hp_def
  515.         $temp_agi += @hp_agi
  516.         $temp_spi += @hp_spi
  517.         $point -= 1
  518.         @lvup_window.refresh
  519.         @lvpoint_window.refresh
  520.         s_disable
  521.         return
  522.       when 1
  523.         # 演奏确定 SE
  524.         Sound.play_decision
  525.         $temp_atk += @atk_atk
  526.         $temp_hp += @atk_hp
  527.         $temp_mp += @atk_mp
  528.         $temp_def += @atk_def
  529.         $temp_agi += @atk_agi
  530.         $temp_spi += @atk_spi
  531.         $point -= 1
  532.         @lvup_window.refresh
  533.         @lvpoint_window.refresh
  534.         s_disable
  535.         return
  536.       when 2
  537.         # 演奏确定 SE
  538.         Sound.play_decision
  539.         $temp_def += @def_def
  540.         $temp_hp += @def_hp
  541.         $temp_mp += @def_mp
  542.         $temp_atk += @def_atk
  543.         $temp_agi += @def_agi
  544.         $temp_spi += @def_spi
  545.         $point -= 1
  546.         @lvup_window.refresh
  547.         @lvpoint_window.refresh
  548.         s_disable
  549.         return
  550.       when 3
  551.         # 演奏确定 SE
  552.         Sound.play_decision
  553.         $temp_agi += @agi_agi
  554.         $temp_hp += @agi_hp
  555.         $temp_mp += @agi_mp
  556.         $temp_atk += @agi_atk
  557.         $temp_def += @agi_def
  558.         $temp_spi += @agi_spi
  559.         $point -= 1
  560.         @lvup_window.refresh
  561.         @lvpoint_window.refresh
  562.         s_disable
  563.         return
  564.       when 4
  565.         # 演奏确定 SE
  566.         Sound.play_decision
  567.         $temp_spi += @spi_spi
  568.         $temp_hp += @spi_hp
  569.         $temp_mp += @spi_mp
  570.         $temp_atk += @spi_atk
  571.         $temp_def += @spi_def
  572.         $temp_agi += @spi_agi
  573.         $point -= 1
  574.         @lvup_window.refresh
  575.         @lvpoint_window.refresh
  576.         s_disable
  577.         return
  578.       end
  579.     end
  580.     #=============================================================
  581.     # 什么都没有按下的情况
  582.     #=============================================================
  583.     case @command_window.index   
  584.     when 0  # 增加体力
  585.       temptext1 = @text_hp + @hp.to_s + "点   " + @text_atk + @hp_atk.to_s + "点   " + @text_def + @hp_def.to_s + "点"
  586.       temptext2 = @text_mp + @mp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_spi + @hp_spi.to_s + "点"
  587.       @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
  588.     when 1  # 增加力量
  589.       temptext1 = @text_hp + @atk_hp.to_s + "点   " + @text_atk + @atk_atk.to_s + "点   " + @text_def + @atk_def.to_s + "点"
  590.       temptext2 = @text_mp + @atk_mp.to_s + "点   " + @text_agi + @atk_agi.to_s + "点   " + @text_spi + @atk_spi.to_s + "点"
  591.       @help_window.lvup_text(@text_atk_sc , @text_2 , temptext1 , temptext2)
  592.     when 2  # 增加防御
  593.       temptext1 = @text_hp + @def_hp.to_s + "点   " + @text_atk + @def_agi.to_s + "点   " + @text_def + @def_def.to_s + "点"
  594.       temptext2 = @text_mp + @def_mp.to_s + "点   " + @text_agi + @def_agi.to_s + "点   " + @text_spi + @def_spi.to_s + "点"
  595.       @help_window.lvup_text(@text_def_sc , @text_2 , temptext1 , temptext2)
  596.     when 3  # 增加速度
  597.       temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_atk + @agi_atk.to_s + "点   " + @text_def + @agi_def.to_s + "点"
  598.       temptext2 = @text_mp + @agi_mp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_spi + @agi_spi.to_s + "点"
  599.       @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
  600.     when 4  # 增加魔力
  601.       temptext1 = @text_hp + @spi_hp.to_s + "点   " + @text_atk + @spi_atk.to_s + "点   " + @text_def + @spi_def.to_s + "点"
  602.       temptext2 = @text_mp + @spi_mp.to_s + "点   " + @text_agi + @spi_agi.to_s + "点   " + @text_spi + @spi_spi.to_s + "点"
  603.       @help_window.lvup_text(@text_spi_sc , @text_2 , temptext1 , temptext2)
  604.     when 5 # 保存设定
  605.       @help_window.lvup_text(@text_save)
  606.     when 6 # 点数重置
  607.       @help_window.lvup_text(@text_reset)     
  608.     end
  609.     #=============================================================
  610.     # 按下R与L换人的情况
  611.     #=============================================================      
  612.     if Input.trigger?(Input::R)
  613.       # 演奏光标 SE
  614.       Sound.play_cursor
  615.       # 移至下一位角色
  616.       @actor_index += 1
  617.       @actor_index %= $game_party.members.size
  618.       # 切换到别的状态画面
  619.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  620.       return
  621.     end
  622.     # 按下 L 键的情况下
  623.     if Input.trigger?(Input::L)
  624.       # 演奏光标 SE
  625.       Sound.play_cursor
  626.       # 移至上一位角色
  627.       @actor_index += $game_party.members.size - 1
  628.       @actor_index %= $game_party.members.size
  629.       # 切换到别的状态画面
  630.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  631.       return
  632.     end
  633.   end  
  634.   #--------------------------------------------------------------------------
  635.   # ● 选项明暗判断
  636.   #--------------------------------------------------------------------------
  637.   def s_disable
  638.     # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
  639.     if $point == 0
  640.       enabled = false
  641.     else
  642.       enabled = true
  643.     end
  644.       @command_window.draw_item(0,enabled)
  645.       @command_window.draw_item(1,enabled)
  646.       @command_window.draw_item(2,enabled)
  647.       @command_window.draw_item(3,enabled)
  648.       @command_window.draw_item(4,enabled)
  649.   end
  650. end
复制代码

点评

请善于使用“编辑”。  发表于 2013-5-6 22:35
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部