查看: 2621|回复: 3

[已经解决] 关于升级加点脚本

[复制链接]
梦石
0
星屑
6963
在线时间
1557 小时
注册时间
2011-6-14
回帖
425
发表于 2015-8-4 13:08:35 | 显示全部楼层 |阅读模式

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

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

×
关于升级加点脚本,如何在开启开关1后,角色每升一级所增加的点数 在原有的基础上额外增加+1
开启开关2额外增加+2 开启开关3额外增加+3 以此类推
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


  4. # 脚本使用设定:

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

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

  14. # 本脚本不会取代原猩豆δ埽皇且桓龈郊庸δ堋?BR># 也就是说,默认的升级还在,但可以用这个功能手动追加点数。
  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.   #--------------------------------------------------------------------------
  43.   # ● 更改 EXP
  44.   #     exp : 新的 EXP
  45.   #--------------------------------------------------------------------------
  46.   def exp=(exp)
  47.     @exp = [[exp, 9999999].min, 0].max
  48.     # 升级
  49.     while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
  50.       @level += 1
  51.       # 增加4点可自由分配的点数
  52.       $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
  53.       # 学会特技
  54.       for j in $data_classes[@class_id].learnings
  55.         if j.level == @level
  56.           learn_skill(j.skill_id)
  57.         end
  58.       end
  59.     end
  60.     # 降级
  61.     while @exp < @exp_list[@level]
  62.       @level -= 1
  63.     end
  64.     # 修正当前的 HP 与 SP 超过最大值
  65.     @hp = [@hp, self.maxhp].min
  66.     @sp = [@sp, self.maxsp].min
  67.   end
  68. end
  69. #==============================================================================
  70. # ■ Window_Base
  71. #------------------------------------------------------------------------------
  72. #  游戏中全部窗口的超级类(追加定义)
  73. #==============================================================================
  74. class Window_Base < Window
  75.   #--------------------------------------------------------------------------
  76.   # ● 描绘 HP
  77.   #     actor : 角色
  78.   #     x     : 描画目标 X 坐标
  79.   #     y     : 描画目标 Y 坐标
  80.   #     width : 描画目标的宽
  81.   #--------------------------------------------------------------------------
  82.   def draw_actor_hp_lvup(actor, x, y)
  83.     self.contents.font.color = system_color
  84.     self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.hp)
  85.     if $temp_hp == 0
  86.       self.contents.font.color = normal_color
  87.       self.contents.draw_text(x + 120 , y, 48, 32, actor.maxhp.to_s, 2)
  88.     else
  89.       maxhp = actor.maxhp + $temp_hp
  90.       self.contents.font.color = Color.new(255, 128, 128, 255)
  91.       self.contents.draw_text(x + 120 , y, 48, 32, maxhp.to_s ,2)
  92.       self.contents.font.color = normal_color      
  93.       self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
  94.       if $temp_hp >=0
  95.         self.contents.font.color = Color.new(255, 128, 128, 255)
  96.         self.contents.draw_text(x + 155, y, 36, 32, " +",2)
  97.       else
  98.         self.contents.font.color = Color.new(255,255,0,255)
  99.         self.contents.draw_text(x + 155, y, 36, 32, " -",2)
  100.       end
  101.       self.contents.draw_text(x + 200, y, 36, 32, $temp_hp.to_s, 2)
  102.       self.contents.font.color = normal_color
  103.       self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
  104.     end
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 描绘 SP
  108.   #     actor : 角色
  109.   #     x     : 描画目标 X 坐标
  110.   #     y     : 描画目标 Y 坐标
  111.   #     width : 描画目标的宽
  112.   #--------------------------------------------------------------------------
  113.   def draw_actor_sp_lvup(actor, x, y)
  114.     self.contents.font.color = system_color
  115.     self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.sp)
  116.     if $temp_sp == 0
  117.       self.contents.font.color = normal_color
  118.       self.contents.draw_text(x + 120 , y, 48, 32, actor.maxsp.to_s, 2)
  119.     else
  120.       maxsp = actor.maxsp + $temp_sp
  121.       self.contents.font.color = Color.new(255, 128, 128, 255)
  122.       self.contents.draw_text(x + 120 , y, 48, 32, maxsp.to_s ,2)
  123.       self.contents.font.color = normal_color      
  124.       self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
  125.       if $temp_sp >=0
  126.         self.contents.font.color = Color.new(255, 128, 128, 255)
  127.         self.contents.draw_text(x + 155, y, 36, 32, " +",2)
  128.       else
  129.         self.contents.font.color = Color.new(255,255,0,255)
  130.         self.contents.draw_text(x + 155, y, 36, 32, " -",2)
  131.       end
  132.       self.contents.draw_text(x + 200, y, 36, 32, $temp_sp.to_s, 2)
  133.       self.contents.font.color = normal_color
  134.       self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
  135.     end
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● 描绘能力值
  139.   #     actor : 角色
  140.   #     x     : 描画目标 X 坐标
  141.   #     y     : 描画目标 Y 坐标
  142.   #     type  : 能力值种类 (0~4)
  143.   #--------------------------------------------------------------------------
  144.   def draw_actor_lvup(actor, x, y, type)   
  145.     # 定义数字颜色
  146.     lvup = normal_color
  147.     upcolor = Color.new(255, 128, 128, 255)
  148.     self.contents.font.color = normal_color   
  149.     case type
  150.     when 0
  151.       parameter_name = $data_system.words.str
  152.       parameter_value = actor.str
  153.       parameter_value_temp = parameter_value + $temp_str
  154.       if $temp_str != 0
  155.         lvup = upcolor
  156.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  157.         if $temp_str >= 0
  158.           self.contents.font.color = lvup
  159.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  160.         else
  161.           self.contents.font.color = Color.new(255,255,0,255)
  162.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  163.         end        
  164.         self.contents.draw_text(x + 272, y, 80, 32, $temp_str.abs.to_s,1)
  165.         self.contents.font.color = normal_color
  166.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  167.       end
  168.     when 1
  169.       parameter_name = $data_system.words.dex
  170.       parameter_value = actor.dex
  171.       parameter_value_temp = parameter_value + $temp_dex
  172.       if $temp_dex != 0
  173.         lvup = upcolor
  174.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  175.         if $temp_dex >= 0
  176.           self.contents.font.color = lvup
  177.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  178.         else
  179.           self.contents.font.color = Color.new(255,255,0,255)
  180.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  181.         end        
  182.         self.contents.draw_text(x + 272, y, 80, 32, $temp_dex.abs.to_s,1)
  183.         self.contents.font.color = normal_color
  184.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  185.       end
  186.     when 2
  187.       parameter_name = $data_system.words.agi
  188.       parameter_value = actor.agi
  189.       parameter_value_temp = parameter_value + $temp_agi
  190.       if $temp_agi != 0
  191.         lvup = upcolor
  192.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  193.         if $temp_agi >= 0
  194.           self.contents.font.color = lvup
  195.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  196.         else
  197.           self.contents.font.color = Color.new(255,255,0,255)
  198.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  199.         end        
  200.         self.contents.draw_text(x + 272, y, 80, 32, $temp_agi.abs.to_s,1)
  201.         self.contents.font.color = normal_color
  202.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  203.       end
  204.     when 3
  205.       parameter_name = $data_system.words.int
  206.       parameter_value = actor.int
  207.       parameter_value_temp = parameter_value + $temp_int
  208.       if $temp_int != 0
  209.         lvup = upcolor
  210.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  211.         if $temp_int >= 0
  212.           self.contents.font.color = lvup
  213.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  214.         else
  215.           self.contents.font.color = Color.new(255,255,0,255)
  216.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  217.         end        
  218.         self.contents.draw_text(x + 272, y, 80, 32, $temp_int.abs.to_s,1)
  219.         self.contents.font.color = normal_color
  220.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  221.       end
  222.     when 4
  223.       parameter_name = "剩余点数"
  224.       parameter_value = $point
  225.       if $point != 0
  226.         lvup = upcolor
  227.       end
  228.     end   
  229.     self.contents.font.color = system_color
  230.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  231.     self.contents.font.color = normal_color
  232.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s)   
  233.     if type != 4
  234.       self.contents.draw_text(x + 150, y, 36, 32, "→")
  235.     end  
  236.     self.contents.font.color = lvup
  237.     self.contents.draw_text(x + 180, y, 60, 32, parameter_value_temp.to_s)
  238.     self.contents.font.color = normal_color     
  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, 512, 320)
  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.    
  263.     x = 0
  264.     y = 0
  265.     #draw_actor_graphic(@actor, 40, 120)
  266.     bitmap = Bitmap.new("Graphics/Faces/" + @actor.id.to_s + "_Q.png")
  267.     src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  268.     self.contents.blt(x, y+30, bitmap, src_rect)
  269.     draw_actor_name(@actor, 4, 0)
  270.     draw_actor_class(@actor, 4 + 144, 0)
  271.     draw_actor_level(@actor, 96, 32)
  272.     draw_actor_state(@actor, 96, 64)   
  273.     draw_actor_hp_lvup(@actor, 96+128, 32)
  274.     draw_actor_sp_lvup(@actor, 96+128, 64)
  275.     draw_actor_lvup(@actor, 96, 128, 0)
  276.     draw_actor_lvup(@actor, 96, 160, 1)
  277.     draw_actor_lvup(@actor, 96, 192, 2)
  278.     draw_actor_lvup(@actor, 96, 224, 3)
  279.     draw_actor_lvup(@actor, 96, 256, 4)
  280.   end
  281. end
  282. #==============================================================================
  283. # ■ Window_Help
  284. #------------------------------------------------------------------------------
  285. #  特技及物品的说明、角色的状态显示的窗口。
  286. #==============================================================================
  287. class Window_Lvup_Help < Window_Base
  288.   #--------------------------------------------------------------------------
  289.   # ● 初始化对像
  290.   #--------------------------------------------------------------------------
  291.   def initialize
  292.     super(0, 320, 640, 160)
  293.     self.contents = Bitmap.new(width - 32, height - 32)
  294.     @test = "" #——这个东西用来检测,节约内存专用
  295.   end  
  296.   #--------------------------------------------------------------------------
  297.   # ● 设置文本
  298.   #--------------------------------------------------------------------------
  299.   def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil)
  300.     if @test != text1
  301.       @test = text1
  302.     else
  303.       return
  304.     end   
  305.     self.contents.clear
  306.     self.contents.font.color = normal_color
  307.     self.contents.draw_text(4, 0, self.width - 40, 32, text1)
  308.     if text2 != nil
  309.       self.contents.draw_text(4 , 32, self.width - 40, 32, text2)
  310.     end
  311.     self.contents.font.size -= 4
  312.     if text3 != nil
  313.       self.contents.draw_text(4 , 64, self.width - 40, 32, text3)
  314.     end
  315.     if text4 != nil
  316.       self.contents.draw_text(4 , 96, self.width - 40, 32, text4)
  317.     end
  318.     self.contents.font.size += 4
  319.   end
  320. end
  321. #==============================================================================
  322. # ■ Scene_lvup
  323. #------------------------------------------------------------------------------
  324. #  处理升级画面的类。
  325. #==============================================================================
  326. class Scene_Lvup
  327.   #--------------------------------------------------------------------------
  328.   # ● 初始化对像
  329.   #     actor_index : 角色索引
  330.   #     menu_index : 选项起始位置
  331.   #--------------------------------------------------------------------------
  332.   def initialize(actor_index = 0 , menu_index = 0)
  333.     @actor_index = actor_index
  334.     @menu_index = menu_index
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   # ● 主处理
  338.   #--------------------------------------------------------------------------
  339.   def main
  340.     s1 = "增加体质"
  341.     s2 = "增加"+$data_system.words.str
  342.     s3 = "增加"+$data_system.words.dex
  343.     s4 = "增加"+$data_system.words.agi
  344.     s5 = "增加"+$data_system.words.int
  345.     s6 = "确认加点"
  346.     s7 = "点数重置"
  347.     @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7])
  348.     @command_window.index = @menu_index
  349.     # 获取角色
  350.     @actor = $game_party.actors[@actor_index]
  351.     # 将角色的剩余点数带入
  352.     $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  353.     # 初始化临时量
  354.     $temp_str = 0
  355.     $temp_dex = 0
  356.     $temp_agi = 0
  357.     $temp_int = 0
  358.     $temp_hp = 0
  359.     $temp_sp = 0
  360.     #=========================================================================
  361.     # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
  362.     #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
  363.     #=========================================================================
  364.     # 每提升一次力量,提升多少附加能力
  365.     #=========================================================================
  366.     @str_hp = 30     # 每提升一次力量附加提升多少HP
  367.     @str_sp = 0     # 每提升一次力量附加提升多少SP
  368.     @str_dex = 0    # 每提升一次力量附加提升多少灵巧
  369.     @str_agi = 0    # 每提升一次力量附加提升多少速度
  370.     @str_int = 0    # 每提升一次力量附加提升多少魔力
  371.     @str_str = 3    # 每提升一次力量附加提升多少力量
  372.     #=========================================================================
  373.     # 每提升一次灵巧,提升多少附加能力
  374.     #=========================================================================
  375.     @dex_hp = 0     # 每提升一次灵巧附加提升多少HP
  376.     @dex_sp = 0     # 每提升一次灵巧附加提升多少SP
  377.     @dex_str = 0    # 每提升一次灵巧附加提升多少力量
  378.     @dex_agi = 0    # 每提升一次灵巧附加提升多少速度
  379.     @dex_int = 0    # 每提升一次灵巧附加提升多少魔力
  380.     @dex_dex = 3    # 每提升一次灵巧附加提升多少灵巧
  381.     #=========================================================================
  382.     # 每提升一次速度,提升多少附加能力
  383.     #=========================================================================
  384.     @agi_hp = 0     # 每提升一次速度附加提升多少HP
  385.     @agi_sp = 0     # 每提升一次速度附加提升多少SP
  386.     @agi_str = 0    # 每提升一次速度附加提升多少力量
  387.     @agi_dex = 0    # 每提升一次速度附加提升多少灵巧
  388.     @agi_int = 0    # 每提升一次速度附加提升多少魔力
  389.     @agi_agi = 3    # 每提升一次速度附加提升多少速度
  390.     #=========================================================================
  391.     # 每提升一次魔力,提升多少附加能力
  392.     #=========================================================================
  393.     @int_hp = 0     # 每提升一次魔力附加提升多少HP
  394.     @int_sp = 30    # 每提升一次魔力附加提升多少SP
  395.     @int_str = 0   # 每提升一次魔力附加提升多少力量
  396.     @int_dex = 0   # 每提升一次魔力附加提升多少灵巧
  397.     @int_agi = 0   # 每提升一次魔力附加提升多少速度
  398.     @int_int = 3   # 每提升一次魔力附加提升多少魔力
  399.     #=========================================================================
  400.     # 每提升一次体力,提升多少附加能力
  401.     #=========================================================================
  402.     @hp = 100       # 每提升一次体力提升多少HP
  403.     @sp = 50       # 每提升一次体力提升多少SP
  404.     @hp_str = 0   # 每提升一次体力提升多少力量
  405.     @hp_dex = 0   # 每提升一次体力提升多少速度
  406.     @hp_agi = 0   # 每提升一次体力提升多少灵巧
  407.     @hp_int = 0   # 每提升一次体力提升多少魔力   
  408.     # 定义说明文字
  409.     @text_hp_sc = "体质可以增加生存的能力,可以延长生存的时间!"
  410.     @text_str_sc = $data_system.words.str + "可以增加物理攻击和物理技能的威力!"
  411.     @text_dex_sc = $data_system.words.dex + "可以提高攻击的命中率和必杀!"
  412.     @text_agi_sc = $data_system.words.agi + "可以提高回避、命中、逃跑成功率!"
  413.     @text_int_sc = $data_system.words.int + "可以提高魔法的效果,可以增加1点魔法!"
  414.     @text_save = "保存分配情况并返回游戏"
  415.     @text_reset= "重新分配能力点数"
  416.     @text_2 = "每增加一次此项能力值,可以提升能力值"
  417.     @text_hp = "最大" + $data_system.words.hp + "值"
  418.     @text_sp = "最大" + $data_system.words.sp + "值"
  419.     @text_str = "最大" + $data_system.words.str + "值"
  420.     @text_dex = "最大" + $data_system.words.dex + "值"
  421.     @text_agi = "最大" + $data_system.words.agi + "值"
  422.     @text_int = "最大" + $data_system.words.int + "值"
  423.     s_disable
  424.     # 生成状态窗口
  425.     @lvup_window = Window_Lvup.new(@actor)
  426.     @lvup_window.x = 128
  427.     @lvup_window.y = 0   
  428.     # 生成帮助窗口并初始化帮助文本
  429.     @help_window = Window_Lvup_Help.new   
  430.     # 执行过渡
  431.     Graphics.transition(40, "Graphics/Transitions/" + $data_system.battle_transition)
  432.     # 主循环
  433.     loop do
  434.       # 刷新游戏画面
  435.       Graphics.update
  436.       # 刷新输入信息
  437.       Input.update
  438.       # 刷新画面
  439.       update
  440.       # 如果切换画面就中断循环
  441.       if $scene != self
  442.         break
  443.       end
  444.     end
  445.     # 准备过渡
  446.     Graphics.freeze
  447.     # 释放窗口
  448.     @command_window.dispose
  449.     @lvup_window.dispose
  450.     @help_window.dispose
  451.   end
  452.   #--------------------------------------------------------------------------
  453.   # ● 刷新画面
  454.   #--------------------------------------------------------------------------
  455.   def update
  456.     # 刷新窗口
  457.     @command_window.update
  458.     # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
  459.     s_disable
  460.     @lvup_window.update
  461.     #=============================================================
  462.     # 按下 B 键的情况下
  463.     #=============================================================
  464.     if Input.trigger?(Input::B)
  465.       # 演奏取消 SE
  466.       $game_system.se_play($data_system.cancel_se)
  467.       # 切换到地图画面
  468.       $scene = Scene_Menu.new(0)
  469.       return
  470.     end
  471.     #=============================================================
  472.     # 按下 C 键的情况下
  473.     #=============================================================
  474.     if Input.trigger?(Input::C)      
  475.       if @command_window.index == 5
  476.           # 演奏确定 SE
  477.         $game_system.se_play($data_system.decision_se)
  478.         # 将角色的剩余点数带回
  479.         $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
  480.         # 将角色点数实际加上
  481.         @actor.str += $temp_str
  482.         @actor.dex += $temp_dex
  483.         @actor.agi += $temp_agi
  484.         @actor.int += $temp_int
  485.         @actor.maxhp += $temp_hp
  486.         @actor.maxsp += $temp_sp
  487.         # 切换到地图画面
  488.         $scene = Scene_Map.new
  489.         return
  490.       end
  491.       if @command_window.index == 6
  492.           # 演奏确定 SE
  493.         $game_system.se_play($data_system.cancel_se)
  494.           # 将角色的剩余点数带入
  495.         $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  496.           # 初始化临时量
  497.         $temp_str = 0
  498.         $temp_dex = 0
  499.         $temp_agi = 0
  500.         $temp_int = 0
  501.         $temp_hp = 0
  502.         $temp_sp = 0
  503.         @lvup_window.refresh
  504.         return
  505.       end
  506.       if $point == 0
  507.         # 演奏冻结 SE
  508.         $game_system.se_play($data_system.buzzer_se)
  509.         return
  510.       end
  511.       case @command_window.index
  512.       when 0
  513.         # 演奏确定 SE
  514.         $game_system.se_play($data_system.decision_se)
  515.         $temp_hp += @hp
  516.         $temp_sp += @sp
  517.         $temp_str += @hp_str
  518.         $temp_dex += @hp_dex
  519.         $temp_agi += @hp_agi
  520.         $temp_int += @hp_int
  521.         $point -= 1
  522.         @lvup_window.refresh
  523.         s_disable
  524.         return
  525.       when 1
  526.         # 演奏确定 SE
  527.         $game_system.se_play($data_system.decision_se)
  528.         $temp_str += @str_str
  529.         $temp_hp += @str_hp
  530.         $temp_sp += @str_sp
  531.         $temp_dex += @str_dex
  532.         $temp_agi += @str_agi
  533.         $temp_int += @str_int
  534.         $point -= 1
  535.         @lvup_window.refresh
  536.         s_disable
  537.         return
  538.       when 2
  539.         # 演奏确定 SE
  540.         $game_system.se_play($data_system.decision_se)
  541.         $temp_dex += @dex_dex
  542.         $temp_hp += @dex_hp
  543.         $temp_sp += @dex_sp
  544.         $temp_str += @dex_str
  545.         $temp_agi += @dex_agi
  546.         $temp_int += @dex_int
  547.         $point -= 1
  548.         @lvup_window.refresh
  549.         s_disable
  550.         return
  551.       when 3
  552.         # 演奏确定 SE
  553.         $game_system.se_play($data_system.decision_se)
  554.         $temp_agi += @agi_agi
  555.         $temp_hp += @agi_hp
  556.         $temp_sp += @agi_sp
  557.         $temp_str += @agi_str
  558.         $temp_dex += @agi_dex
  559.         $temp_int += @agi_int
  560.         $point -= 1
  561.         @lvup_window.refresh
  562.         s_disable
  563.         return
  564.       when 4
  565.         # 演奏确定 SE
  566.         $game_system.se_play($data_system.decision_se)
  567.         $temp_int += @int_int
  568.         $temp_hp += @int_hp
  569.         $temp_sp += @int_sp
  570.         $temp_str += @int_str
  571.         $temp_dex += @int_dex
  572.         $temp_agi += @int_agi
  573.         $point -= 1
  574.         @lvup_window.refresh
  575.         s_disable
  576.         return
  577.       end
  578.     end
  579.     #=============================================================
  580.     # 什么都没有按下的情况
  581.     #=============================================================
  582.     case @command_window.index   
  583.     when 0  # 增加体力
  584.       temptext1 = @text_hp + @hp.to_s + "点   " + @text_str + @hp_str.to_s + "点   " + @text_dex + @hp_dex.to_s + "点"
  585.       temptext2 = @text_sp + @sp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_int + @hp_int.to_s + "点"
  586.       @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
  587.     when 1  # 增加力量
  588.       temptext1 = @text_hp + @str_hp.to_s + "点   " + @text_str + @str_str.to_s + "点   " + @text_dex + @str_dex.to_s + "点"
  589.       temptext2 = @text_sp + @str_sp.to_s + "点   " + @text_agi + @str_agi.to_s + "点   " + @text_int + @str_int.to_s + "点"
  590.       @help_window.lvup_text(@text_str_sc , @text_2 , temptext1 , temptext2)
  591.     when 2  # 增加灵巧
  592.       temptext1 = @text_hp + @dex_hp.to_s + "点   " + @text_str + @dex_agi.to_s + "点   " + @text_dex + @dex_dex.to_s + "点"
  593.       temptext2 = @text_sp + @dex_sp.to_s + "点   " + @text_agi + @dex_agi.to_s + "点   " + @text_int + @dex_int.to_s + "点"
  594.       @help_window.lvup_text(@text_dex_sc , @text_2 , temptext1 , temptext2)
  595.     when 3  # 增加速度
  596.       temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_str + @agi_str.to_s + "点   " + @text_dex + @agi_dex.to_s + "点"
  597.       temptext2 = @text_sp + @agi_sp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_int + @agi_int.to_s + "点"
  598.       @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
  599.     when 4  # 增加魔力
  600.       temptext1 = @text_hp + @int_hp.to_s + "点   " + @text_str + @int_str.to_s + "点   " + @text_dex + @int_dex.to_s + "点"
  601.       temptext2 = @text_sp + @int_sp.to_s + "点   " + @text_agi + @int_agi.to_s + "点   " + @text_int + @int_int.to_s + "点"
  602.       @help_window.lvup_text(@text_int_sc , @text_2 , temptext1 , temptext2)
  603.     when 5 # 保存设定
  604.       @help_window.lvup_text(@text_save)
  605.     when 6 # 点数重置
  606.       @help_window.lvup_text(@text_reset)     
  607.     end
  608.     #=============================================================
  609.     # 按下R与L换人的情况
  610.     #=============================================================      
  611.     if Input.trigger?(Input::R)
  612.       # 演奏光标 SE
  613.       $game_system.se_play($data_system.cursor_se)
  614.       # 移至下一位角色
  615.       @actor_index += 1
  616.       @actor_index %= $game_party.actors.size
  617.       # 切换到别的状态画面
  618.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  619.       return
  620.     end
  621.     # 按下 L 键的情况下
  622.     if Input.trigger?(Input::L)
  623.       # 演奏光标 SE
  624.       $game_system.se_play($data_system.cursor_se)
  625.       # 移至上一位角色
  626.       @actor_index += $game_party.actors.size - 1
  627.       @actor_index %= $game_party.actors.size
  628.       # 切换到别的状态画面
  629.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  630.       return
  631.     end
  632.   end  
  633.   #--------------------------------------------------------------------------
  634.   # ● 选项明暗判断
  635.   #--------------------------------------------------------------------------
  636.   def s_disable
  637.     # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
  638.     if $point == 0
  639.       @command_window.disable_item(0)
  640.       @command_window.disable_item(1)
  641.       @command_window.disable_item(2)
  642.       @command_window.disable_item(3)
  643.       @command_window.disable_item(4)
  644.     else
  645.       @command_window.able_item(0)
  646.       @command_window.able_item(1)      
  647.       @command_window.able_item(2)
  648.       @command_window.able_item(3)
  649.       @command_window.able_item(4)
  650.     end
  651.   end
  652. end

  653. #==============================================================================
  654. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  655. #==============================================================================
复制代码

评分

参与人数 1星屑 +35 收起 理由
RyanBern + 35 手动认可奖励

查看全部评分

梦石
0
星屑
34462
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2015-8-4 17:13:22 | 显示全部楼层
第61行整个换成下面这段,最多多加10点。
  1. data = [0]
  2. (1..10).each{|i| data << i if $game_switches[i]}
  3. $game_variables[self.id + LEVEL_UP_VARIABLE] += (LEVEL_UP_POINT + data.max)
复制代码

点评

@.@  发表于 2015-8-4 22:10
其实是楼主没看懂,你这个应该来说比楼主认可的答案好。  发表于 2015-8-4 20:41
.......我想用个开关来控制下加点  发表于 2015-8-4 18:36

评分

参与人数 1星屑 +90 收起 理由
RyanBern + 90 塞糖

查看全部评分

xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

小空格

梦石
0
星屑
2655
在线时间
555 小时
注册时间
2009-7-15
回帖
1023
发表于 2015-8-4 17:29:48 | 显示全部楼层
[pre lang="ruby"]#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================


# 脚本使用设定:
# 开关定义:

$第一种加点 = 41

$第二种加点 = 42

$第三种加点 = 43

# 开关不能同时打开

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

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

# 本脚本不会取代原猩豆δ埽皇且桓龈郊庸δ堋?BR># 也就是说,默认的升级还在,但可以用这个功能手动追加点数。
# 如果你想纯粹使用手动加点(而升级不提升能力),只要把数据库中角色升级能力,
# 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
  #--------------------------------------------------------------------------
  # ● 更改 EXP
  #     exp : 新的 EXP
  #--------------------------------------------------------------------------
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    # 升级
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      if $game_switches[$第一种加点]==true
      # 增加第一种设置可自由分配的点数
      $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
    end
      if $game_switches[$第二种加点]==true
      # 增加第二种设置可自由分配的点数
      $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT2
    end
      if $game_switches[$第三种加点]==true
      # 增加第三种设置可自由分配的点数
      $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT3
    end
      # 学会特技
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
    # 降级
    while @exp < @exp_list[@level]
      @level -= 1
    end
    # 修正当前的 HP 与 SP 超过最大值
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  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, "最大" + $data_system.words.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
  #--------------------------------------------------------------------------
  # ● 描绘 SP
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     width : 描画目标的宽
  #--------------------------------------------------------------------------
  def draw_actor_sp_lvup(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.sp)
    if $temp_sp == 0
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 120 , y, 48, 32, actor.maxsp.to_s, 2)
    else
      maxsp = actor.maxsp + $temp_sp
      self.contents.font.color = Color.new(255, 128, 128, 255)
      self.contents.draw_text(x + 120 , y, 48, 32, maxsp.to_s ,2)
      self.contents.font.color = normal_color      
      self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
      if $temp_sp >=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_sp.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 = $data_system.words.str
      parameter_value = actor.str
      parameter_value_temp = parameter_value + $temp_str
      if $temp_str != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_str >= 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_str.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 = $data_system.words.dex
      parameter_value = actor.dex
      parameter_value_temp = parameter_value + $temp_dex
      if $temp_dex != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_dex >= 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_dex.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 = $data_system.words.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 = $data_system.words.int
      parameter_value = actor.int
      parameter_value_temp = parameter_value + $temp_int
      if $temp_int != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_int >= 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_int.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.color = system_color
    self.contents.draw_text(x, y, 120, 32, parameter_name)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s)   
    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
#==============================================================================
# ■ Window_lvup
#------------------------------------------------------------------------------
#  显示升级状态窗口。
#==============================================================================
class Window_Lvup < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     actor : 角色
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 0, 512, 320)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor

    refresh
  end  
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear  
   
    x = 0
    y = 0
    #draw_actor_graphic(@actor, 40, 120)
    bitmap = Bitmap.new("Graphics/Faces/" + @actor.id.to_s + "_Q.png")
    src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    self.contents.blt(x, y+30, bitmap, src_rect)
    draw_actor_name(@actor, 4, 0)
    draw_actor_class(@actor, 4 + 144, 0)
    draw_actor_level(@actor, 96, 32)
    draw_actor_state(@actor, 96, 64)   
    draw_actor_hp_lvup(@actor, 96+128, 32)
    draw_actor_sp_lvup(@actor, 96+128, 64)
    draw_actor_lvup(@actor, 96, 128, 0)
    draw_actor_lvup(@actor, 96, 160, 1)
    draw_actor_lvup(@actor, 96, 192, 2)
    draw_actor_lvup(@actor, 96, 224, 3)
    draw_actor_lvup(@actor, 96, 256, 4)
  end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
#  特技及物品的说明、角色的状态显示的窗口。
#==============================================================================
class Window_Lvup_Help < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(0, 320, 640, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    @test = "" #——这个东西用来检测,节约内存专用
  end  
  #--------------------------------------------------------------------------
  # ● 设置文本
  #--------------------------------------------------------------------------
  def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil)
    if @test != text1
      @test = text1
    else
      return
    end   
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, self.width - 40, 32, text1)
    if text2 != nil
      self.contents.draw_text(4 , 32, self.width - 40, 32, text2)
    end
    self.contents.font.size -= 4
    if text3 != nil
      self.contents.draw_text(4 , 64, self.width - 40, 32, text3)
    end
    if text4 != nil
      self.contents.draw_text(4 , 96, self.width - 40, 32, text4)
    end
    self.contents.font.size += 4
  end
end
#==============================================================================
# ■ Scene_lvup
#------------------------------------------------------------------------------
#  处理升级画面的类。
#==============================================================================
class Scene_Lvup
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     actor_index : 角色索引
  #     menu_index : 选项起始位置
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0 , menu_index = 0)
    @actor_index = actor_index
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # ● 主处理
  #--------------------------------------------------------------------------
  def main
    s1 = "增加体质"
    s2 = "增加"+$data_system.words.str
    s3 = "增加"+$data_system.words.dex
    s4 = "增加"+$data_system.words.agi
    s5 = "增加"+$data_system.words.int
    s6 = "确认加点"
    s7 = "点数重置"
    @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # 获取角色
    @actor = $game_party.actors[@actor_index]
    # 将角色的剩余点数带入
    $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
    # 初始化临时量
    $temp_str = 0
    $temp_dex = 0
    $temp_agi = 0
    $temp_int = 0
    $temp_hp = 0
    $temp_sp = 0
    #=========================================================================
    # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
    #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
    #=========================================================================
    # 每提升一次力量,提升多少附加能力
    #=========================================================================
    @str_hp = 30     # 每提升一次力量附加提升多少HP
    @str_sp = 0     # 每提升一次力量附加提升多少SP
    @str_dex = 0    # 每提升一次力量附加提升多少灵巧
    @str_agi = 0    # 每提升一次力量附加提升多少速度
    @str_int = 0    # 每提升一次力量附加提升多少魔力
    @str_str = 3    # 每提升一次力量附加提升多少力量
    #=========================================================================
    # 每提升一次灵巧,提升多少附加能力
    #=========================================================================
    @dex_hp = 0     # 每提升一次灵巧附加提升多少HP
    @dex_sp = 0     # 每提升一次灵巧附加提升多少SP
    @dex_str = 0    # 每提升一次灵巧附加提升多少力量
    @dex_agi = 0    # 每提升一次灵巧附加提升多少速度
    @dex_int = 0    # 每提升一次灵巧附加提升多少魔力
    @dex_dex = 3    # 每提升一次灵巧附加提升多少灵巧
    #=========================================================================
    # 每提升一次速度,提升多少附加能力
    #=========================================================================
    @agi_hp = 0     # 每提升一次速度附加提升多少HP
    @agi_sp = 0     # 每提升一次速度附加提升多少SP
    @agi_str = 0    # 每提升一次速度附加提升多少力量
    @agi_dex = 0    # 每提升一次速度附加提升多少灵巧
    @agi_int = 0    # 每提升一次速度附加提升多少魔力
    @agi_agi = 3    # 每提升一次速度附加提升多少速度
    #=========================================================================
    # 每提升一次魔力,提升多少附加能力
    #=========================================================================
    @int_hp = 0     # 每提升一次魔力附加提升多少HP
    @int_sp = 30    # 每提升一次魔力附加提升多少SP
    @int_str = 0   # 每提升一次魔力附加提升多少力量
    @int_dex = 0   # 每提升一次魔力附加提升多少灵巧
    @int_agi = 0   # 每提升一次魔力附加提升多少速度
    @int_int = 3   # 每提升一次魔力附加提升多少魔力
    #=========================================================================
    # 每提升一次体力,提升多少附加能力
    #=========================================================================
    @hp = 100       # 每提升一次体力提升多少HP
    @sp = 50       # 每提升一次体力提升多少SP
    @hp_str = 0   # 每提升一次体力提升多少力量
    @hp_dex = 0   # 每提升一次体力提升多少速度
    @hp_agi = 0   # 每提升一次体力提升多少灵巧
    @hp_int = 0   # 每提升一次体力提升多少魔力   
    # 定义说明文字
    @text_hp_sc = "体质可以增加生存的能力,可以延长生存的时间!"
    @text_str_sc = $data_system.words.str + "可以增加物理攻击和物理技能的威力!"
    @text_dex_sc = $data_system.words.dex + "可以提高攻击的命中率和必杀!"
    @text_agi_sc = $data_system.words.agi + "可以提高回避、命中、逃跑成功率!"
    @text_int_sc = $data_system.words.int + "可以提高魔法的效果,可以增加1点魔法!"
    @text_save = "保存分配情况并返回游戏"
    @text_reset= "重新分配能力点数"
    @text_2 = "每增加一次此项能力值,可以提升能力值"
    @text_hp = "最大" + $data_system.words.hp + "值"
    @text_sp = "最大" + $data_system.words.sp + "值"
    @text_str = "最大" + $data_system.words.str + "值"
    @text_dex = "最大" + $data_system.words.dex + "值"
    @text_agi = "最大" + $data_system.words.agi + "值"
    @text_int = "最大" + $data_system.words.int + "值"
    s_disable
    # 生成状态窗口
    @lvup_window = Window_Lvup.new(@actor)
    @lvup_window.x = 128
    @lvup_window.y = 0   
    # 生成帮助窗口并初始化帮助文本
    @help_window = Window_Lvup_Help.new   
    # 执行过渡
    Graphics.transition(40, "Graphics/Transitions/" + $data_system.battle_transition)
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入信息
      Input.update
      # 刷新画面
      update
      # 如果切换画面就中断循环
      if $scene != self
        break
      end
    end
    # 准备过渡
    Graphics.freeze
    # 释放窗口
    @command_window.dispose
    @lvup_window.dispose
    @help_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    # 刷新窗口
    @command_window.update
    # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
    s_disable
    @lvup_window.update
    #=============================================================
    # 按下 B 键的情况下
    #=============================================================
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 切换到地图画面
      $scene = Scene_Menu.new(0)
      return
    end
    #=============================================================
    # 按下 C 键的情况下
    #=============================================================
    if Input.trigger?(Input::C)      
      if @command_window.index == 5
          # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 将角色的剩余点数带回
        $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
        # 将角色点数实际加上
        @actor.str += $temp_str
        @actor.dex += $temp_dex
        @actor.agi += $temp_agi
        @actor.int += $temp_int
        @actor.maxhp += $temp_hp
        @actor.maxsp += $temp_sp
        # 切换到地图画面
        $scene = Scene_Map.new
        return
      end
      if @command_window.index == 6
          # 演奏确定 SE
        $game_system.se_play($data_system.cancel_se)
          # 将角色的剩余点数带入
        $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
          # 初始化临时量
        $temp_str = 0
        $temp_dex = 0
        $temp_agi = 0
        $temp_int = 0
        $temp_hp = 0
        $temp_sp = 0
        @lvup_window.refresh
        return
      end
      if $point == 0
        # 演奏冻结 SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @command_window.index
      when 0
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_hp += @hp
        $temp_sp += @sp
        $temp_str += @hp_str
        $temp_dex += @hp_dex
        $temp_agi += @hp_agi
        $temp_int += @hp_int
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      when 1
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_str += @str_str
        $temp_hp += @str_hp
        $temp_sp += @str_sp
        $temp_dex += @str_dex
        $temp_agi += @str_agi
        $temp_int += @str_int
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      when 2
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_dex += @dex_dex
        $temp_hp += @dex_hp
        $temp_sp += @dex_sp
        $temp_str += @dex_str
        $temp_agi += @dex_agi
        $temp_int += @dex_int
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      when 3
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_agi += @agi_agi
        $temp_hp += @agi_hp
        $temp_sp += @agi_sp
        $temp_str += @agi_str
        $temp_dex += @agi_dex
        $temp_int += @agi_int
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      when 4
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        $temp_int += @int_int
        $temp_hp += @int_hp
        $temp_sp += @int_sp
        $temp_str += @int_str
        $temp_dex += @int_dex
        $temp_agi += @int_agi
        $point -= 1
        @lvup_window.refresh
        s_disable
        return
      end
    end
    #=============================================================
    # 什么都没有按下的情况
    #=============================================================
    case @command_window.index   
    when 0  # 增加体力
      temptext1 = @text_hp + @hp.to_s + "点   " + @text_str + @hp_str.to_s + "点   " + @text_dex + @hp_dex.to_s + "点"
      temptext2 = @text_sp + @sp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_int + @hp_int.to_s + "点"
      @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
    when 1  # 增加力量
      temptext1 = @text_hp + @str_hp.to_s + "点   " + @text_str + @str_str.to_s + "点   " + @text_dex + @str_dex.to_s + "点"
      temptext2 = @text_sp + @str_sp.to_s + "点   " + @text_agi + @str_agi.to_s + "点   " + @text_int + @str_int.to_s + "点"
      @help_window.lvup_text(@text_str_sc , @text_2 , temptext1 , temptext2)
    when 2  # 增加灵巧
      temptext1 = @text_hp + @dex_hp.to_s + "点   " + @text_str + @dex_agi.to_s + "点   " + @text_dex + @dex_dex.to_s + "点"
      temptext2 = @text_sp + @dex_sp.to_s + "点   " + @text_agi + @dex_agi.to_s + "点   " + @text_int + @dex_int.to_s + "点"
      @help_window.lvup_text(@text_dex_sc , @text_2 , temptext1 , temptext2)
    when 3  # 增加速度
      temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_str + @agi_str.to_s + "点   " + @text_dex + @agi_dex.to_s + "点"
      temptext2 = @text_sp + @agi_sp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_int + @agi_int.to_s + "点"
      @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
    when 4  # 增加魔力
      temptext1 = @text_hp + @int_hp.to_s + "点   " + @text_str + @int_str.to_s + "点   " + @text_dex + @int_dex.to_s + "点"
      temptext2 = @text_sp + @int_sp.to_s + "点   " + @text_agi + @int_agi.to_s + "点   " + @text_int + @int_int.to_s + "点"
      @help_window.lvup_text(@text_int_sc , @text_2 , temptext1 , temptext2)
    when 5 # 保存设定
      @help_window.lvup_text(@text_save)
    when 6 # 点数重置
      @help_window.lvup_text(@text_reset)     
    end
    #=============================================================
    # 按下R与L换人的情况
    #=============================================================      
    if Input.trigger?(Input::R)
      # 演奏光标 SE
      $game_system.se_play($data_system.cursor_se)
      # 移至下一位角色
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      # 切换到别的状态画面
      $scene = Scene_Lvup.new(@actor_index , @command_window.index)
      return
    end
    # 按下 L 键的情况下
    if Input.trigger?(Input::L)
      # 演奏光标 SE
      $game_system.se_play($data_system.cursor_se)
      # 移至上一位角色
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      # 切换到别的状态画面
      $scene = Scene_Lvup.new(@actor_index , @command_window.index)
      return
    end
  end  
  #--------------------------------------------------------------------------
  # ● 选项明暗判断
  #--------------------------------------------------------------------------
  def s_disable
    # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
    if $point == 0
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
      @command_window.disable_item(4)
    else
      @command_window.able_item(0)
      @command_window.able_item(1)      
      @command_window.able_item(2)
      @command_window.able_item(3)
      @command_window.able_item(4)
    end
  end
end

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

点评

抱歉 大大 我看漏了-.-,多谢啦  发表于 2015-8-4 19:40

评分

参与人数 1梦石 +1 收起 理由
RyanBern + 1 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
6963
在线时间
1557 小时
注册时间
2011-6-14
回帖
425
 楼主| 发表于 2015-8-4 18:33:33 | 显示全部楼层
本帖最后由 347780682 于 2015-8-4 20:24 编辑
№独孤剑→ 发表于 2015-8-4 17:29
#==============================================================================
# 本脚本来自www.66RP ...


对了大大能不能另外帮我加个功能,当力量和敏捷都超过100时就获得技能a,当力量和敏捷都超过200时就获得技能a1

当魔力和敏捷都超过100时就获得技能b,当魔力和敏捷都超过200时就获得技能b1

当灵巧和敏捷都超过100时就获得技能c,当灵巧和敏捷都超过200时就获得技能c1

以此类推

获得技能a后只能获得a1,技能b,c无法获得

点评

额 没事 尽力就好 谢谢啦-.-  发表于 2015-8-5 09:02
抱歉,能力所限,写出来的一直有BUG,你可以再次发帖找别人帮忙。  发表于 2015-8-5 08:20
升级的时候还是不升级的时候?  发表于 2015-8-5 08:15
没问题呀,因为你之前开关一已经加过4点了,关闭后再打开开关二是加8点,累计是12点啊。检查一下开关一和开关二是不是同时开了?  发表于 2015-8-4 19:22
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部