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

Project1

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

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

[复制链接]

Lv4.逐梦者

梦石
0
星屑
5987
在线时间
1557 小时
注册时间
2011-6-14
帖子
520
跳转到指定楼层
1
发表于 2015-8-4 13:08:35 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
关于升级加点脚本,如何在开启开关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 手动认可奖励

查看全部评分

Lv5.捕梦者

梦石
0
星屑
33079
在线时间
5104 小时
注册时间
2012-11-19
帖子
4878

开拓者

2
发表于 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 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

Lv3.寻梦者

小空格

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

点评

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

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5987
在线时间
1557 小时
注册时间
2011-6-14
帖子
520
4
 楼主| 发表于 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
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-23 05:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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