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

Project1

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

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-5-4
帖子
6
跳转到指定楼层
1
发表于 2013-5-5 08:59:44 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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

还有,脚本我是直接黏贴上去的 = =、

Lv1.梦旅人

梦石
0
星屑
50
在线时间
25 小时
注册时间
2013-4-4
帖子
17
2
发表于 2013-5-5 09:15:31 | 只看该作者
這個之前有人問過了 請善用搜索功能 點我傳送 或我
回复 支持 反对

使用道具 举报

Lv1.梦旅人

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

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

使用道具 举报

Lv4.逐梦者

送快递的水表员

梦石
10
星屑
4847
在线时间
3303 小时
注册时间
2012-6-27
帖子
7160

开拓者贵宾

4
发表于 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     第三楼
回复 支持 反对

使用道具 举报

Lv1.梦旅人

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

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

QQ截图20130506135450.png (213.85 KB, 下载次数: 27)

QQ截图20130506135450.png
回复 支持 反对

使用道具 举报

Lv1.梦旅人

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

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

使用道具 举报

Lv4.逐梦者

送快递的水表员

梦石
10
星屑
4847
在线时间
3303 小时
注册时间
2012-6-27
帖子
7160

开拓者贵宾

7
发表于 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 又是这个问题

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-5-4
帖子
6
8
 楼主| 发表于 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
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2013-5-4
帖子
6
9
 楼主| 发表于 2013-5-6 22:29:41 | 只看该作者
2432051798 发表于 2013-5-6 22:27
这是升级加点脚本,非常感谢
#============================================================== ...

= = 搞错了,sorry
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自,使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5. # 脚本使用设定:
  6.  
  7. LEVEL_UP_POINT = 3  # 每升一级所增加的点数
  8. LEVEL_UP_VARIABLE = 100  # 储存角色点数的变量编号与角色id编号的差值
  9.                          # 默认情况 = 100,
  10.                          # 则是数据库里1号角色的加点数存于101号变量
  11.                          # 3号角色的加点数存于103号变量。
  12.                          # 你可以直接操作变量赠与角色可分配点数
  13.  
  14. # 每增加一次点数,各项能力值的变化:357-410行
  15.  
  16. # 使用方法介绍:
  17.  
  18. # 本脚本不会取代原来的升级自动加点 也就是说,默认的升级还在,但可以用这个功能手动追加点数。
  19. # 如果你想纯粹使用手动加点(而升级不提升能力),只要把数据库中角色升级能力,
  20. # 1-99级全部等于一个相同数值就行了。
  21.  
  22. # 呼唤加点场景的方法:$scene = Scene_Lvup.new(角色编号,返回菜单编号)。
  23. # 默认都是0号
  24.  
  25. # 加点场景中,page up,page down换人,如果想加点完毕后返回地图,
  26. # 464行$scene = Scene_Menu.new(0)改为$scene = Scene_Map.new
  27.  
  28. # 推荐脚本搭配:魔法商店脚本,两者结合,制作自由型RPG
  29.  
  30. #==============================================================================
  31. # ■ Window_Command
  32. #------------------------------------------------------------------------------
  33. #  一般的命令选择行窗口。(追加定义)
  34. #==============================================================================
  35. class Window_Command < Window_Selectable
  36.   #--------------------------------------------------------------------------
  37.   # ● 项目有效化
  38.   #     index : 项目编号
  39.   #--------------------------------------------------------------------------
  40.   def able_item(index)
  41.     draw_item(index, normal_color)
  42.   end
  43. end
  44. #==============================================================================
  45. # ■ Game_Actor
  46. #------------------------------------------------------------------------------
  47. #  处理角色的类。(再定义)
  48. #==============================================================================
  49.  
  50. class Game_Actor < Game_Battler
  51.   def level_up
  52.     [url=home.php?mod=space&uid=22147]@level[/url] += 1
  53.     $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
  54.     for learning in self.class.learnings
  55.       learn_skill(learning.skill_id) if learning.level == @level
  56.     end
  57.   end
  58. end
  59. #==============================================================================
  60. # ■ Window_Base
  61. #------------------------------------------------------------------------------
  62. #  游戏中全部窗口的超级类(追加定义)
  63. #==============================================================================
  64. class Window_Base < Window
  65.   #--------------------------------------------------------------------------
  66.   # ● 描绘 HP
  67.   #     actor : 角色
  68.   #     x     : 描画目标 X 坐标
  69.   #     y     : 描画目标 Y 坐标
  70.   #     width : 描画目标的宽
  71.   #--------------------------------------------------------------------------
  72.   def draw_actor_hp_lvup(actor, x, y)
  73.     self.contents.font.color = system_color
  74.     self.contents.draw_text(x , y, 96, 32, "最大" + Vocab::hp)
  75.     if $temp_hp == 0
  76.       self.contents.font.color = normal_color
  77.       self.contents.draw_text(x + 120 , y, 48, 32, actor.maxhp.to_s, 2)
  78.     else
  79.       maxhp = actor.maxhp + $temp_hp
  80.       self.contents.font.color = Color.new(255, 128, 128, 255)
  81.       self.contents.draw_text(x + 120 , y, 48, 32, maxhp.to_s ,2)
  82.       self.contents.font.color = normal_color      
  83.       self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
  84.       if $temp_hp >=0
  85.         self.contents.font.color = Color.new(255, 128, 128, 255)
  86.         self.contents.draw_text(x + 155, y, 36, 32, " +",2)
  87.       else
  88.         self.contents.font.color = Color.new(255,255,0,255)
  89.         self.contents.draw_text(x + 155, y, 36, 32, " -",2)
  90.       end
  91.       self.contents.draw_text(x + 200, y, 36, 32, $temp_hp.to_s, 2)
  92.       self.contents.font.color = normal_color
  93.       self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
  94.     end
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● 描绘 MP
  98.   #     actor : 角色
  99.   #     x     : 描画目标 X 坐标
  100.   #     y     : 描画目标 Y 坐标
  101.   #     width : 描画目标的宽
  102.   #--------------------------------------------------------------------------
  103.   def draw_actor_mp_lvup(actor, x, y)
  104.     self.contents.font.color = system_color
  105.     self.contents.draw_text(x , y, 96, 32, "最大" + Vocab::mp)
  106.     if $temp_mp == 0
  107.       self.contents.font.color = normal_color
  108.       self.contents.draw_text(x + 120 , y, 48, 32, actor.maxmp.to_s, 2)
  109.     else
  110.       maxmp = actor.maxmp + $temp_mp
  111.       self.contents.font.color = Color.new(255, 128, 128, 255)
  112.       self.contents.draw_text(x + 120 , y, 48, 32, maxmp.to_s ,2)
  113.       self.contents.font.color = normal_color      
  114.       self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
  115.       if $temp_mp >=0
  116.         self.contents.font.color = Color.new(255, 128, 128, 255)
  117.         self.contents.draw_text(x + 155, y, 36, 32, " +",2)
  118.       else
  119.         self.contents.font.color = Color.new(255,255,0,255)
  120.         self.contents.draw_text(x + 155, y, 36, 32, " -",2)
  121.       end
  122.       self.contents.draw_text(x + 200, y, 36, 32, $temp_mp.to_s, 2)
  123.       self.contents.font.color = normal_color
  124.       self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
  125.     end
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 描绘能力值
  129.   #     actor : 角色
  130.   #     x     : 描画目标 X 坐标
  131.   #     y     : 描画目标 Y 坐标
  132.   #     type  : 能力值种类 (0~4)
  133.   #--------------------------------------------------------------------------
  134.   def draw_actor_lvup(actor, x, y, type)   
  135.     # 定义数字颜色
  136.     lvup = normal_color
  137.     upcolor = Color.new(255, 128, 128, 255)
  138.     self.contents.font.color = normal_color   
  139.     case type
  140.     when 0
  141.       parameter_name = Vocab::atk
  142.       parameter_value = actor.atk
  143.       parameter_value_temp = parameter_value + $temp_atk
  144.       if $temp_atk != 0
  145.         lvup = upcolor
  146.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  147.         if $temp_atk >= 0
  148.           self.contents.font.color = lvup
  149.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  150.         else
  151.           self.contents.font.color = Color.new(255,255,0,255)
  152.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  153.         end        
  154.         self.contents.draw_text(x + 272, y, 80, 32, $temp_atk.abs.to_s,1)
  155.         self.contents.font.color = normal_color
  156.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  157.       end
  158.     when 1
  159.       parameter_name = Vocab::def
  160.       parameter_value = actor.def
  161.       parameter_value_temp = parameter_value + $temp_def
  162.       if $temp_def != 0
  163.         lvup = upcolor
  164.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  165.         if $temp_def >= 0
  166.           self.contents.font.color = lvup
  167.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  168.         else
  169.           self.contents.font.color = Color.new(255,255,0,255)
  170.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  171.         end        
  172.         self.contents.draw_text(x + 272, y, 80, 32, $temp_def.abs.to_s,1)
  173.         self.contents.font.color = normal_color
  174.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  175.       end
  176.     when 2
  177.       parameter_name = Vocab::agi
  178.       parameter_value = actor.agi
  179.       parameter_value_temp = parameter_value + $temp_agi
  180.       if $temp_agi != 0
  181.         lvup = upcolor
  182.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  183.         if $temp_agi >= 0
  184.           self.contents.font.color = lvup
  185.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  186.         else
  187.           self.contents.font.color = Color.new(255,255,0,255)
  188.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  189.         end        
  190.         self.contents.draw_text(x + 272, y, 80, 32, $temp_agi.abs.to_s,1)
  191.         self.contents.font.color = normal_color
  192.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  193.       end
  194.     when 3
  195.       parameter_name = Vocab::spi
  196.       parameter_value = actor.spi
  197.       parameter_value_temp = parameter_value + $temp_spi
  198.       if $temp_spi != 0
  199.         lvup = upcolor
  200.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  201.         if $temp_spi >= 0
  202.           self.contents.font.color = lvup
  203.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  204.         else
  205.           self.contents.font.color = Color.new(255,255,0,255)
  206.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  207.         end        
  208.         self.contents.draw_text(x + 272, y, 80, 32, $temp_spi.abs.to_s,1)
  209.         self.contents.font.color = normal_color
  210.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  211.       end
  212.     when 4
  213.       parameter_name = "剩余点数"
  214.       parameter_value = $point
  215.       if $point != 0
  216.         lvup = upcolor
  217.       end
  218.     end   
  219.     self.contents.font.size = 16 if type == 4
  220.     self.contents.font.color = system_color
  221.     if type != 4 then
  222.       self.contents.draw_text(x, y, 120, 32, parameter_name)
  223.     else
  224.       self.contents.draw_text(x, y, 120, 24, parameter_name)
  225.     end
  226.     self.contents.font.color = normal_color
  227.     if type != 4
  228.       self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s)   
  229.     else
  230.       self.contents.draw_text(x + 68, y, 36, 24, parameter_value.to_s)   
  231.     end
  232.     if type != 4
  233.       self.contents.draw_text(x + 150, y, 36, 32, "→")
  234.     end  
  235.     self.contents.font.color = lvup
  236.     self.contents.draw_text(x + 180, y, 60, 32, parameter_value_temp.to_s)
  237.     self.contents.font.color = normal_color        
  238.   end
  239. end
  240.  
  241. class Window_Lvpoint < Window_Base
  242.   def initialize
  243.     super(0,198,128,58)
  244.     refresh
  245.   end
  246.   def refresh
  247.     self.contents.clear
  248.     draw_actor_lvup(@actor, 0, 0, 4)
  249.   end
  250. end
  251. #==============================================================================
  252. # ■ Window_lvup
  253. #------------------------------------------------------------------------------
  254. #  显示升级状态窗口。
  255. #==============================================================================
  256. class Window_Lvup < Window_Base
  257.   #--------------------------------------------------------------------------
  258.   # ● 初始化对像
  259.   #     actor : 角色
  260.   #--------------------------------------------------------------------------
  261.   def initialize(actor)
  262.     super(0, 0, 416, 256)
  263.     self.contents = Bitmap.new(width - 32, height - 32)
  264.     @actor = actor
  265.     refresh
  266.   end  
  267.   #--------------------------------------------------------------------------
  268.   # ● 刷新
  269.   #--------------------------------------------------------------------------
  270.   def refresh
  271.     self.contents.clear
  272.     draw_actor_graphic(@actor, 30, 80)
  273.     draw_actor_name(@actor, 4, 0)
  274.     draw_actor_class(@actor, 96, 0)
  275.     draw_actor_level(@actor, 224, 0)
  276.     draw_actor_state(@actor, 96, 32)   
  277.     draw_actor_hp_lvup(@actor, 96, 32)
  278.     draw_actor_mp_lvup(@actor, 96, 64)
  279.     draw_actor_lvup(@actor, 4, 96, 0)
  280.     draw_actor_lvup(@actor, 4, 128, 1)
  281.     draw_actor_lvup(@actor, 4, 160, 2)
  282.     draw_actor_lvup(@actor, 4, 192, 3)
  283.   end
  284. end
  285. #==============================================================================
  286. # ■ Window_Help
  287. #------------------------------------------------------------------------------
  288. #  特技及物品的说明、角色的状态显示的窗口。
  289. #==============================================================================
  290. class Window_Lvup_Help < Window_Base
  291.   #--------------------------------------------------------------------------
  292.   # ● 初始化对像
  293.   #--------------------------------------------------------------------------
  294.   def initialize
  295.     super(0, 256, 544, 160)
  296.     self.contents = Bitmap.new(width - 32, height - 32)
  297.     @test = "" #——这个东西用来检测,节约内存专用
  298.   end  
  299.   #--------------------------------------------------------------------------
  300.   # ● 设置文本
  301.   #--------------------------------------------------------------------------
  302.   def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil)
  303.     if @test != text1
  304.       @test = text1
  305.     else
  306.       return
  307.     end   
  308.     self.contents.clear
  309.     self.contents.font.color = normal_color
  310.     self.contents.draw_text(4, 0, self.width - 40, 32, text1)
  311.     if text2 != nil
  312.       self.contents.draw_text(4 , 32, self.width - 40, 32, text2)
  313.     end
  314.     self.contents.font.size -= 4
  315.     if text3 != nil
  316.       self.contents.draw_text(4 , 64, self.width - 40, 32, text3)
  317.     end
  318.     if text4 != nil
  319.       self.contents.draw_text(4 , 96, self.width - 40, 32, text4)
  320.     end
  321.     self.contents.font.size += 4
  322.   end
  323. end
  324. #==============================================================================
  325. # ■ Scene_lvup
  326. #------------------------------------------------------------------------------
  327. #  处理升级画面的类。
  328. #==============================================================================
  329. class Scene_Lvup
  330.   #--------------------------------------------------------------------------
  331.   # ● 初始化对像
  332.   #     actor_index : 角色索引
  333.   #     menu_index : 选项起始位置
  334.   #--------------------------------------------------------------------------
  335.   def initialize(actor_index = 0 , menu_index = 0)
  336.     @actor_index = actor_index
  337.     @menu_index = menu_index
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● 主处理
  341.   #--------------------------------------------------------------------------
  342.   def main
  343.     s1 = "增加HP"
  344.     s2 = "增加"+Vocab::atk
  345.     s3 = "增加"+Vocab::def
  346.     s4 = "增加"+Vocab::agi
  347.     s5 = "增加"+Vocab::spi
  348.     s6 = "确认加点"
  349.     s7 = "重新分配"
  350.     @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7])
  351.     @command_window.index = @menu_index
  352.     # 获取角色
  353.     @actor = $game_party.members[@actor_index]
  354.     # 将角色的剩余点数带入
  355.     $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  356.     # 初始化临时量
  357.     $temp_atk = 0
  358.     $temp_def = 0
  359.     $temp_agi = 0
  360.     $temp_spi = 0
  361.     $temp_hp = 0
  362.     $temp_mp = 0
  363.     #=========================================================================
  364.     # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
  365.     #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
  366.     #=========================================================================
  367.     # 每提升一次力量,提升多少附加能力
  368.     #=========================================================================
  369.     @atk_hp = 2     # 每提升一次力量附加提升多少HP
  370.     @atk_mp = 0     # 每提升一次力量附加提升多少MP
  371.     @atk_def = 0    # 每提升一次力量附加提升多少防御
  372.     @atk_agi = 0    # 每提升一次力量附加提升多少速度
  373.     @atk_spi = 0    # 每提升一次力量附加提升多少魔力
  374.     @atk_atk = 1    # 每提升一次力量附加提升多少力量
  375.     #=========================================================================
  376.     # 每提升一次防御,提升多少附加能力
  377.     #=========================================================================
  378.     @def_hp = 2     # 每提升一次灵巧附加提升多少HP
  379.     @def_mp = 2     # 每提升一次灵巧附加提升多少MP
  380.     @def_atk = 0    # 每提升一次灵巧附加提升多少力量
  381.     @def_agi = 0    # 每提升一次灵巧附加提升多少速度
  382.     @def_spi = 0    # 每提升一次灵巧附加提升多少魔力
  383.     @def_def = 1    # 每提升一次灵巧附加提升多少防御
  384.     #=========================================================================
  385.     # 每提升一次速度,提升多少附加能力
  386.     #=========================================================================
  387.     @agi_hp = 1     # 每提升一次速度附加提升多少HP
  388.     @agi_mp = 1     # 每提升一次速度附加提升多少MP
  389.     @agi_atk = 0    # 每提升一次速度附加提升多少力量
  390.     @agi_def = 0    # 每提升一次速度附加提升多少防御
  391.     @agi_spi = 0    # 每提升一次速度附加提升多少魔力
  392.     @agi_agi = 1    # 每提升一次速度附加提升多少速度
  393.     #=========================================================================
  394.     # 每提升一次魔力,提升多少附加能力
  395.     #=========================================================================
  396.     @spi_hp = 0     # 每提升一次魔力附加提升多少HP
  397.     @spi_mp = 5    # 每提升一次魔力附加提升多少MP
  398.     @spi_atk = 0   # 每提升一次魔力附加提升多少力量
  399.     @spi_def = 0   # 每提升一次魔力附加提升多少防御
  400.     @spi_agi = 0   # 每提升一次魔力附加提升多少速度
  401.     @spi_spi = 1   # 每提升一次魔力附加提升多少魔力
  402.     #=========================================================================
  403.     # 每提升一次体力,提升多少附加能力
  404.     #=========================================================================
  405.     @hp = 10       # 每提升一次体力提升多少HP
  406.     @mp =  1      # 每提升一次体力提升多少MP
  407.     @hp_atk = 0   # 每提升一次体力提升多少力量
  408.     @hp_def = 0   # 每提升一次体力提升多少速度
  409.     @hp_agi = 0   # 每提升一次体力提升多少灵巧
  410.     @hp_spi = 0   # 每提升一次体力提升多少魔力   
  411.     # 定义说明文字
  412.     @text_hp_sc = "体力可以增加生存的能力,可以延长生存的时间!"
  413.     @text_atk_sc = Vocab::atk + "可以增加物理攻击和物理技能的威力!"
  414.     @text_def_sc = Vocab::def + "可以提高物理防御能力!"
  415.     @text_agi_sc = Vocab::agi + "可以提高回避、命中、逃跑成功率!"
  416.     @text_spi_sc = Vocab::spi + "可以提高吟唱魔法的威力!"
  417.     @text_save = "保存分配情况并返回游戏"
  418.     @text_reset= "重新分配能力点数"
  419.     @text_2 = "每增加一次此项能力值,可以提升能力值"
  420.     @text_hp = "最大" + Vocab::hp + "值"
  421.     @text_mp = "最大" + Vocab::mp + "值"
  422.     @text_atk = "最大" + Vocab::atk + "值"
  423.     @text_def = "最大" + Vocab::def + "值"
  424.     @text_agi = "最大" + Vocab::agi + "值"
  425.     @text_spi = "最大" + Vocab::spi + "值"
  426.     s_disable
  427.     # 生成状态窗口
  428.     @lvup_window = Window_Lvup.new(@actor)
  429.     @lvup_window.x = 128
  430.     @lvup_window.y = 0   
  431.     @lvpoint_window = Window_Lvpoint.new
  432.     # 生成帮助窗口并初始化帮助文本
  433.     @help_window = Window_Lvup_Help.new   
  434.     # 执行过渡
  435.     Graphics.transition
  436.     # 主循环
  437.     loop do
  438.       # 刷新游戏画面
  439.       Graphics.update
  440.       # 刷新输入信息
  441.       Input.update
  442.       # 刷新画面
  443.       update
  444.       # 如果切换画面就中断循环
  445.       if $scene != self
  446.         break
  447.       end
  448.     end
  449.     # 准备过渡
  450.     Graphics.freeze
  451.     # 释放窗口
  452.     @lvpoint_window.dispose
  453.     @command_window.dispose
  454.     @lvup_window.dispose
  455.     @help_window.dispose
  456.   end
  457.   #--------------------------------------------------------------------------
  458.   # ● 刷新画面
  459.   #--------------------------------------------------------------------------
  460.   def update
  461.     # 刷新窗口
  462.     @command_window.update
  463.     # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
  464.     s_disable
  465.     @lvup_window.update
  466.     #=============================================================
  467.     # 按下 B 键的情况下
  468.     #=============================================================
  469.     if Input.trigger?(Input::B)
  470.       # 演奏取消 SE
  471.       Sound.play_cancel
  472.       # 切换画面
  473.       $scene = Scene_Menu.new(5)#x是选项光标位置  从0开始算
  474.       return
  475.     end
  476.     #=============================================================
  477.     # 按下 C 键的情况下
  478.     #=============================================================
  479.     if Input.trigger?(Input::C)      
  480.       if @command_window.index == 5
  481.           # 演奏确定 SE
  482.         Sound.play_decision
  483.         # 将角色的剩余点数带回
  484.         $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
  485.         # 将角色点数实际加上
  486.         @actor.atk += $temp_atk
  487.         @actor.def += $temp_def
  488.         @actor.agi += $temp_agi
  489.         @actor.spi += $temp_spi
  490.         @actor.maxhp += $temp_hp
  491.         @actor.maxmp += $temp_mp
  492.         # 切换画面
  493.         $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  494.         return
  495.       end
  496.       if @command_window.index == 6
  497.           # 演奏确定 SE
  498.         Sound.play_decision
  499.           # 将角色的剩余点数带入
  500.         $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  501.           # 初始化临时量
  502.         $temp_atk = 0
  503.         $temp_def = 0
  504.         $temp_agi = 0
  505.         $temp_spi = 0
  506.         $temp_hp = 0
  507.         $temp_mp = 0
  508.         @lvup_window.refresh
  509.         @lvpoint_window.refresh
  510.         return
  511.       end
  512.       if $point == 0
  513.         # 演奏冻结 SE
  514.         Sound.play_buzzer
  515.         return
  516.       end
  517.       case @command_window.index
  518.       when 0
  519.         # 演奏确定 SE
  520.         Sound.play_decision
  521.         $temp_hp += @hp
  522.         $temp_mp += @mp
  523.         $temp_atk += @hp_atk
  524.         $temp_def += @hp_def
  525.         $temp_agi += @hp_agi
  526.         $temp_spi += @hp_spi
  527.         $point -= 1
  528.         @lvup_window.refresh
  529.         @lvpoint_window.refresh
  530.         s_disable
  531.         return
  532.       when 1
  533.         # 演奏确定 SE
  534.         Sound.play_decision
  535.         $temp_atk += @atk_atk
  536.         $temp_hp += @atk_hp
  537.         $temp_mp += @atk_mp
  538.         $temp_def += @atk_def
  539.         $temp_agi += @atk_agi
  540.         $temp_spi += @atk_spi
  541.         $point -= 1
  542.         @lvup_window.refresh
  543.         @lvpoint_window.refresh
  544.         s_disable
  545.         return
  546.       when 2
  547.         # 演奏确定 SE
  548.         Sound.play_decision
  549.         $temp_def += @def_def
  550.         $temp_hp += @def_hp
  551.         $temp_mp += @def_mp
  552.         $temp_atk += @def_atk
  553.         $temp_agi += @def_agi
  554.         $temp_spi += @def_spi
  555.         $point -= 1
  556.         @lvup_window.refresh
  557.         @lvpoint_window.refresh
  558.         s_disable
  559.         return
  560.       when 3
  561.         # 演奏确定 SE
  562.         Sound.play_decision
  563.         $temp_agi += @agi_agi
  564.         $temp_hp += @agi_hp
  565.         $temp_mp += @agi_mp
  566.         $temp_atk += @agi_atk
  567.         $temp_def += @agi_def
  568.         $temp_spi += @agi_spi
  569.         $point -= 1
  570.         @lvup_window.refresh
  571.         @lvpoint_window.refresh
  572.         s_disable
  573.         return
  574.       when 4
  575.         # 演奏确定 SE
  576.         Sound.play_decision
  577.         $temp_spi += @spi_spi
  578.         $temp_hp += @spi_hp
  579.         $temp_mp += @spi_mp
  580.         $temp_atk += @spi_atk
  581.         $temp_def += @spi_def
  582.         $temp_agi += @spi_agi
  583.         $point -= 1
  584.         @lvup_window.refresh
  585.         @lvpoint_window.refresh
  586.         s_disable
  587.         return
  588.       end
  589.     end
  590.     #=============================================================
  591.     # 什么都没有按下的情况
  592.     #=============================================================
  593.     case @command_window.index   
  594.     when 0  # 增加体力
  595.       temptext1 = @text_hp + @hp.to_s + "点   " + @text_atk + @hp_atk.to_s + "点   " + @text_def + @hp_def.to_s + "点"
  596.       temptext2 = @text_mp + @mp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_spi + @hp_spi.to_s + "点"
  597.       @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
  598.     when 1  # 增加力量
  599.       temptext1 = @text_hp + @atk_hp.to_s + "点   " + @text_atk + @atk_atk.to_s + "点   " + @text_def + @atk_def.to_s + "点"
  600.       temptext2 = @text_mp + @atk_mp.to_s + "点   " + @text_agi + @atk_agi.to_s + "点   " + @text_spi + @atk_spi.to_s + "点"
  601.       @help_window.lvup_text(@text_atk_sc , @text_2 , temptext1 , temptext2)
  602.     when 2  # 增加防御
  603.       temptext1 = @text_hp + @def_hp.to_s + "点   " + @text_atk + @def_agi.to_s + "点   " + @text_def + @def_def.to_s + "点"
  604.       temptext2 = @text_mp + @def_mp.to_s + "点   " + @text_agi + @def_agi.to_s + "点   " + @text_spi + @def_spi.to_s + "点"
  605.       @help_window.lvup_text(@text_def_sc , @text_2 , temptext1 , temptext2)
  606.     when 3  # 增加速度
  607.       temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_atk + @agi_atk.to_s + "点   " + @text_def + @agi_def.to_s + "点"
  608.       temptext2 = @text_mp + @agi_mp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_spi + @agi_spi.to_s + "点"
  609.       @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
  610.     when 4  # 增加魔力
  611.       temptext1 = @text_hp + @spi_hp.to_s + "点   " + @text_atk + @spi_atk.to_s + "点   " + @text_def + @spi_def.to_s + "点"
  612.       temptext2 = @text_mp + @spi_mp.to_s + "点   " + @text_agi + @spi_agi.to_s + "点   " + @text_spi + @spi_spi.to_s + "点"
  613.       @help_window.lvup_text(@text_spi_sc , @text_2 , temptext1 , temptext2)
  614.     when 5 # 保存设定
  615.       @help_window.lvup_text(@text_save)
  616.     when 6 # 点数重置
  617.       @help_window.lvup_text(@text_reset)     
  618.     end
  619.     #=============================================================
  620.     # 按下R与L换人的情况
  621.     #=============================================================      
  622.     if Input.trigger?(Input::R)
  623.       # 演奏光标 SE
  624.       Sound.play_cursor
  625.       # 移至下一位角色
  626.       @actor_index += 1
  627.       @actor_index %= $game_party.members.size
  628.       # 切换到别的状态画面
  629.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  630.       return
  631.     end
  632.     # 按下 L 键的情况下
  633.     if Input.trigger?(Input::L)
  634.       # 演奏光标 SE
  635.       Sound.play_cursor
  636.       # 移至上一位角色
  637.       @actor_index += $game_party.members.size - 1
  638.       @actor_index %= $game_party.members.size
  639.       # 切换到别的状态画面
  640.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  641.       return
  642.     end
  643.   end  
  644.   #--------------------------------------------------------------------------
  645.   # ● 选项明暗判断
  646.   #--------------------------------------------------------------------------
  647.   def s_disable
  648.     # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
  649.     if $point == 0
  650.       enabled = false
  651.     else
  652.       enabled = true
  653.     end
  654.       @command_window.draw_item(0,enabled)
  655.       @command_window.draw_item(1,enabled)
  656.       @command_window.draw_item(2,enabled)
  657.       @command_window.draw_item(3,enabled)
  658.       @command_window.draw_item(4,enabled)
  659.   end
  660. end

点评

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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 13:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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