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

Project1

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

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
41 小时
注册时间
2014-8-7
帖子
67
跳转到指定楼层
1
发表于 2014-12-27 04:45:46 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

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

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

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

评分

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

查看全部评分

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

4
发表于 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
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
41 小时
注册时间
2014-8-7
帖子
67
3
 楼主| 发表于 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
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

梦石
0
星屑
9532
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

2
发表于 2014-12-27 09:58:18 | 只看该作者
本帖最后由 RyanBern 于 2014-12-27 19:10 编辑

脚本好像是经过了一些修改,想实现这一效果并不难,脚本的48行那里:
RUBY 代码复制
  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)
RUBY 代码复制
  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 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 17:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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