查看: 2496|回复: 3

[已经解决] 请教,关于升级加点脚本,如何在开启某个变量或者开关后

[复制链接]
梦石
0
星屑
50
在线时间
41 小时
注册时间
2014-8-7
回帖
53
发表于 2014-12-27 04:45:46 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 RyanBern 于 2014-12-27 09:42 编辑

关于升级加点脚本,如何在开启某个变量或者开关后,
角色每升一级所增加的点数 在原有的基础上额外增加一点呢? 谢谢各位大大。
用的脚本是下面的这个:

  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  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. # ■ Game_Actor
  24. #------------------------------------------------------------------------------
  25. #  处理角色的类。(再定义)
  26. #==============================================================================
  27. class Game_Actor < Game_Battler
  28.   #--------------------------------------------------------------------------
  29.   # ● 更改 EXP
  30.   #     exp : 新的 EXP
  31.   #--------------------------------------------------------------------------
  32.   def exp=(exp)
  33.     @exp = [exp, 0].max
  34.     # 升级
  35.     while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
  36.       @level += 1
  37.       # 增加4点可自由分配的点数
  38.       if self.id > 30
  39.       $game_variables[self.id + LEVEL_UP_VARIABLE] += 5
  40.     else
  41.       $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
  42.       ($db_point[@actor_id])[5] += LEVEL_UP_POINT #加的1行
  43.     end
  44.       # 学会特技
  45.       for j in $data_classes[@class_id].learnings
  46.         
  47.         if j.level == @level
  48.           if @level >= 99
  49.           else
  50.           learn_skill(j.skill_id)
  51.           end
  52.         end
  53.       end
  54.     end
  55.     # 降级
  56.     while @exp < @exp_list[@level]
  57.       # 遗忘特技
  58.       for j in $data_classes[@class_id].learnings
  59.         
  60.         if j.level == @level
  61.           if @level >= 99
  62.           else
  63.           forget_skill(j.skill_id)
  64.           end
  65.         end
  66.       end
  67.       @level -= 1
  68.     end
  69.     # 修正当前的 HP 与 SP 超过最大值
  70.     @hp = [@hp, self.maxhp].min
  71.     @sp = [@sp, self.maxsp].min
  72.     $game_temp.common_event_id = 178
  73.   end
  74. end
  75. #==============================================================================
  76. # ■ Window_Base
  77. #------------------------------------------------------------------------------
  78. #  游戏中全部窗口的超级类(追加定义)
  79. #==============================================================================
  80. class Window_Base < Window
  81.   #--------------------------------------------------------------------------
  82.   # ● 描绘 HP
  83.   #     actor : 角色
  84.   #     x     : 描画目标 X 坐标
  85.   #     y     : 描画目标 Y 坐标
  86.   #     width : 描画目标的宽
  87.   #--------------------------------------------------------------------------
  88.   def draw_actor_hp_lvup(actor, x, y)
  89.     self.contents.font.color = Color.new(79,39,0,255)
  90.     if $temp_hp == 0
  91.       self.contents.font.color = Color.new(79,39,0,255)
  92.       self.contents.draw_text(x + 120 , y, 48, 32, actor.maxhp.to_s, 2)
  93.     else
  94.       maxhp = actor.maxhp + $temp_hp.to_i
  95.       self.contents.font.color = Color.new(79,39,0,255)
  96. #      self.contents.draw_text(x + 120 , y, 48, 32, maxhp.to_s ,2)
  97.       self.contents.font.color = normal_color      
  98. #      self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
  99.       if $temp_hp >=0
  100.         self.contents.font.color = Color.new(0, 255, 0)
  101.         self.contents.draw_text(x + 120 , y, 48, 32, maxhp.to_s ,2)
  102. #        self.contents.draw_text(x + 155, y, 36, 32, " +",2)
  103.       else
  104.         self.contents.font.color = Color.new(0, 255, 0)
  105.         self.contents.draw_text(x + 120 , y, 48, 32, maxhp.to_s ,2)
  106. #        self.contents.draw_text(x + 155, y, 36, 32, " -",2)
  107.       end
  108. #      self.contents.draw_text(x + 200, y, 36, 32, $temp_hp.to_s, 2)
  109.       self.contents.font.color = Color.new(79,39,0,255)
  110. #      self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
  111.     end
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 描绘 SP
  115.   #     actor : 角色
  116.   #     x     : 描画目标 X 坐标
  117.   #     y     : 描画目标 Y 坐标
  118.   #     width : 描画目标的宽
  119.   #--------------------------------------------------------------------------
  120.   def draw_actor_sp_lvup(actor, x, y)
  121.     self.contents.font.color = Color.new(79,39,0,255)
  122.     if $temp_sp == 0
  123.       self.contents.font.color = Color.new(79,39,0,255)
  124.       self.contents.draw_text(x + 120 , y, 48, 32, actor.maxsp.to_s, 2)
  125.     else
  126.       maxsp = actor.maxsp + $temp_sp.to_i
  127.       self.contents.font.color = Color.new(79,39,0,255)
  128. #      self.contents.draw_text(x + 120 , y, 48, 32, maxsp.to_s ,2)
  129.       self.contents.font.color = normal_color      
  130. #      self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
  131.       if $temp_sp >=0
  132.         self.contents.font.color = Color.new(0, 255, 0)
  133.         self.contents.draw_text(x + 120 , y, 48, 32, maxsp.to_s ,2)
  134. #        self.contents.draw_text(x + 155, y, 36, 32, " +",2)
  135.       else
  136.         self.contents.font.color = Color.new(0, 255, 0)
  137.         self.contents.draw_text(x + 120 , y, 48, 32, maxsp.to_s ,2)
  138. #        self.contents.draw_text(x + 155, y, 36, 32, " -",2)
  139.       end
  140. #      self.contents.draw_text(x + 200, y, 36, 32, $temp_sp.to_s, 2)
  141.       self.contents.font.color = Color.new(79,39,0,255)
  142. #      self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
  143.     end
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● 描绘能力值
  147.   #     actor : 角色
  148.   #     x     : 描画目标 X 坐标
  149.   #     y     : 描画目标 Y 坐标
  150.   #     type  : 能力值种类 (0~4)
  151.   #--------------------------------------------------------------------------
  152.   def draw_actor_lvup(actor, x, y, type)   
  153.     # 定义数字颜色
  154.     lvup = Color.new(79,39,0,255)   
  155.     upcolor = Color.new(0, 255, 0)
  156.     downcolor = Color.new(79,39,0,255)
  157.     self.contents.font.color = normal_color   
  158.     case type
  159.     when 0
  160.         parameter_name = $data_system.words.str
  161.         parameter_value = actor.str
  162.         parameter_value_temp = parameter_value + $temp_str.to_i
  163.       if $temp_str != 0
  164. #        lvup = upcolor
  165. #        self.contents.draw_text(x + 256, y, 16, 32, "(")
  166.         if $temp_str >= 0
  167.           lvup = upcolor
  168.           self.contents.font.color = lvup
  169.           parameter_name = $data_system.words.str
  170.           parameter_value = actor.str
  171. #          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  172.         else
  173.           lvup = downcolor
  174.           self.contents.font.color = lvup#Color.new(255,255,0,255)
  175.           parameter_name = $data_system.words.str
  176.           parameter_value = actor.str
  177. #          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  178.         end        
  179. #        self.contents.draw_text(x + 272, y, 80, 32, $temp_str.abs.to_s,1)
  180.         self.contents.font.color = Color.new(255, 0, 0)
  181. #        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  182.       end
  183.     when 1
  184.       parameter_name = $data_system.words.dex
  185.       parameter_value = actor.dex
  186.       parameter_value_temp = parameter_value + $temp_dex.to_i
  187.       if $temp_dex != 0
  188. #        lvup = upcolor
  189. #        self.contents.draw_text(x + 256, y, 16, 32, "(")
  190.         if $temp_dex >= 0
  191.           lvup = upcolor
  192.           self.contents.font.color = lvup
  193.           parameter_name = $data_system.words.dex
  194.           parameter_value = actor.dex
  195. #          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  196.         else
  197.           lvup = downcolor
  198.           self.contents.font.color = lvup#Color.new(255,255,0,255)
  199.           parameter_name = $data_system.words.dex
  200.           parameter_value = actor.dex
  201. #          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  202.         end        
  203. #        self.contents.draw_text(x + 272, y, 80, 32, $temp_dex.abs.to_s,1)
  204.         self.contents.font.color = Color.new(255, 0, 0)
  205. #        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  206.       end
  207.     when 2
  208.       parameter_name = $data_system.words.agi
  209.       parameter_value = actor.agi
  210.       parameter_value_temp = parameter_value + $temp_agi.to_i
  211.       if $temp_agi != 0
  212. #        lvup = upcolor
  213. #        self.contents.draw_text(x + 256, y, 16, 32, "(")
  214.         if $temp_agi >= 0
  215.           lvup = upcolor
  216.           self.contents.font.color = lvup
  217.           parameter_name = $data_system.words.agi
  218.           parameter_value = actor.agi
  219. #          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  220.         else
  221.           lvup = downcolor
  222.           self.contents.font.color = lvup#Color.new(255,255,0,255)
  223.           parameter_name = $data_system.words.agi
  224.           parameter_value = actor.agi
  225. #          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  226.         end        
  227. #        self.contents.draw_text(x + 272, y, 80, 32, $temp_agi.abs.to_s,1)
  228.         self.contents.font.color = Color.new(255, 0, 0)
  229. #        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  230.       end
  231.     when 3
  232.       parameter_name = $data_system.words.int
  233.       parameter_value = actor.int
  234.       parameter_value_temp = parameter_value + $temp_int.to_i
  235.       if $temp_int != 0
  236. #        lvup = upcolor
  237. #        self.contents.draw_text(x + 256, y, 16, 32, "(")
  238.         if $temp_int >= 0
  239.           lvup = upcolor
  240.           self.contents.font.color = lvup
  241.           parameter_name = $data_system.words.int
  242.           parameter_value = actor.int
  243. #          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
  244.         else
  245.           lvup = downcolor
  246.           self.contents.font.color = lvup#Color.new(255,255,0,255)
  247.           parameter_name = $data_system.words.int
  248.           parameter_value = actor.int
  249. #          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
  250.         end        
  251. #        self.contents.draw_text(x + 272, y, 80, 32, $temp_int.abs.to_s,1)
  252.         self.contents.font.color = Color.new(255, 0, 0)
  253. #        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
  254.       end
  255.     when 4
  256.       parameter_name = ""
  257.       parameter_value = $point
  258.       if $point != 0
  259.         lvup = upcolor
  260.       end
  261.     end   
  262.     self.contents.font.color = Color.new(79,39,0,255)
  263.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  264.     self.contents.font.color = Color.new(79,39,0,255)
  265.     self.contents.draw_text(x + 450, y, 36, 32, parameter_value.to_s)   
  266.     if type != 4
  267.       self.contents.draw_text(x + 480, y, 36, 32, " →")
  268.     end  
  269.     self.contents.font.color = lvup
  270.     self.contents.draw_text(x + 510, y, 60, 32, parameter_value_temp.to_s)
  271.     self.contents.font.color = Color.new(79,39,0,255)  
  272.   end
  273. end
  274. #==============================================================================
  275. # ■ Window_lvup
  276. #------------------------------------------------------------------------------
  277. #  显示升级状态窗口。
  278. #==============================================================================
  279. class Window_Lvup < Window_Base
  280.   #--------------------------------------------------------------------------
  281.   # ● 初始化对像
  282.   #     actor : 角色
  283.   #--------------------------------------------------------------------------
  284.   def initialize(actor)
  285.     super(0, 0, 712, 999)
  286.     self.contents = Bitmap.new(width - 32, height - 32)
  287.     @actor = actor
  288.     refresh
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ● 刷新
  292.   #--------------------------------------------------------------------------
  293.   def refresh
  294.     self.contents.clear
  295.     draw_actor_ap2(@actor, -15,-16)
  296.     draw_actor_class(@actor, 90,344)
  297.     draw_actor_name(@actor, 90, 327)
  298.     draw_actor_level(@actor, 90,368)
  299.     draw_actor_state1(@actor, 188, 363)   
  300.     draw_actor_hp_lvup(@actor, 302, 190)
  301.     draw_actor_sp_lvup(@actor, 302, 215)
  302.     draw_actor_lvup(@actor, -30, 253, 0)
  303.     draw_actor_lvup(@actor, -30, 278, 1)
  304.     draw_actor_lvup(@actor, -30, 301, 2)
  305.     draw_actor_lvup(@actor, -30, 325, 3)
  306.     draw_actor_lvup(@actor, 0, 350, 4)
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ● 名前の描画
  310.   #     actor : アクター
  311.   #     x     : 描画先 X 座標
  312.   #     y     : 描画先 Y 座標
  313.   #--------------------------------------------------------------------------
  314.   def draw_actor_name(actor, x, y, cx = 0, size = 16)
  315.     self.contents.font.size = 16
  316.     text = make_battler_state_text(actor, width, true)
  317.     self.contents.font.color = Color.new(79,39,0,255)
  318.     draw_text_normal(x, y, 236, 24, actor.name)
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ● クラスの描画
  322.   #     actor : アクター
  323.   #     x     : 描画先 X 座標
  324.   #     y     : 描画先 Y 座標
  325.   #--------------------------------------------------------------------------
  326.   def draw_actor_class(actor, x, y, cx = 0, size = 16)
  327.     self.contents.font.size = 16
  328.     self.contents.font.color = Color.new(79,39,0,255)
  329.     self.contents.draw_text(x, y, 236, 32, actor.class_name)
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # ● 等级描画
  333.   #     actor : アクター
  334.   #     x     : 描画先 X 座標
  335.   #     y     : 描画先 Y 座標
  336.   #--------------------------------------------------------------------------
  337.   def draw_actor_level(actor, x, y, cx = 0, size = 16)
  338.     self.contents.font.size = size
  339.     self.contents.font.italic = true
  340.     self.contents.font.color = Color.new(79,39,0,255)
  341.     draw_text_normal(x, y, 24, 24, actor.level.to_s)
  342.     self.contents.font.italic = false
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● 描绘状态
  346.   #     actor : 角色
  347.   #     x     : 描画目标 X 坐标
  348.   #     y     : 描画目标 Y 坐标
  349.   #     width : 描画目标的宽
  350.   #--------------------------------------------------------------------------
  351.   def draw_actor_state(actor, x, y, cx = 0, size = 16)
  352.     self.contents.font.size = size
  353.     self.contents.font.italic = true
  354.     text = make_battler_state_text(actor, width, true)
  355.     self.contents.font.color = Color.new(79,39,0,255)
  356.     self.contents.draw_text(x, y, width, 32, text)
  357.     self.contents.font.italic = false
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ★ 文字列(影つき:通常色・無効色あり)の描画
  361.   #--------------------------------------------------------------------------
  362.   def draw_text_custom(x, y, width, height, str, color, align = 0)
  363.     self.contents.font.size = 16
  364.     self.contents.font.color = Color.new(79,39,0,255)

  365.     self.contents.draw_text(x, y, width, height, str, align)
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ★ 文字列(影つき:通常色)の描画
  369.   #--------------------------------------------------------------------------
  370.   def draw_text_normal(x, y, width, height, str, align = 0)
  371.     self.contents.font.size = 16
  372.     self.contents.font.color = Color.new(79,39,0,255)

  373.     self.contents.draw_text(x, y, width, height, str, align)
  374.   end
  375. end
  376. #==============================================================================
  377. # ■ Scene_lvup
  378. #------------------------------------------------------------------------------
  379. #  处理升级画面的类。
  380. #==============================================================================
  381. class Scene_Lvup
  382.   #--------------------------------------------------------------------------
  383.   # ● 初始化对像
  384.   #     actor_index : 角色索引
  385.   #     menu_index : 选项起始位置
  386.   #--------------------------------------------------------------------------
  387.   def initialize(actor_index = 0 , menu_index = 0)
  388.     @actor_index = actor_index
  389.     @menu_index = menu_index
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # ● 主处理
  393.   #--------------------------------------------------------------------------
  394.   def main
  395.     @a = Sprite.new
  396.     @a.bitmap = Bitmap.new("Graphics/Pictures/菜单类/加点菜单.png")
  397.     @a.opacity=255
  398.     s1 = ""
  399.     s2 = ""
  400.     s3 = ""
  401.     s4 = ""
  402.     s5 = ""
  403.     s6 = ""
  404.     s7 = ""
  405.     @command_window = Window_Commandjd.new(128, [s1, s2, s3, s4, s5, s6, s7])
  406.     @command_window.index = @menu_index
  407.     @command_window.x = 185
  408.     @command_window.y = 94#416
  409.     # 获取角色
  410.     @actor = $game_party.actors[@actor_index]
  411.     # 将角色的剩余点数带入
  412.     $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]
  413.     # 初始化临时量
  414.     $temp_str = 0
  415.     $temp_dex = 0
  416.     $temp_agi = 0
  417.     $temp_int = 0
  418.     $temp_hp = 0
  419.     $temp_sp = 0
  420.     #=========================================================================
  421.     # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
  422.     #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
  423.     #=========================================================================
  424.     # 每提升一次力量,提升多少附加能力
  425.     #=========================================================================
  426.     @str_hp = 0     # 每提升一次力量附加提升多少HP
  427.     @str_sp = 0     # 每提升一次力量附加提升多少SP
  428.     @str_dex = 0    # 每提升一次力量附加提升多少灵巧
  429.     @str_agi = 0.1    # 每提升一次力量附加提升多少速度
  430.     @str_int = 0      # 每提升一次力量附加提升多少魔力
  431.     @str_str = 5.2    # 每提升一次力量附加提升多少力量
  432.     #=========================================================================
  433.     # 每提升一次灵巧,提升多少附加能力
  434.     #=========================================================================
  435.     @dex_hp = 15     # 每提升一次速度附加提升多少HP
  436.     @dex_sp = 0     # 每提升一次速度附加提升多少SP
  437.     @dex_str = 0    # 每提升一次速度附加提升多少力量
  438.     @dex_dex = 2.6    # 每提升一次速度附加提升多少灵巧
  439.     @dex_int = 0    # 每提升一次速度附加提升多少魔力
  440.     @dex_agi = 0    # 每提升一次速度附加提升多少速度
  441.     #=========================================================================
  442.     # 每提升一次速度,提升多少附加能力
  443.     #=========================================================================
  444.     @agi_hp = 0     # 每提升一次速度附加提升多少HP
  445.     @agi_sp = 0     # 每提升一次速度附加提升多少SP
  446.     @agi_str = 0    # 每提升一次速度附加提升多少力量
  447.     @agi_dex = 0  # 每提升一次速度附加提升多少灵巧
  448.     @agi_int = 0.1    # 每提升一次速度附加提升多少魔力
  449.     @agi_agi = 5.2    # 每提升一次速度附加提升多少速度
  450.     #=========================================================================
  451.     # 每提升一次魔力,提升多少附加能力
  452.     #=========================================================================
  453.     @int_hp = 0     # 每提升一次魔力附加提升多少HP
  454.     @int_sp = 60    # 每提升一次魔力附加提升多少SP
  455.     @int_str = 0   # 每提升一次魔力附加提升多少力量
  456.     @int_dex = 0   # 每提升一次魔力附加提升多少灵巧
  457.     @int_agi = 0   # 每提升一次魔力附加提升多少速度
  458.     @int_int = 5.2   # 每提升一次魔力附加提升多少魔力
  459.     #=========================================================================
  460.     # 每提升一次体力,提升多少附加能力
  461.     #=========================================================================
  462.     @hp = 80       # 每提升一次体力提升多少HP
  463.     @sp = 20       # 每提升一次体力提升多少SP
  464.     @hp_str = 0   # 每提升一次体力提升多少力量
  465.     @hp_dex = 0   # 每提升一次体力提升多少速度
  466.     @hp_agi = 0   # 每提升一次体力提升多少灵巧
  467.     @hp_int = 0   # 每提升一次体力提升多少魔力   
  468.     # 定义说明文字
  469.     @text_hp_sc = "体力可以增加生存的能力,可以延长生存的时间!"
  470.     @text_str_sc = $data_system.words.str + "可以增加物理攻击和物理技能的威力!"
  471.     @text_dex_sc = $data_system.words.dex + "可以提高攻击的命中率和必杀!和普通防御"
  472.     @text_agi_sc = $data_system.words.agi + "可以提高回避、命中、逃跑成功率!"
  473.     @text_int_sc = $data_system.words.int + "可以提高魔法的效果,可以增加1点魔法!和魔法防御"
  474.     @text_save = "保存分配情况并返回游戏"
  475.     @text_reset= "重新分配能力点数"
  476.     @text_2 = "每增加一次此项能力值,可以提升能力值"
  477.     @text_hp = "最大" + $data_system.words.hp + "值"
  478.     @text_sp = "最大" + $data_system.words.sp + "值"
  479.     @text_str = "最大" + $data_system.words.str + "值"
  480.     @text_dex = "最大" + $data_system.words.dex + "值"
  481.     @text_agi = "最大" + $data_system.words.agi + "值"
  482.     @text_int = "最大" + $data_system.words.int + "值"
  483.     s_disable
  484.     # 生成状态窗口
  485.     @lvup_window = Window_Lvup.new(@actor)
  486.     @lvup_window.x = 0
  487.     @lvup_window.y = 0     
  488.     # 执行过渡
  489.     Graphics.transition
  490.     # 主循环
  491.     loop do
  492.       # 刷新游戏画面
  493.       Graphics.update
  494.       # 刷新输入信息
  495.       Input.update
  496.       # 刷新画面
  497.       update
  498.       # 如果切换画面就中断循环
  499.       if $scene != self
  500.         break
  501.       end
  502.     end
  503.     # 准备过渡
  504.     Graphics.freeze
  505.     # 释放窗口
  506.     @command_window.dispose
  507.     @lvup_window.dispose
  508.     @a.dispose
  509.     @系统菜单.dispose
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # ● 刷新画面
  513.   #--------------------------------------------------------------------------
  514.   def update
  515.    
  516.    
  517. lcy = []
  518. m = 0
  519. for i in 0...$game_party.actors.size
  520. actor = $game_party.actors[i]
  521. if actor.id <= 22
  522. lcy[m] = i
  523. m += 1
  524. end
  525. end

  526.    
  527.     # 刷新窗口
  528.     @command_window.update
  529.     # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
  530.     s_disable
  531.     @lvup_window.update
  532.     #=============================================================
  533.     # 按下 B 键的情况下
  534.     #=============================================================
  535.     if Input.trigger?(Input::B)
  536.         for i in 0..4 #加的3行
  537.           ($db_point[@actor.id])[i] = ($db_point_old[@actor.id])[i]
  538.         end
  539.         for i in 0..4 #加的3行
  540.           ($db_point_old[@actor.id])[i] = ($db_point[@actor.id])[i]
  541.         end
  542.       # 演奏取消 SE
  543.       $game_system.se_play($data_system.cancel_se)
  544.       # 切换到地图画面
  545.       $scene = Scene_Atactor1.new
  546.       return
  547.     end
  548.     #=============================================================
  549.     # 按下 C 键的情况下
  550.     #=============================================================
  551.     if Input.trigger?(Input::C)      
  552.       if @command_window.index == 6
  553.         for i in 0..4 #加的3行
  554.           ($db_point_old[@actor.id])[i] = ($db_point[@actor.id])[i]
  555.         end
  556.         for i in 0..4 #加的3行
  557.           ($db_point[@actor.id])[i] = ($db_point_old[@actor.id])[i]
  558.         end
  559.           # 演奏确定 SE
  560.         $game_system.se_play($data_system.decision_se)
  561.         # 将角色的剩余点数带回
  562.         $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
  563.         # 将角色点数实际加上
  564.         @actor.str += $temp_str
  565.         @actor.dex += $temp_dex
  566.         @actor.agi += $temp_agi
  567.         @actor.int += $temp_int
  568.         @actor.maxhp += $temp_hp
  569.         @actor.maxsp += $temp_sp
  570.         
  571.         # 演奏光标 SE
  572.         $game_system.se_play($data_system.cursor_se)
  573.         # 移至下一位角色
  574.         @actor_index += 1
  575.         @actor_index %= lcy.size#$game_party.actors.size
  576. #        p lcy.size
  577.         # 切换到别的状态画面
  578.         $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  579. #        $scene = Scene_Menu.new(0)
  580.         
  581.         return
  582.       end
  583.       if @command_window.index == 5
  584.         for i in 0..4 #加的3行
  585.           ($db_point[@actor.id])[i] = ($db_point_old[@actor.id])[i]
  586.         end
  587.         for i in 0..4 #加的3行
  588.           ($db_point_old[@actor.id])[i] = ($db_point[@actor.id])[i]
  589.         end
  590.           # 演奏确定 SE
  591.         $game_system.se_play($data_system.cancel_se)
  592.           # 将角色的剩余点数带入
  593.         $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
  594.           # 初始化临时量
  595.         $temp_str = 0
  596.         $temp_dex = 0
  597.         $temp_agi = 0
  598.         $temp_int = 0
  599.         $temp_hp = 0
  600.         $temp_sp = 0
  601.         @lvup_window.refresh
  602.         return
  603.       end
  604.       if $point == 0
  605.         # 演奏冻结 SE
  606.         $game_system.se_play($data_system.buzzer_se)
  607.         return
  608.       end
  609.       case @command_window.index
  610.       when 0
  611.         if !($db_point_enable[@actor.id])[0] #加的判断
  612.           # 演奏冻结 SE
  613.           $game_system.se_play($data_system.buzzer_se)
  614.           return
  615.         else
  616.         # 演奏确定 SE
  617.         $game_system.se_play($data_system.decision_se)
  618.         $temp_hp += @hp
  619.         $temp_sp += @sp
  620.         $temp_str += @hp_str
  621.         $temp_dex += @hp_dex
  622.         $temp_agi += @hp_agi
  623.         $temp_int += @hp_int
  624.         $point -= 1
  625.         @lvup_window.refresh
  626.         ($db_point[@actor.id])[0] += 1
  627.         s_disable
  628.         return
  629.       end
  630.       when 1
  631.         if !($db_point_enable[@actor.id])[1]#加的判断
  632.           # 演奏冻结 SE
  633.           $game_system.se_play($data_system.buzzer_se)
  634.           return
  635.         else
  636.         # 演奏确定 SE
  637.         $game_system.se_play($data_system.decision_se)
  638.         $temp_str += @str_str
  639.         $temp_hp += @str_hp
  640.         $temp_sp += @str_sp
  641.         $temp_dex += @str_dex
  642.         $temp_agi += @str_agi
  643.         $temp_int += @str_int
  644.         $point -= 1
  645.         @lvup_window.refresh
  646.         ($db_point[@actor.id])[1] += 1
  647.         s_disable
  648.         return
  649.       end
  650.       when 2
  651.         if !($db_point_enable[@actor.id])[2]#加的判断
  652.           # 演奏冻结 SE
  653.           $game_system.se_play($data_system.buzzer_se)
  654.           return
  655.         else
  656.         # 演奏确定 SE
  657.         $game_system.se_play($data_system.decision_se)
  658.         $temp_dex += @dex_dex
  659.         $temp_hp += @dex_hp
  660.         $temp_sp += @dex_sp
  661.         $temp_str += @dex_str
  662.         $temp_agi += @dex_agi
  663.         $temp_int += @dex_int
  664.         $point -= 1
  665.         @lvup_window.refresh
  666.         ($db_point[@actor.id])[2] += 1
  667.         s_disable
  668.         return
  669.       end
  670.       when 3
  671.         if !($db_point_enable[@actor.id])[3]#加的判断
  672.           # 演奏冻结 SE
  673.           $game_system.se_play($data_system.buzzer_se)
  674.           return
  675.         else
  676.         # 演奏确定 SE
  677.         $game_system.se_play($data_system.decision_se)
  678.         $temp_agi += @agi_agi
  679.         $temp_hp += @agi_hp
  680.         $temp_sp += @agi_sp
  681.         $temp_str += @agi_str
  682.         $temp_dex += @agi_dex
  683.         $temp_int += @agi_int
  684.         $point -= 1
  685.         @lvup_window.refresh
  686.         ($db_point[@actor.id])[3] += 1
  687.         s_disable
  688.         return
  689.       end
  690.       when 4
  691.         if !($db_point_enable[@actor.id])[4]#加的判断
  692.           # 演奏冻结 SE
  693.           $game_system.se_play($data_system.buzzer_se)
  694.           return
  695.         else
  696.         # 演奏确定 SE
  697.         $game_system.se_play($data_system.decision_se)
  698.         $temp_int += @int_int
  699.         $temp_hp += @int_hp
  700.         $temp_sp += @int_sp
  701.         $temp_str += @int_str
  702.         $temp_dex += @int_dex
  703.         $temp_agi += @int_agi
  704.         $point -= 1
  705.         @lvup_window.refresh
  706.         ($db_point[@actor.id])[4] += 1
  707.         s_disable
  708.         return
  709.       end
  710.     end
  711.   end
  712.     #=============================================================
  713.     # 什么都没有按下的情况
  714.     #=============================================================
  715.     case @command_window.index   
  716.     when 0  # 增加体力
  717.       temptext1 = @text_hp + @hp.to_s + "点   " + @text_str + @hp_str.to_s + "点   " + @text_dex + @hp_dex.to_s + "点"
  718.       temptext2 = @text_sp + @sp.to_s + "点   " + @text_agi + @hp_agi.to_s + "点   " + @text_int + @hp_int.to_s + "点"

  719.     when 1  # 增加力量
  720.       temptext1 = @text_hp + @str_hp.to_s + "点   " + @text_str + @str_str.to_s + "点   " + @text_dex + @str_dex.to_s + "点"
  721.       temptext2 = @text_sp + @str_sp.to_s + "点   " + @text_agi + @str_agi.to_s + "点   " + @text_int + @str_int.to_s + "点"

  722.     when 2  # 增加灵巧
  723.       temptext1 = @text_hp + @dex_hp.to_s + "点   " + @text_str + @dex_agi.to_s + "点   " + @text_dex + @dex_dex.to_s + "点"
  724.       temptext2 = @text_sp + @dex_sp.to_s + "点   " + @text_agi + @dex_agi.to_s + "点   " + @text_int + @dex_int.to_s + "点"

  725.     when 3  # 增加速度
  726.       temptext1 = @text_hp + @agi_hp.to_s + "点   " + @text_str + @agi_str.to_s + "点   " + @text_dex + @agi_dex.to_s + "点"
  727.       temptext2 = @text_sp + @agi_sp.to_s + "点   " + @text_agi + @agi_agi.to_s + "点   " + @text_int + @agi_int.to_s + "点"

  728.     when 4  # 增加魔力
  729.       temptext1 = @text_hp + @int_hp.to_s + "点   " + @text_str + @int_str.to_s + "点   " + @text_dex + @int_dex.to_s + "点"
  730.       temptext2 = @text_sp + @int_sp.to_s + "点   " + @text_agi + @int_agi.to_s + "点   " + @text_int + @int_int.to_s + "点"

  731.     when 6 # 保存设定
  732. #      @help_window.lvup_text(@text_save)
  733.     when 5 # 点数重置
  734. #      @help_window.lvup_text(@text_reset)     
  735.    
  736.   end

  737.     #=============================================================
  738.     # 按下R与L换人的情况
  739.     #=============================================================      
  740.     if Input.trigger?(Input::R)
  741.       # 演奏光标 SE
  742.       $game_system.se_play($data_system.cursor_se)
  743.       # 移至下一位角色
  744.       @actor_index += 1
  745.       @actor_index %= lcy.size#$game_party.actors.size
  746.       # 切换到别的状态画面
  747.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  748.       return
  749.     end
  750.     # 按下 L 键的情况下
  751.     if Input.trigger?(Input::L)
  752.       # 演奏光标 SE
  753.       $game_system.se_play($data_system.cursor_se)
  754.       # 移至上一位角色
  755.       @actor_index += lcy.size - 1#$game_party.actors.size - 1
  756.       @actor_index %= lcy.size#$game_party.actors.size
  757.       # 切换到别的状态画面
  758.       $scene = Scene_Lvup.new(@actor_index , @command_window.index)
  759.       return
  760.     end

  761.   end  
  762.   #--------------------------------------------------------------------------
  763.   # ● 选项明暗判断
  764.   #--------------------------------------------------------------------------
  765.   def s_disable
  766.     # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
  767.     if $point == 0
  768.       @command_window.contents.font.color = Color.new(255, 255, 255, 128)
  769.       @command_window.disable_item(0)
  770.       @command_window.disable_item(1)
  771.       @command_window.disable_item(2)
  772.       @command_window.disable_item(3)
  773.       @command_window.disable_item(4)
  774.     else
  775.       @command_window.contents.font.color = Color.new(255, 255, 255, 255)
  776.       @command_window.able_item(0)
  777.       @command_window.able_item(1)      
  778.       @command_window.able_item(2)
  779.       @command_window.able_item(3)
  780.       @command_window.able_item(4)
  781.       for i in 0 ..4 #加的判断
  782.         if !($db_point_enable[@actor.id])[i] = ($db_point[@actor.id])[i] < (($db_point[@actor.id])[5] / 2)
  783.           @command_window.contents.font.color = Color.new(255, 255, 255, 128)
  784.           @command_window.disable_item(i)         
  785.         end
  786.       end
  787.     end
  788.   end
  789. end
复制代码

评分

参与人数 1星屑 +35 收起 理由
︶ㄣ牛排ぶ + 35 手动认可奖励

查看全部评分

梦石
0
星屑
9557
在线时间
5074 小时
注册时间
2013-6-21
回帖
3459

开拓者贵宾剧作品鉴家

发表于 2014-12-27 09:58:18 | 显示全部楼层
本帖最后由 RyanBern 于 2014-12-27 19:10 编辑

脚本好像是经过了一些修改,想实现这一效果并不难,脚本的48行那里:
  1. if self.id > 30
  2.   $game_variables[self.id + LEVEL_UP_VARIABLE] += 5
  3. else
  4.   $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
  5.   ($db_point[@actor_id])[5] += LEVEL_UP_POINT #加的1行
  6. end
复制代码

这里的意思是说,如果角色id大于30,那么升1级就加5点,否则就增加LEVEL_UP_POINT(这里的设定是4),下面那个$db_point没来及看是什么意思,不过为了保持一致性就一起改好了。
例如,打开开关1,角色(id在30以下)升一级获得额外2点(2+4=6)
  1. if self.id > 30
  2.   $game_variables[self.id + LEVEL_UP_VARIABLE] += 5
  3. else
  4.   ##修改
  5.   # 打开开关1,id为3的角色额外获得2点,打开开关2,id为4的角色额外获得2点,以此类推
  6.   extra_point = $game_switches[self.id - 2] ? 2 : 0
  7.   $game_variables[self.id + LEVEL_UP_VARIABLE] += (LEVEL_UP_POINT + extra_point)
  8.   ($db_point[@actor_id])[5] += (LEVEL_UP_POINT + extra_point)#加的1行
  9. end
复制代码

点评

啊啊。可以了,非常感谢大人您。么么哒 谢谢您了跪谢  发表于 2014-12-27 20:32

评分

参与人数 1星屑 +200 收起 理由
︶ㄣ牛排ぶ + 200 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
41 小时
注册时间
2014-8-7
回帖
53
 楼主| 发表于 2014-12-27 16:37:22 | 显示全部楼层
RyanBern 发表于 2014-12-27 09:58
脚本好像是经过了一些修改,想实现这一效果并不难,脚本的48行那里:
if self.id > 30
  $game_variables[s ...

谢谢大大,那个不好意思,还想请问一下。。如果是 开关1打开 角色3 升级额外多一点,其他角色升级点数不变,开关2打开角色4额外多一点,以此类推,这种这么做呢? 不好意思谢谢您

点评

2L已经编辑,再去试试看行不行  发表于 2014-12-27 19:10
回复

使用道具 举报

梦石
0
星屑
9292
在线时间
2504 小时
注册时间
2011-5-20
回帖
14521

开拓者

发表于 2014-12-27 19:16:08 | 显示全部楼层
把 if self.id > 30下面的一部分脚本换成

  1.     if self.id > 30
  2.       $game_variables[self.id + LEVEL_UP_VARIABLE] += 5
  3.     else
  4.       $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
  5.       ($db_point[@actor_id])[5] += LEVEL_UP_POINT #加的1行
  6.       ($db_point[@actor_id])[5] += 1 if $game_switches[1]#1号开关打开
  7.     end
  8.     $game_variables[self.id + LEVEL_UP_VARIABLE] += 1 if $game_switches[1]#1号开关打开
复制代码

点评

谢谢大  发表于 2014-12-27 20:32
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部