查看: 1511|回复: 2

[已经解决] 請高手看配點腳本哪裡錯誤(已解決)

[复制链接]
梦石
0
星屑
50
在线时间
163 小时
注册时间
2012-3-3
回帖
36
发表于 2012-11-10 09:42:42 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 米血 于 2012-11-10 15:15 编辑

原本只有5種配點
我想要新增成6個配點值   "增加体力"."增加魔力","增加atk "."增加def "."增加agi "."增加spi"
於是就自己修改看看
但是一直有毛病
請高手幫忙看一下哪裡錯誤
謝謝


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

  4. # 脚本使用设定:

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

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

  14. # 本脚本不会取代原来的升级自动加点 也就是说,默认的升级还在,但可以用这个功能手动追加点数。
  15. # 如果你想纯粹使用手动加点(而升级不提升能力),只要把数据库中角色升级能力,
  16. # 1-99级全部等于一个相同数值就行了。

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

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

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

  22. #==============================================================================
  23. # ■ Window_Command
  24. #------------------------------------------------------------------------------
  25. #  一般的命令选择行窗口。(追加定义)
  26. #==============================================================================
  27. class Window_Command < Window_Selectable
  28.   #--------------------------------------------------------------------------
  29.   # ● 项目有效化
  30.   #     index : 项目编号
  31.   #--------------------------------------------------------------------------
  32.   def able_item(index)
  33.     draw_item(index, normal_color)
  34.   end
  35. end
  36. #==============================================================================
  37. # ■ Game_Actor
  38. #------------------------------------------------------------------------------
  39. #  处理角色的类。(再定义)
  40. #==============================================================================

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

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

  4. # 脚本使用设定:

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

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

  14. # 本脚本不会取代原来的升级自动加点 也就是说,默认的升级还在,但可以用这个功能手动追加点数。
  15. # 如果你想纯粹使用手动加点(而升级不提升能力),只要把数据库中角色升级能力,
  16. # 1-99级全部等于一个相同数值就行了。

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

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

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

  22. #==============================================================================
  23. # ■ Window_Command
  24. #------------------------------------------------------------------------------
  25. #  一般的命令选择行窗口。(追加定义)
  26. #==============================================================================
  27. class Window_Command < Window_Selectable
  28.   #--------------------------------------------------------------------------
  29.   # ● 项目有效化
  30.   #     index : 项目编号
  31.   #--------------------------------------------------------------------------

  32.   def able_item(index)
  33.     draw_item(index, normal_color)
  34.   end
  35. end
  36. #==============================================================================
  37. # ■ Game_Actor
  38. #------------------------------------------------------------------------------
  39. #  处理角色的类。(再定义)
  40. #==============================================================================

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

  233. class Window_Lvpoint < Window_Base
  234.   def initialize
  235.     super(40,198+69,128,58)
  236.     self.opacity = 0
  237.     refresh
  238.   end
  239.   def refresh
  240.     self.contents.clear
  241.     draw_actor_lvup(@actor, 0, 0, 4)
  242.   end
  243. end
  244. #==============================================================================
  245. # ■ Window_lvup
  246. #------------------------------------------------------------------------------
  247. #  显示升级状态窗口。
  248. #==============================================================================
  249. class Window_Lvup < Window_Base
  250.   #--------------------------------------------------------------------------
  251.   # ● 初始化对像
  252.   #     actor : 角色
  253.   #--------------------------------------------------------------------------
  254.   def initialize(actor)
  255.     super(0, 0, 416, 256+24)  
  256.     self.contents = Bitmap.new(width - 32, height - 32)
  257.     self.opacity = 0
  258.     @actor = actor
  259.     refresh
  260.   end  
  261.   #--------------------------------------------------------------------------
  262.   # ● 刷新
  263.   #--------------------------------------------------------------------------
  264.   def refresh


  265.     self.contents.clear
  266.     draw_actor_graphic(@actor, 30, 80)
  267.     draw_actor_name(@actor, 4, 0)
  268.     draw_actor_class(@actor, 96, 0)
  269.     draw_actor_level(@actor, 224, 0)
  270.     draw_actor_state(@actor, 96, 32)   
  271.     draw_actor_hp_lvup(@actor, 96, 32)
  272.     draw_actor_mp_lvup(@actor, 96, 64)
  273.     draw_actor_lvup(@actor, 4, 96, 0)
  274.     draw_actor_lvup(@actor, 4, 128, 1)
  275.     draw_actor_lvup(@actor, 4, 160, 2)
  276.     draw_actor_lvup(@actor, 4, 192, 3)
  277.   end
  278. end
  279. #==============================================================================
  280. # ■ Window_Help
  281. #------------------------------------------------------------------------------
  282. #  特技及物品的说明、角色的状态显示的窗口。
  283. #==============================================================================
  284. class Window_Lvup_Help < Window_Base
  285.   #--------------------------------------------------------------------------
  286.   # ● 初始化对像
  287.   #--------------------------------------------------------------------------
  288.   def initialize
  289.     super(68, 256+64, 544, 160)
  290.     self.contents = Bitmap.new(width - 32, height - 32)
  291.     self.opacity = 0
  292.     @test = "" #——这个东西用来检测,节约内存专用
  293.   end  
  294.   #--------------------------------------------------------------------------
  295.   # ● 设置文本
  296.   #--------------------------------------------------------------------------
  297.   def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil)
  298.     if @test != text1
  299.       @test = text1
  300.     else
  301.       return
  302.     end   
  303.     self.contents.clear
  304.     self.contents.font.color = normal_color
  305.     self.contents.draw_text(4, 0, self.width - 40, 32, text1)
  306.     if text2 != nil
  307.       self.contents.draw_text(4 , 32, self.width - 40, 32, text2)
  308.     end
  309.     self.contents.font.size -= 4
  310.     if text3 != nil
  311.       self.contents.draw_text(4 , 64, self.width - 40, 32, text3)
  312.     end
  313.     if text4 != nil
  314.       self.contents.draw_text(4 , 96, self.width - 40, 32, text4)
  315.     end
  316.     self.contents.font.size += 4
  317.   end
  318. end
  319. #==============================================================================
  320. # ■ Scene_lvup
  321. #------------------------------------------------------------------------------
  322. #  处理升级画面的类。
  323. #==============================================================================
  324. class Scene_Lvup
  325.   #--------------------------------------------------------------------------
  326.   # ● 初始化对像
  327.   #     actor_index : 角色索引
  328.   #     menu_index : 选项起始位置
  329.   #--------------------------------------------------------------------------
  330.   def initialize(actor_index = 0 , menu_index = nil)
  331.     @actor_index = actor_index
  332.     @menu_index = menu_index
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ● 主处理
  336.   #--------------------------------------------------------------------------
  337.   def main
  338.     s1 = "增加生命"
  339.     s2 = "增加魔力"
  340.     s3 = "增加攻击"
  341.     s4 = "增加防御"
  342.     s5 = "增加敏捷"
  343.     s6 = "增加智力"
  344.     s7 = "确认分配"
  345.     s8 = "点数重置"
  346.     @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7, s8])
  347.     @command_window.x=20
  348.     @command_window.y=33
  349.     @command_window.opacity = 0
  350.     #@command_window.index = @menu_index
  351.     # 获取角色
  352.     @actor = $game_party.members[@actor_index]
  353.     # 将角色的剩余点数带入
  354.     $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  355.     # 初始化临时量
  356.     $temp_atk = 0
  357.     $temp_def = 0
  358.     $temp_agi = 0
  359.     $temp_spi = 0
  360.     $temp_hp = 0
  361.     $temp_mp = 0
  362.     #=========================================================================
  363.     # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
  364.     #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
  365.     #=========================================================================
  366.     # 每提升一次HP,提升多少附加能力
  367.     #=========================================================================
  368.     @hp_hp = 10     # 每提升一次力量附加提升多少HP
  369.     @hp_mp = 0     # 每提升一次力量附加提升多少MP
  370.     @hp_def = 0    # 每提升一次力量附加提升多少灵巧
  371.     @hp_agi = 0    # 每提升一次力量附加提升多少速度
  372.     @hp_spi = 0    # 每提升一次力量附加提升多少魔力
  373.     @hp_atk = 0    # 每提升一次力量附加提升多少力量
  374.     #=========================================================================
  375.     # 每提升一次MP,提升多少附加能力
  376.     #=========================================================================
  377.     @mp_hp = 0     # 每提升一次力量附加提升多少HP
  378.     @mp_mp = 5     # 每提升一次力量附加提升多少MP
  379.     @mp_def = 0    # 每提升一次力量附加提升多少灵巧
  380.     @mp_agi = 0    # 每提升一次力量附加提升多少速度
  381.     @mp_spi = 0    # 每提升一次力量附加提升多少魔力
  382.     @mp_atk = 0    # 每提升一次力量附加提升多少力量
  383.     #=========================================================================
  384.     # 每提升一次力量,提升多少附加能力
  385.     #=========================================================================
  386.     @atk_hp = 0     # 每提升一次力量附加提升多少HP
  387.     @atk_mp = 0     # 每提升一次力量附加提升多少MP
  388.     @atk_def = 0    # 每提升一次力量附加提升多少灵巧
  389.     @atk_agi = 0    # 每提升一次力量附加提升多少速度
  390.     @atk_spi = 0    # 每提升一次力量附加提升多少魔力
  391.     @atk_atk = 2    # 每提升一次力量附加提升多少力量
  392.     #=========================================================================
  393.     # 每提升一次灵巧,提升多少附加能力
  394.     #=========================================================================
  395.     @def_hp = 0     # 每提升一次灵巧附加提升多少HP
  396.     @def_mp = 0     # 每提升一次灵巧附加提升多少MP
  397.     @def_atk = 0    # 每提升一次灵巧附加提升多少力量
  398.     @def_agi = 0    # 每提升一次灵巧附加提升多少速度
  399.     @def_spi = 0    # 每提升一次灵巧附加提升多少魔力
  400.     @def_def = 2    # 每提升一次灵巧附加提升多少灵巧
  401.     #=========================================================================
  402.     # 每提升一次速度,提升多少附加能力
  403.     #=========================================================================
  404.     @agi_hp = 0     # 每提升一次速度附加提升多少HP
  405.     @agi_mp = 0     # 每提升一次速度附加提升多少MP
  406.     @agi_atk = 0    # 每提升一次速度附加提升多少力量
  407.     @agi_def = 0    # 每提升一次速度附加提升多少灵巧
  408.     @agi_spi = 0    # 每提升一次速度附加提升多少魔力
  409.     @agi_agi = 2    # 每提升一次速度附加提升多少速度
  410.     #=========================================================================
  411.     # 每提升一次魔力,提升多少附加能力
  412.     #=========================================================================
  413.     @spi_hp = 0     # 每提升一次魔力附加提升多少HP
  414.     @spi_mp = 0    # 每提升一次魔力附加提升多少MP
  415.     @spi_atk = 0   # 每提升一次魔力附加提升多少力量
  416.     @spi_def = 0   # 每提升一次魔力附加提升多少灵巧
  417.     @spi_agi = 0   # 每提升一次魔力附加提升多少速度
  418.     @spi_spi = 2   # 每提升一次魔力附加提升多少魔力
  419.     # 定义说明文字
  420.     @text_hp_sc = "生命可以增加生存的能力,可以延长生存的时间!"
  421.     @text_mp_sc = "体力可以增加MP"
  422.     @text_atk_sc = Vocab::atk + "可以增加物理攻击和物理技能的威力!"
  423.     @text_def_sc = Vocab::def + "可以提高对物理攻击的减免"
  424.     @text_agi_sc = Vocab::agi + "可以提高回避、命中、暴击以及逃跑成功率!"
  425.     @text_spi_sc = Vocab::spi + "可以提高魔法的效果!"
  426.     @text_save = "保存分配情况并返回游戏"
  427.     @text_reset= "重新分配能力点数"
  428.     @text_2 = "每增加一次此项能力,可以提升的能力值"
  429.     @text_hp = "" + Vocab::hp + "值"
  430.     @text_mp = "" + Vocab::mp + "值"
  431.     @text_atk = "最大" + Vocab::atk + "值"
  432.     @text_def = "最大" + Vocab::def + "值"
  433.     @text_spi = "最大" + Vocab::spi + "值"
  434.     @text_agi = "最大" + Vocab::agi + "值"
  435.     s_disable
  436.     # 生成状态窗口
  437.     @lvup_window = Window_Lvup.new(@actor)
  438.     @lvup_window.x = 246
  439.     @lvup_window.y = 0   
  440.     @lvpoint_window = Window_Lvpoint.new
  441.     # 生成帮助窗口并初始化帮助文本
  442.     @help_window = Window_Lvup_Help.new   
  443.     @jd = Sprite.new
  444.     @jd.bitmap = Cache.system("Lvup_window")
  445.     # 执行过渡
  446.     Graphics.transition
  447.     # 主循环
  448.     loop do
  449.       # 刷新游戏画面
  450.       Graphics.update
  451.       # 刷新输入信息
  452.       Input.update
  453.       # 刷新画面
  454.       update
  455.       # 如果切换画面就中断循环
  456.       if $scene != self
  457.         break
  458.       end
  459.     end
  460.     # 准备过渡

  461.     Graphics.freeze
  462.     # 释放窗口
  463.     @jd.dispose
  464.     @lvpoint_window.dispose
  465.     @command_window.dispose
  466.     @lvup_window.dispose
  467.     @help_window.dispose
  468.   end
  469.   
  470.   #def return_scene
  471.    # if @menu_index
  472.     #  $scene = Scene_Menu.new(@menu_index)
  473.     #else
  474.      # $scene = Scene_Menu.new(4)
  475.     #end
  476.   #end
  477.   
  478.   #--------------------------------------------------------------------------
  479.   # ● 刷新画面
  480.   #--------------------------------------------------------------------------
  481.   def update
  482.     # 刷新窗口
  483.     @command_window.update
  484.     # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
  485.     s_disable
  486.     @lvup_window.update
  487.     #=============================================================
  488.     # 按下 B 键的情况下
  489.     #=============================================================
  490.     if Input.trigger?(Input::B)
  491.       # 演奏取消 SE
  492.       Sound.play_cancel
  493.       # 将角色的剩余点数带回

  494.       
  495.       $scene = Scene_Menu.new(4)
  496. #      return_scene
  497.       return
  498.     end
  499.     #=============================================================
  500.     # 按下 C 键的情况下
  501.     #=============================================================
  502.     if Input.trigger?(Input::C)      
  503.        if @command_window.index == 6
  504.            # 演奏确定 SE
  505.          Sound.play_decision
  506.         # 将角色的剩余点数带回
  507.          $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
  508.          # 将角色点数实际加上
  509.          @actor.atk += $temp_atk
  510.          @actor.def += $temp_def
  511.          @actor.agi += $temp_agi
  512.         @actor.spi += $temp_spi
  513.          @actor.maxhp += $temp_hp
  514.          @actor.maxmp += $temp_mp
  515.          
  516.         $scene = Scene_Lvup.new
  517.         # return_scene
  518.          return
  519.       end
  520.       if @command_window.index == 7
  521.           # 演奏确定 SE
  522.         Sound.play_decision
  523.           # 将角色的剩余点数带入
  524.         $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  525.           # 初始化临时量
  526.         $temp_atk = 0
  527.         $temp_def = 0
  528.         $temp_agi = 0
  529.         $temp_spi = 0
  530.         $temp_hp = 0
  531.         $temp_mp = 0
  532.         @lvup_window.refresh
  533.         @lvpoint_window.refresh
  534.         return
  535.       end
  536.       if $point == 0
  537.         # 演奏冻结 SE
  538.         Sound.play_buzzer
  539.         return
  540.       end
  541.       case @command_window.index
  542.       when 0
  543.         # 演奏确定 SE
  544.         Sound.play_decision
  545.         $temp_hp += @hp_hp
  546.         $temp_mp += @hp_mp
  547.         $temp_atk += @hp_atk
  548.         $temp_def += @hp_def
  549.         $temp_agi += @hp_agi
  550.         $temp_spi += @hp_spi
  551.         $point -= 1
  552.         @lvup_window.refresh
  553.         @lvpoint_window.refresh
  554.         s_disable
  555.         return
  556.       when 1
  557.         # 演奏确定 SE
  558.         Sound.play_decision
  559.         $temp_mp += @mp_mp
  560.         $temp_hp += @mp_hp
  561.         $temp_atk += @mp_atk
  562.         $temp_def += @mp_def
  563.         $temp_agi += @mp_agi
  564.         $temp_spi += @mp_spi
  565.         $point -= 1
  566.         @lvup_window.refresh
  567.         @lvpoint_window.refresh
  568.         s_disable
  569.         return
  570.       when 2
  571.         # 演奏确定 SE
  572.         Sound.play_decision
  573.         $temp_atk += @atk_atk
  574.         $temp_hp += @atk_hp
  575.         $temp_mp += @atk_mp
  576.         $temp_def += @atk_def
  577.         $temp_agi += @atk_agi
  578.         $temp_spi += @atk_spi
  579.         $point -= 1
  580.         @lvup_window.refresh
  581.         @lvpoint_window.refresh
  582.         s_disable
  583.         return
  584.       when 3
  585.         # 演奏确定 SE
  586.         Sound.play_decision
  587.         $temp_def += @def_def
  588.         $temp_hp += @def_hp
  589.         $temp_mp += @def_mp
  590.         $temp_atk += @def_atk
  591.         $temp_agi += @def_agi
  592.         $temp_spi += @def_spi
  593.         $point -= 1
  594.         @lvup_window.refresh
  595.         @lvpoint_window.refresh
  596.         s_disable
  597.         return
  598.       when 4
  599.         # 演奏确定 SE
  600.         Sound.play_decision
  601.         $temp_agi += @agi_agi
  602.         $temp_hp += @agi_hp
  603.         $temp_mp += @agi_mp
  604.         $temp_atk += @agi_atk
  605.         $temp_def += @agi_def
  606.         $temp_spi += @agi_spi
  607.         $point -= 1
  608.         @lvup_window.refresh
  609.         @lvpoint_window.refresh
  610.         s_disable
  611.         return
  612.       when 5
  613.         # 演奏确定 SE
  614.         Sound.play_decision
  615.         $temp_spi += @spi_spi
  616.         $temp_hp += @spi_hp
  617.         $temp_mp += @spi_mp
  618.         $temp_atk += @spi_atk
  619.         $temp_def += @spi_def
  620.         $temp_agi += @spi_agi
  621.         $point -= 1
  622.         @lvup_window.refresh
  623.         @lvpoint_window.refresh
  624.         s_disable
  625.         return
  626.       when 6
  627.         # 演奏确定 SE
  628.         Sound.play_decision
  629.         $temp_agi += @spi_agi
  630.         $temp_hp += @spi_hp
  631.         $temp_mp += @spi_mp
  632.         $temp_atk += @spi_atk
  633.         $temp_def += @spi_def
  634.         $temp_spi += @spi_spi
  635.         $point -= 1
  636.         @lvup_window.refresh
  637.         @lvpoint_window.refresh
  638.         s_disable
  639.         return
  640.       end
  641.     end
  642.     #=============================================================
  643.     # 什么都没有按下的情况
  644.     #=============================================================
  645.     case @command_window.index   
  646.     when 0  # 增加生命
  647.       temptext1 = @text_hp + @hp_hp.to_s + "点   " + @text_atk + @hp_atk.to_s + "点   " + @text_def + @hp_def.to_s + "点"
  648.       temptext2 = @text_mp + @hp_mp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_spi + @hp_spi.to_s + "点"
  649.       @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
  650.     when 1  # 增加体力
  651.       temptext1 = @text_hp + @mp_hp.to_s + "点   " + @text_atk + @hp_atk.to_s + "点   " + @text_def + @hp_def.to_s + "点"
  652.       temptext2 = @text_mp + @mp_mp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_spi + @hp_spi.to_s + "点"
  653.       @help_window.lvup_text(@text_mp_sc , @text_2 , temptext1 , temptext2)
  654.     when 2  # 增加力量
  655.       temptext1 = @text_hp + @atk_hp.to_s + "点   " + @text_atk + @atk_atk.to_s + "点   " + @text_def + @atk_def.to_s + "点"
  656.       temptext2 = @text_mp + @atk_mp.to_s + "点   " + @text_agi + @atk_agi.to_s + "点   " + @text_spi + @atk_spi.to_s + "点"
  657.       @help_window.lvup_text(@text_atk_sc , @text_2 , temptext1 , temptext2)
  658.     when 3  # 增加防御
  659.       temptext1 = @text_hp + @def_hp.to_s + "点   " + @text_atk + @def_agi.to_s + "点   " + @text_def + @def_def.to_s + "点"
  660.       temptext2 = @text_mp + @def_mp.to_s + "点   " + @text_agi + @def_agi.to_s + "点   " + @text_spi + @def_spi.to_s + "点"
  661.       @help_window.lvup_text(@text_def_sc , @text_2 , temptext1 , temptext2)
  662.     when 4  # 增加速度
  663.       temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_atk + @agi_atk.to_s + "点   " + @text_def + @agi_def.to_s + "点"
  664.       temptext2 = @text_mp + @agi_mp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_spi + @agi_spi.to_s + "点"
  665.       @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
  666.     when 5  # 增加魔力
  667.       temptext1 = @text_hp + @spi_hp.to_s + "点   " + @text_atk + @spi_atk.to_s + "点   " + @text_def + @spi_def.to_s + "点"
  668.       temptext2 = @text_mp + @spi_mp.to_s + "点   " + @text_agi + @spi_agi.to_s + "点   " + @text_spi + @spi_spi.to_s + "点"
  669.       @help_window.lvup_text(@text_spi_sc , @text_2 , temptext1 , temptext2)
  670.     when 6 # 保存设定
  671.       @help_window.lvup_text(@text_save)
  672.     when 7 # 点数重置
  673.       @help_window.lvup_text(@text_reset)     
  674.     end
  675.     #=============================================================
  676.     # 按下R与L换人的情况
  677.     #=============================================================      
  678.     if Input.trigger?(Input::R)
  679.       # 演奏光标 SE
  680.       Sound.play_cursor
  681.       # 移至下一位角色
  682.       @actor_index += 1
  683.       @actor_index %= $game_party.members.size
  684.       # 切换到别的状态画面
  685.       #$scene = Scene_Lvup.new(@actor_index , @command_window.index)
  686.       $scene = Scene_Lvup.new(@actor_index , @meun_index)
  687.       return
  688.     end
  689.     # 按下 L 键的情况下
  690.     if Input.trigger?(Input::L)
  691.       # 演奏光标 SE
  692.       Sound.play_cursor
  693.       # 移至上一位角色
  694.       @actor_index += $game_party.members.size - 1
  695.       @actor_index %= $game_party.members.size
  696.       # 切换到别的状态画面
  697.       #$scene = Scene_Lvup.new(@actor_index , @command_window.index)
  698.       $scene = Scene_Lvup.new(@actor_index , @menu_index)
  699.       return
  700.     end
  701.   end  
  702.   #--------------------------------------------------------------------------
  703.   # ● 选项明暗判断
  704.   #--------------------------------------------------------------------------
  705.   def s_disable
  706.     # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
  707.     if $point == 0
  708.       enabled = false
  709.     else
  710.       enabled = true
  711.     end
  712.       @command_window.draw_item(0,enabled)
  713.       @command_window.draw_item(1,enabled)
  714.       @command_window.draw_item(2,enabled)
  715.       @command_window.draw_item(3,enabled)
  716.       @command_window.draw_item(4,enabled)
  717.       @command_window.draw_item(5,enabled)
  718.   end
  719. end
复制代码

评分

参与人数 1星屑 +120 收起 理由
咕噜 + 120 精品文章

查看全部评分

这是一个深不见底的坑,这是一个广袤无边的坑,我才刚刚放上了一抔泥土……

《六道·陈国篇》开坑了……↓点我
回复

使用道具 举报

梦石
0
星屑
50
在线时间
163 小时
注册时间
2012-3-3
回帖
36
 楼主| 发表于 2012-11-10 15:14:43 | 显示全部楼层
謝謝a364774426的提供
正式所需要的腳本
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部