查看: 2658|回复: 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
星屑
34511
在线时间
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 | 显示全部楼层
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================


  4. # 脚本使用设定:
  5. # 开关定义:

  6. $第一种加点 = 41

  7. $第二种加点 = 42

  8. $第三种加点 = 43

  9. # 开关不能同时打开

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

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

  21. # 本脚本不会取代原猩豆δ埽皇且桓龈郊庸δ堋?BR># 也就是说,默认的升级还在,但可以用这个功能手动追加点数。
  22. # 如果你想纯粹使用手动加点(而升级不提升能力),只要把数据库中角色升级能力,
  23. # 1-99级全部等于一个相同数值就行了。

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

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

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

  29. #==============================================================================
  30. # ■ Window_Command
  31. #------------------------------------------------------------------------------
  32. #  一般的命令选择行窗口。(追加定义)
  33. #==============================================================================
  34. class Window_Command < Window_Selectable
  35.   #--------------------------------------------------------------------------
  36.   # ● 项目有效化
  37.   #     index : 项目编号
  38.   #--------------------------------------------------------------------------
  39.   def able_item(index)
  40.     draw_item(index, normal_color)
  41.   end
  42. end
  43. #==============================================================================
  44. # ■ Game_Actor
  45. #------------------------------------------------------------------------------
  46. #  处理角色的类。(再定义)
  47. #==============================================================================
  48. class Game_Actor < Game_Battler
  49.   #--------------------------------------------------------------------------
  50.   # ● 更改 EXP
  51.   #     exp : 新的 EXP
  52.   #--------------------------------------------------------------------------
  53.   def exp=(exp)
  54.     @exp = [[exp, 9999999].min, 0].max
  55.     # 升级
  56.     while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
  57.       @level += 1
  58.       if $game_switches[$第一种加点]==true
  59.       # 增加第一种设置可自由分配的点数
  60.       $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
  61.     end
  62.       if $game_switches[$第二种加点]==true
  63.       # 增加第二种设置可自由分配的点数
  64.       $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT2
  65.     end
  66.       if $game_switches[$第三种加点]==true
  67.       # 增加第三种设置可自由分配的点数
  68.       $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT3
  69.     end
  70.       # 学会特技
  71.       for j in $data_classes[@class_id].learnings
  72.         if j.level == @level
  73.           learn_skill(j.skill_id)
  74.         end
  75.       end
  76.     end
  77.     # 降级
  78.     while @exp < @exp_list[@level]
  79.       @level -= 1
  80.     end
  81.     # 修正当前的 HP 与 SP 超过最大值
  82.     @hp = [@hp, self.maxhp].min
  83.     @sp = [@sp, self.maxsp].min
  84.   end
  85. end
  86. #==============================================================================
  87. # ■ Window_Base
  88. #------------------------------------------------------------------------------
  89. #  游戏中全部窗口的超级类(追加定义)
  90. #==============================================================================
  91. class Window_Base < Window
  92.   #--------------------------------------------------------------------------
  93.   # ● 描绘 HP
  94.   #     actor : 角色
  95.   #     x     : 描画目标 X 坐标
  96.   #     y     : 描画目标 Y 坐标
  97.   #     width : 描画目标的宽
  98.   #--------------------------------------------------------------------------
  99.   def draw_actor_hp_lvup(actor, x, y)
  100.     self.contents.font.color = system_color
  101.     self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.hp)
  102.     if $temp_hp == 0
  103.       self.contents.font.color = normal_color
  104.       self.contents.draw_text(x + 120 , y, 48, 32, actor.maxhp.to_s, 2)
  105.     else
  106.       maxhp = actor.maxhp + $temp_hp
  107.       self.contents.font.color = Color.new(255, 128, 128, 255)
  108.       self.contents.draw_text(x + 120 , y, 48, 32, maxhp.to_s ,2)
  109.       self.contents.font.color = normal_color      
  110.       self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
  111.       if $temp_hp >=0
  112.         self.contents.font.color = Color.new(255, 128, 128, 255)
  113.         self.contents.draw_text(x + 155, y, 36, 32, " +",2)
  114.       else
  115.         self.contents.font.color = Color.new(255,255,0,255)
  116.         self.contents.draw_text(x + 155, y, 36, 32, " -",2)
  117.       end
  118.       self.contents.draw_text(x + 200, y, 36, 32, $temp_hp.to_s, 2)
  119.       self.contents.font.color = normal_color
  120.       self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
  121.     end
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # ● 描绘 SP
  125.   #     actor : 角色
  126.   #     x     : 描画目标 X 坐标
  127.   #     y     : 描画目标 Y 坐标
  128.   #     width : 描画目标的宽
  129.   #--------------------------------------------------------------------------
  130.   def draw_actor_sp_lvup(actor, x, y)
  131.     self.contents.font.color = system_color
  132.     self.contents.draw_text(x , y, 96, 32, "最大" + $data_system.words.sp)
  133.     if $temp_sp == 0
  134.       self.contents.font.color = normal_color
  135.       self.contents.draw_text(x + 120 , y, 48, 32, actor.maxsp.to_s, 2)
  136.     else
  137.       maxsp = actor.maxsp + $temp_sp
  138.       self.contents.font.color = Color.new(255, 128, 128, 255)
  139.       self.contents.draw_text(x + 120 , y, 48, 32, maxsp.to_s ,2)
  140.       self.contents.font.color = normal_color      
  141.       self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
  142.       if $temp_sp >=0
  143.         self.contents.font.color = Color.new(255, 128, 128, 255)
  144.         self.contents.draw_text(x + 155, y, 36, 32, " +",2)
  145.       else
  146.         self.contents.font.color = Color.new(255,255,0,255)
  147.         self.contents.draw_text(x + 155, y, 36, 32, " -",2)
  148.       end
  149.       self.contents.draw_text(x + 200, y, 36, 32, $temp_sp.to_s, 2)
  150.       self.contents.font.color = normal_color
  151.       self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
  152.     end
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 描绘能力值
  156.   #     actor : 角色
  157.   #     x     : 描画目标 X 坐标
  158.   #     y     : 描画目标 Y 坐标
  159.   #     type  : 能力值种类 (0~4)
  160.   #--------------------------------------------------------------------------
  161.   def draw_actor_lvup(actor, x, y, type)   
  162.     # 定义数字颜色
  163.     lvup = normal_color
  164.     upcolor = Color.new(255, 128, 128, 255)
  165.     self.contents.font.color = normal_color   
  166.     case type
  167.     when 0
  168.       parameter_name = $data_system.words.str
  169.       parameter_value = actor.str
  170.       parameter_value_temp = parameter_value + $temp_str
  171.       if $temp_str != 0
  172.         lvup = upcolor
  173.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  174.         if $temp_str >= 0
  175.           self.contents.font.color = lvup
  176.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  177.         else
  178.           self.contents.font.color = Color.new(255,255,0,255)
  179.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  180.         end        
  181.         self.contents.draw_text(x + 272, y, 80, 32, $temp_str.abs.to_s,1)
  182.         self.contents.font.color = normal_color
  183.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  184.       end
  185.     when 1
  186.       parameter_name = $data_system.words.dex
  187.       parameter_value = actor.dex
  188.       parameter_value_temp = parameter_value + $temp_dex
  189.       if $temp_dex != 0
  190.         lvup = upcolor
  191.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  192.         if $temp_dex >= 0
  193.           self.contents.font.color = lvup
  194.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  195.         else
  196.           self.contents.font.color = Color.new(255,255,0,255)
  197.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  198.         end        
  199.         self.contents.draw_text(x + 272, y, 80, 32, $temp_dex.abs.to_s,1)
  200.         self.contents.font.color = normal_color
  201.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  202.       end
  203.     when 2
  204.       parameter_name = $data_system.words.agi
  205.       parameter_value = actor.agi
  206.       parameter_value_temp = parameter_value + $temp_agi
  207.       if $temp_agi != 0
  208.         lvup = upcolor
  209.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  210.         if $temp_agi >= 0
  211.           self.contents.font.color = lvup
  212.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  213.         else
  214.           self.contents.font.color = Color.new(255,255,0,255)
  215.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  216.         end        
  217.         self.contents.draw_text(x + 272, y, 80, 32, $temp_agi.abs.to_s,1)
  218.         self.contents.font.color = normal_color
  219.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  220.       end
  221.     when 3
  222.       parameter_name = $data_system.words.int
  223.       parameter_value = actor.int
  224.       parameter_value_temp = parameter_value + $temp_int
  225.       if $temp_int != 0
  226.         lvup = upcolor
  227.         self.contents.draw_text(x + 256, y, 16, 32, "(")
  228.         if $temp_int >= 0
  229.           self.contents.font.color = lvup
  230.           self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  231.         else
  232.           self.contents.font.color = Color.new(255,255,0,255)
  233.           self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  234.         end        
  235.         self.contents.draw_text(x + 272, y, 80, 32, $temp_int.abs.to_s,1)
  236.         self.contents.font.color = normal_color
  237.         self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  238.       end
  239.     when 4
  240.       parameter_name = "剩余点数"
  241.       parameter_value = $point
  242.       if $point != 0
  243.         lvup = upcolor
  244.       end
  245.     end   
  246.     self.contents.font.color = system_color
  247.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  248.     self.contents.font.color = normal_color
  249.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s)   
  250.     if type != 4
  251.       self.contents.draw_text(x + 150, y, 36, 32, "→")
  252.     end  
  253.     self.contents.font.color = lvup
  254.     self.contents.draw_text(x + 180, y, 60, 32, parameter_value_temp.to_s)
  255.     self.contents.font.color = normal_color     
  256.   end
  257. end
  258. #==============================================================================
  259. # ■ Window_lvup
  260. #------------------------------------------------------------------------------
  261. #  显示升级状态窗口。
  262. #==============================================================================
  263. class Window_Lvup < Window_Base
  264.   #--------------------------------------------------------------------------
  265.   # ● 初始化对像
  266.   #     actor : 角色
  267.   #--------------------------------------------------------------------------
  268.   def initialize(actor)
  269.     super(0, 0, 512, 320)
  270.     self.contents = Bitmap.new(width - 32, height - 32)
  271.     @actor = actor

  272.     refresh
  273.   end  
  274.   #--------------------------------------------------------------------------
  275.   # ● 刷新
  276.   #--------------------------------------------------------------------------
  277.   def refresh
  278.     self.contents.clear  
  279.    
  280.     x = 0
  281.     y = 0
  282.     #draw_actor_graphic(@actor, 40, 120)
  283.     bitmap = Bitmap.new("Graphics/Faces/" + @actor.id.to_s + "_Q.png")
  284.     src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
  285.     self.contents.blt(x, y+30, bitmap, src_rect)
  286.     draw_actor_name(@actor, 4, 0)
  287.     draw_actor_class(@actor, 4 + 144, 0)
  288.     draw_actor_level(@actor, 96, 32)
  289.     draw_actor_state(@actor, 96, 64)   
  290.     draw_actor_hp_lvup(@actor, 96+128, 32)
  291.     draw_actor_sp_lvup(@actor, 96+128, 64)
  292.     draw_actor_lvup(@actor, 96, 128, 0)
  293.     draw_actor_lvup(@actor, 96, 160, 1)
  294.     draw_actor_lvup(@actor, 96, 192, 2)
  295.     draw_actor_lvup(@actor, 96, 224, 3)
  296.     draw_actor_lvup(@actor, 96, 256, 4)
  297.   end
  298. end
  299. #==============================================================================
  300. # ■ Window_Help
  301. #------------------------------------------------------------------------------
  302. #  特技及物品的说明、角色的状态显示的窗口。
  303. #==============================================================================
  304. class Window_Lvup_Help < Window_Base
  305.   #--------------------------------------------------------------------------
  306.   # ● 初始化对像
  307.   #--------------------------------------------------------------------------
  308.   def initialize
  309.     super(0, 320, 640, 160)
  310.     self.contents = Bitmap.new(width - 32, height - 32)
  311.     @test = "" #——这个东西用来检测,节约内存专用
  312.   end  
  313.   #--------------------------------------------------------------------------
  314.   # ● 设置文本
  315.   #--------------------------------------------------------------------------
  316.   def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil)
  317.     if @test != text1
  318.       @test = text1
  319.     else
  320.       return
  321.     end   
  322.     self.contents.clear
  323.     self.contents.font.color = normal_color
  324.     self.contents.draw_text(4, 0, self.width - 40, 32, text1)
  325.     if text2 != nil
  326.       self.contents.draw_text(4 , 32, self.width - 40, 32, text2)
  327.     end
  328.     self.contents.font.size -= 4
  329.     if text3 != nil
  330.       self.contents.draw_text(4 , 64, self.width - 40, 32, text3)
  331.     end
  332.     if text4 != nil
  333.       self.contents.draw_text(4 , 96, self.width - 40, 32, text4)
  334.     end
  335.     self.contents.font.size += 4
  336.   end
  337. end
  338. #==============================================================================
  339. # ■ Scene_lvup
  340. #------------------------------------------------------------------------------
  341. #  处理升级画面的类。
  342. #==============================================================================
  343. class Scene_Lvup
  344.   #--------------------------------------------------------------------------
  345.   # ● 初始化对像
  346.   #     actor_index : 角色索引
  347.   #     menu_index : 选项起始位置
  348.   #--------------------------------------------------------------------------
  349.   def initialize(actor_index = 0 , menu_index = 0)
  350.     @actor_index = actor_index
  351.     @menu_index = menu_index
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ● 主处理
  355.   #--------------------------------------------------------------------------
  356.   def main
  357.     s1 = "增加体质"
  358.     s2 = "增加"+$data_system.words.str
  359.     s3 = "增加"+$data_system.words.dex
  360.     s4 = "增加"+$data_system.words.agi
  361.     s5 = "增加"+$data_system.words.int
  362.     s6 = "确认加点"
  363.     s7 = "点数重置"
  364.     @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7])
  365.     @command_window.index = @menu_index
  366.     # 获取角色
  367.     @actor = $game_party.actors[@actor_index]
  368.     # 将角色的剩余点数带入
  369.     $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  370.     # 初始化临时量
  371.     $temp_str = 0
  372.     $temp_dex = 0
  373.     $temp_agi = 0
  374.     $temp_int = 0
  375.     $temp_hp = 0
  376.     $temp_sp = 0
  377.     #=========================================================================
  378.     # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
  379.     #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
  380.     #=========================================================================
  381.     # 每提升一次力量,提升多少附加能力
  382.     #=========================================================================
  383.     @str_hp = 30     # 每提升一次力量附加提升多少HP
  384.     @str_sp = 0     # 每提升一次力量附加提升多少SP
  385.     @str_dex = 0    # 每提升一次力量附加提升多少灵巧
  386.     @str_agi = 0    # 每提升一次力量附加提升多少速度
  387.     @str_int = 0    # 每提升一次力量附加提升多少魔力
  388.     @str_str = 3    # 每提升一次力量附加提升多少力量
  389.     #=========================================================================
  390.     # 每提升一次灵巧,提升多少附加能力
  391.     #=========================================================================
  392.     @dex_hp = 0     # 每提升一次灵巧附加提升多少HP
  393.     @dex_sp = 0     # 每提升一次灵巧附加提升多少SP
  394.     @dex_str = 0    # 每提升一次灵巧附加提升多少力量
  395.     @dex_agi = 0    # 每提升一次灵巧附加提升多少速度
  396.     @dex_int = 0    # 每提升一次灵巧附加提升多少魔力
  397.     @dex_dex = 3    # 每提升一次灵巧附加提升多少灵巧
  398.     #=========================================================================
  399.     # 每提升一次速度,提升多少附加能力
  400.     #=========================================================================
  401.     @agi_hp = 0     # 每提升一次速度附加提升多少HP
  402.     @agi_sp = 0     # 每提升一次速度附加提升多少SP
  403.     @agi_str = 0    # 每提升一次速度附加提升多少力量
  404.     @agi_dex = 0    # 每提升一次速度附加提升多少灵巧
  405.     @agi_int = 0    # 每提升一次速度附加提升多少魔力
  406.     @agi_agi = 3    # 每提升一次速度附加提升多少速度
  407.     #=========================================================================
  408.     # 每提升一次魔力,提升多少附加能力
  409.     #=========================================================================
  410.     @int_hp = 0     # 每提升一次魔力附加提升多少HP
  411.     @int_sp = 30    # 每提升一次魔力附加提升多少SP
  412.     @int_str = 0   # 每提升一次魔力附加提升多少力量
  413.     @int_dex = 0   # 每提升一次魔力附加提升多少灵巧
  414.     @int_agi = 0   # 每提升一次魔力附加提升多少速度
  415.     @int_int = 3   # 每提升一次魔力附加提升多少魔力
  416.     #=========================================================================
  417.     # 每提升一次体力,提升多少附加能力
  418.     #=========================================================================
  419.     @hp = 100       # 每提升一次体力提升多少HP
  420.     @sp = 50       # 每提升一次体力提升多少SP
  421.     @hp_str = 0   # 每提升一次体力提升多少力量
  422.     @hp_dex = 0   # 每提升一次体力提升多少速度
  423.     @hp_agi = 0   # 每提升一次体力提升多少灵巧
  424.     @hp_int = 0   # 每提升一次体力提升多少魔力   
  425.     # 定义说明文字
  426.     @text_hp_sc = "体质可以增加生存的能力,可以延长生存的时间!"
  427.     @text_str_sc = $data_system.words.str + "可以增加物理攻击和物理技能的威力!"
  428.     @text_dex_sc = $data_system.words.dex + "可以提高攻击的命中率和必杀!"
  429.     @text_agi_sc = $data_system.words.agi + "可以提高回避、命中、逃跑成功率!"
  430.     @text_int_sc = $data_system.words.int + "可以提高魔法的效果,可以增加1点魔法!"
  431.     @text_save = "保存分配情况并返回游戏"
  432.     @text_reset= "重新分配能力点数"
  433.     @text_2 = "每增加一次此项能力值,可以提升能力值"
  434.     @text_hp = "最大" + $data_system.words.hp + "值"
  435.     @text_sp = "最大" + $data_system.words.sp + "值"
  436.     @text_str = "最大" + $data_system.words.str + "值"
  437.     @text_dex = "最大" + $data_system.words.dex + "值"
  438.     @text_agi = "最大" + $data_system.words.agi + "值"
  439.     @text_int = "最大" + $data_system.words.int + "值"
  440.     s_disable
  441.     # 生成状态窗口
  442.     @lvup_window = Window_Lvup.new(@actor)
  443.     @lvup_window.x = 128
  444.     @lvup_window.y = 0   
  445.     # 生成帮助窗口并初始化帮助文本
  446.     @help_window = Window_Lvup_Help.new   
  447.     # 执行过渡
  448.     Graphics.transition(40, "Graphics/Transitions/" + $data_system.battle_transition)
  449.     # 主循环
  450.     loop do
  451.       # 刷新游戏画面
  452.       Graphics.update
  453.       # 刷新输入信息
  454.       Input.update
  455.       # 刷新画面
  456.       update
  457.       # 如果切换画面就中断循环
  458.       if $scene != self
  459.         break
  460.       end
  461.     end
  462.     # 准备过渡
  463.     Graphics.freeze
  464.     # 释放窗口
  465.     @command_window.dispose
  466.     @lvup_window.dispose
  467.     @help_window.dispose
  468.   end
  469.   #--------------------------------------------------------------------------
  470.   # ● 刷新画面
  471.   #--------------------------------------------------------------------------
  472.   def update
  473.     # 刷新窗口
  474.     @command_window.update
  475.     # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
  476.     s_disable
  477.     @lvup_window.update
  478.     #=============================================================
  479.     # 按下 B 键的情况下
  480.     #=============================================================
  481.     if Input.trigger?(Input::B)
  482.       # 演奏取消 SE
  483.       $game_system.se_play($data_system.cancel_se)
  484.       # 切换到地图画面
  485.       $scene = Scene_Menu.new(0)
  486.       return
  487.     end
  488.     #=============================================================
  489.     # 按下 C 键的情况下
  490.     #=============================================================
  491.     if Input.trigger?(Input::C)      
  492.       if @command_window.index == 5
  493.           # 演奏确定 SE
  494.         $game_system.se_play($data_system.decision_se)
  495.         # 将角色的剩余点数带回
  496.         $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
  497.         # 将角色点数实际加上
  498.         @actor.str += $temp_str
  499.         @actor.dex += $temp_dex
  500.         @actor.agi += $temp_agi
  501.         @actor.int += $temp_int
  502.         @actor.maxhp += $temp_hp
  503.         @actor.maxsp += $temp_sp
  504.         # 切换到地图画面
  505.         $scene = Scene_Map.new
  506.         return
  507.       end
  508.       if @command_window.index == 6
  509.           # 演奏确定 SE
  510.         $game_system.se_play($data_system.cancel_se)
  511.           # 将角色的剩余点数带入
  512.         $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  513.           # 初始化临时量
  514.         $temp_str = 0
  515.         $temp_dex = 0
  516.         $temp_agi = 0
  517.         $temp_int = 0
  518.         $temp_hp = 0
  519.         $temp_sp = 0
  520.         @lvup_window.refresh
  521.         return
  522.       end
  523.       if $point == 0
  524.         # 演奏冻结 SE
  525.         $game_system.se_play($data_system.buzzer_se)
  526.         return
  527.       end
  528.       case @command_window.index
  529.       when 0
  530.         # 演奏确定 SE
  531.         $game_system.se_play($data_system.decision_se)
  532.         $temp_hp += @hp
  533.         $temp_sp += @sp
  534.         $temp_str += @hp_str
  535.         $temp_dex += @hp_dex
  536.         $temp_agi += @hp_agi
  537.         $temp_int += @hp_int
  538.         $point -= 1
  539.         @lvup_window.refresh
  540.         s_disable
  541.         return
  542.       when 1
  543.         # 演奏确定 SE
  544.         $game_system.se_play($data_system.decision_se)
  545.         $temp_str += @str_str
  546.         $temp_hp += @str_hp
  547.         $temp_sp += @str_sp
  548.         $temp_dex += @str_dex
  549.         $temp_agi += @str_agi
  550.         $temp_int += @str_int
  551.         $point -= 1
  552.         @lvup_window.refresh
  553.         s_disable
  554.         return
  555.       when 2
  556.         # 演奏确定 SE
  557.         $game_system.se_play($data_system.decision_se)
  558.         $temp_dex += @dex_dex
  559.         $temp_hp += @dex_hp
  560.         $temp_sp += @dex_sp
  561.         $temp_str += @dex_str
  562.         $temp_agi += @dex_agi
  563.         $temp_int += @dex_int
  564.         $point -= 1
  565.         @lvup_window.refresh
  566.         s_disable
  567.         return
  568.       when 3
  569.         # 演奏确定 SE
  570.         $game_system.se_play($data_system.decision_se)
  571.         $temp_agi += @agi_agi
  572.         $temp_hp += @agi_hp
  573.         $temp_sp += @agi_sp
  574.         $temp_str += @agi_str
  575.         $temp_dex += @agi_dex
  576.         $temp_int += @agi_int
  577.         $point -= 1
  578.         @lvup_window.refresh
  579.         s_disable
  580.         return
  581.       when 4
  582.         # 演奏确定 SE
  583.         $game_system.se_play($data_system.decision_se)
  584.         $temp_int += @int_int
  585.         $temp_hp += @int_hp
  586.         $temp_sp += @int_sp
  587.         $temp_str += @int_str
  588.         $temp_dex += @int_dex
  589.         $temp_agi += @int_agi
  590.         $point -= 1
  591.         @lvup_window.refresh
  592.         s_disable
  593.         return
  594.       end
  595.     end
  596.     #=============================================================
  597.     # 什么都没有按下的情况
  598.     #=============================================================
  599.     case @command_window.index   
  600.     when 0  # 增加体力
  601.       temptext1 = @text_hp + @hp.to_s + "点   " + @text_str + @hp_str.to_s + "点   " + @text_dex + @hp_dex.to_s + "点"
  602.       temptext2 = @text_sp + @sp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_int + @hp_int.to_s + "点"
  603.       @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
  604.     when 1  # 增加力量
  605.       temptext1 = @text_hp + @str_hp.to_s + "点   " + @text_str + @str_str.to_s + "点   " + @text_dex + @str_dex.to_s + "点"
  606.       temptext2 = @text_sp + @str_sp.to_s + "点   " + @text_agi + @str_agi.to_s + "点   " + @text_int + @str_int.to_s + "点"
  607.       @help_window.lvup_text(@text_str_sc , @text_2 , temptext1 , temptext2)
  608.     when 2  # 增加灵巧
  609.       temptext1 = @text_hp + @dex_hp.to_s + "点   " + @text_str + @dex_agi.to_s + "点   " + @text_dex + @dex_dex.to_s + "点"
  610.       temptext2 = @text_sp + @dex_sp.to_s + "点   " + @text_agi + @dex_agi.to_s + "点   " + @text_int + @dex_int.to_s + "点"
  611.       @help_window.lvup_text(@text_dex_sc , @text_2 , temptext1 , temptext2)
  612.     when 3  # 增加速度
  613.       temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_str + @agi_str.to_s + "点   " + @text_dex + @agi_dex.to_s + "点"
  614.       temptext2 = @text_sp + @agi_sp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_int + @agi_int.to_s + "点"
  615.       @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
  616.     when 4  # 增加魔力
  617.       temptext1 = @text_hp + @int_hp.to_s + "点   " + @text_str + @int_str.to_s + "点   " + @text_dex + @int_dex.to_s + "点"
  618.       temptext2 = @text_sp + @int_sp.to_s + "点   " + @text_agi + @int_agi.to_s + "点   " + @text_int + @int_int.to_s + "点"
  619.       @help_window.lvup_text(@text_int_sc , @text_2 , temptext1 , temptext2)
  620.     when 5 # 保存设定
  621.       @help_window.lvup_text(@text_save)
  622.     when 6 # 点数重置
  623.       @help_window.lvup_text(@text_reset)     
  624.     end
  625.     #=============================================================
  626.     # 按下R与L换人的情况
  627.     #=============================================================      
  628.     if Input.trigger?(Input::R)
  629.       # 演奏光标 SE
  630.       $game_system.se_play($data_system.cursor_se)
  631.       # 移至下一位角色
  632.       @actor_index += 1
  633.       @actor_index %= $game_party.actors.size
  634.       # 切换到别的状态画面
  635.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  636.       return
  637.     end
  638.     # 按下 L 键的情况下
  639.     if Input.trigger?(Input::L)
  640.       # 演奏光标 SE
  641.       $game_system.se_play($data_system.cursor_se)
  642.       # 移至上一位角色
  643.       @actor_index += $game_party.actors.size - 1
  644.       @actor_index %= $game_party.actors.size
  645.       # 切换到别的状态画面
  646.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  647.       return
  648.     end
  649.   end  
  650.   #--------------------------------------------------------------------------
  651.   # ● 选项明暗判断
  652.   #--------------------------------------------------------------------------
  653.   def s_disable
  654.     # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
  655.     if $point == 0
  656.       @command_window.disable_item(0)
  657.       @command_window.disable_item(1)
  658.       @command_window.disable_item(2)
  659.       @command_window.disable_item(3)
  660.       @command_window.disable_item(4)
  661.     else
  662.       @command_window.able_item(0)
  663.       @command_window.able_item(1)      
  664.       @command_window.able_item(2)
  665.       @command_window.able_item(3)
  666.       @command_window.able_item(4)
  667.     end
  668.   end
  669. end

  670. #==============================================================================
  671. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  672. #==============================================================================
复制代码

点评

抱歉 大大 我看漏了-.-,多谢啦  发表于 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.

在本版发帖返回顶部