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

Project1

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

[原创发布] 【10月17日更新】技能扩展分类(非全原创)

[复制链接]

Lv2.观梦者

梦石
0
星屑
867
在线时间
194 小时
注册时间
2019-4-11
帖子
56
跳转到指定楼层
1
发表于 2023-2-26 00:58:46 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 sxjkjly8010 于 2023-10-17 20:06 编辑

2月28日更新:
1.修复了一点显示bug
3月18日更新:
1.修复了一点显示bug
10月17日更新:
1.修复了一点显示bug

心血来潮把这个自己用奈々改的脚本改造又改成默认战斗系统可用发布了
给一些想要和我同样效果的RM作者一些帮助

默认战斗系统效果:


可以实现的效果大概这种感觉:




演示图里的箭头效果不在脚本里
想要实现的可以在def draw_skill_cost(rect, skill)前面插入下列代码
RUBY 代码复制
  1. if skill.changetoskills != []
  2.       change_color(normal_color, enable?(skill))
  3.       rect.x -= 10
  4.       rect.y -= 1
  5.       draw_text(rect, "▶", 2)
  6.       rect.x += 10
  7.       rect.y += 1
  8.       draw_text(rect, ">", 2)
  9.       return
  10.     end


也可以放一个这样的脚本在最后
RUBY 代码复制
  1. class Window_SkillList < Window_Selectable
  2.   alias changeto_draw_skill_cost draw_skill_cost
  3.   def draw_skill_cost(rect, skill)
  4.     if skill.changetoskills != []
  5.      change_color(normal_color, enable?(skill))
  6.       rect.x -= 10
  7.       rect.y -= 1
  8.       draw_text(rect, "▶", 2)
  9.       rect.x += 10
  10.       rect.y += 1
  11.       draw_text(rect, ">", 2)
  12.       return
  13.     end
  14.     changeto_draw_skill_cost(rect, skill)
  15.   end
  16. end


改造成默认战斗系统的同时多加了内容,LEARN_SWITCH默认是开启的
可以实现后续习得技能加入到扩展技能里,请注意习得的技能分类设为无

脚本:
RUBY 代码复制
  1. #==============================================================================
  2. #                                 扩展技能分类
  3. #   改造作者:Akahara
  4. #   参考代码原作者:奈々(なな)
  5. #   个人网址 [url]http://heptanas.mamagoto.com/[/url]
  6. #   使用部分代码作者:ももまる
  7. #   个人网址 [url]http://peachround.com/[/url]
  8. #
  9. #   ◇使用規約
  10. #   使用される場合はスクリプト作成者として「奈々」を明記して下さい。
  11. #   このスクリプトを改変したり、改変したものを配布するなどは自由ですが
  12. #   その場合も元のスクリプトの作成者として名前は載せて下さい。
  13. #
  14. #------------------------------------------------------------------------------
  15. #
  16. #   在技能备注 <扩展分类 ID> (可以有多个)
  17. #   可以让有该备注的技能选择后不是使用技能而是出现小窗口的多个技能
  18. #   
  19. #   拥有该备注的技能不会有任何效果,建议不要拥有技能消耗和效果
  20. #  (没试过也忘了有了会怎样)
  21. #
  22. #==============================================================================
  23.  
  24. #感谢并使用了ももまる的LNX11XP战斗的代码
  25. #已经有装LNX11XP战斗的请把27行(module LNX11_Window_FittingEXSkillList)
  26. #到47行(最靠左的end)注释掉防止冲突
  27. module LNX11_Window_FittingEXSkillList
  28.   #--------------------------------------------------------------------------
  29.   # ● [オーバーライド]:リフレッシュ
  30.   #--------------------------------------------------------------------------
  31.   def refresh
  32.     make_item_list
  33.     self.height = fitting_height(row_max)
  34.     super
  35.     self.oy = 0
  36.   end
  37. end
  38.  
  39. module AKAHARA
  40.   module CHANGETOSKILL
  41.     LEARN_SWITCH = true
  42.     #开启此开关(true)后,扩展的技能需要习得才会显示在窗口里
  43.     #如果开启,扩展的技能的分类建议选为无,并在习得扩展技能的时候一起习得
  44.     #关闭此开关(false)后,扩展的技能无需习得就会显示在窗口里
  45.   end
  46. end
  47.  
  48. class RPG::Skill < RPG::UsableItem
  49.   #--------------------------------------------------------------------------
  50.   # ● 変化先スキルの定義(追加定義)
  51.   #--------------------------------------------------------------------------  
  52.   def changetoskills
  53.     list = []
  54.     @note.scan(/<扩展分类\s?(\d*)>/) {|s|
  55.       list.push($data_skills[$1.to_i]) if $1
  56.     }
  57.     return list
  58.   end
  59. end
  60.  
  61. class Window_SkillList < Window_Selectable
  62.   def data_num
  63.     @data
  64.   end
  65. end
  66.  
  67. #==============================================================================
  68. # ■ Scene_Battle
  69. #------------------------------------------------------------------------------
  70. #  バトル画面の処理を行うクラスです。
  71. #==============================================================================
  72.  
  73. class Scene_Battle < Scene_Base
  74.   alias start3 start
  75.   def start
  76.     start3
  77.     @change = false
  78.     @last_skill2 = nil
  79.   end  
  80.   #--------------------------------------------------------------------------
  81.   # ● 全ウィンドウの作成
  82.   #--------------------------------------------------------------------------
  83.   alias create_all_windows2 create_all_windows
  84.   def create_all_windows
  85.     create_all_windows2
  86.     create_changetoskill_window
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 変化先スキルウィンドウの作成
  90.   #--------------------------------------------------------------------------
  91.   def create_changetoskill_window
  92.     @changetoskill_window = Window_BattleChangetoSkill.new(@help_window, @info_viewport)
  93.     @changetoskill_window.set_handler(:ok,     method(:on_changetoskill_ok))
  94.     @changetoskill_window.set_handler(:cancel, method(:on_changetoskill_cancel))
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● スキル[決定]
  98.   #--------------------------------------------------------------------------
  99.   def on_skill_ok
  100.     @change = false
  101.     @skill = @skill_window.item
  102.     @last_skill2 = @skill
  103.     if @skill.changetoskills != []
  104.       @skill_window.deactivate
  105.       @skill_window.visible = true
  106.       @change = true
  107.       wx = Graphics.width/2 + (@skill_window.index % 2 == 0 ? 0 : -Graphics.width / 2.3)
  108.       @changetoskill_window.x = wx
  109.       wy = (@skill_window.cursor_rect.y-@skill_window.oy) + 50
  110.       @changetoskill_window.y = wy
  111.       if (@changetoskill_window.y+@changetoskill_window.height) >= Graphics.height
  112.         @changetoskill_window.height = Graphics.height-@changetoskill_window.y
  113.       end      
  114.       @changetoskill_window.y = @skill_window.y + wy      
  115.       @changetoskill_window.actor = BattleManager.actor
  116.       @changetoskill_window.changetoskills = @skill.changetoskills
  117.       @changetoskill_window.show.activate
  118.       return
  119.     end
  120.     BattleManager.actor.input.set_skill(@skill.id)
  121.     BattleManager.actor.last_skill.object = @skill
  122.     if !@skill.need_selection?
  123.       @skill_window.refresh
  124.       @skill_window.hide
  125.       next_command
  126.     elsif @skill.for_opponent?
  127.       select_enemy_selection
  128.     else
  129.       select_actor_selection
  130.     end   
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ● 変化先スキル[決定]
  134.   #--------------------------------------------------------------------------
  135.   def on_changetoskill_ok
  136.     @help_window.visible = false
  137.     @changetoskill_window.visible = false
  138.     @skill_window.visible = false
  139.     @changetoskill = @changetoskill_window.item
  140.     BattleManager.actor.input.set_skill(@changetoskill.id)
  141.     BattleManager.actor.last_skill.object = @changetoskill
  142.     if !@changetoskill.need_selection?
  143.       @skill_window.refresh
  144.       @skill_window.hide
  145.       @changetoskill_window.hide
  146.       next_command
  147.     elsif @changetoskill.for_opponent?
  148.       select_enemy_selection
  149.     else
  150.       select_actor_selection
  151.     end
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● 変化先スキル[キャンセル]
  155.   #--------------------------------------------------------------------------
  156.   def on_changetoskill_cancel
  157.     @changetoskill_window.hide
  158.     @skill_window.show.activate.select(@skill_window.data_num.index(@last_skill2) || 0)
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● アクター[決定]
  162.   #--------------------------------------------------------------------------
  163.   alias changetoskill_on_actor_ok on_actor_ok
  164.   def on_actor_ok
  165.     @changetoskill_window.hide
  166.     changetoskill_on_actor_ok
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● アクター[キャンセル]
  170.   #--------------------------------------------------------------------------
  171.   alias changetoskill_on_actor_cancel on_actor_cancel
  172.   def on_actor_cancel
  173.     changetoskill_on_actor_cancel
  174.     case @actor_command_window.current_symbol
  175.     when :skill
  176.       if @change == true
  177.         @changetoskill_window.show.activate.select_last
  178.         @skill_window.show.deactivate.select(@skill_window.data_num.index(@last_skill2) || 0)
  179.         @help_window.visible = true
  180.         @skill_window.visible = true
  181.       else
  182.         @changetoskill_window.hide
  183.         @skill_window.hide
  184.       end
  185.     end
  186.   end  
  187.   #--------------------------------------------------------------------------
  188.   # ● 敵キャラ[決定]
  189.   #--------------------------------------------------------------------------
  190.   alias changetoskill_on_enemy_ok on_enemy_ok
  191.   def on_enemy_ok
  192.     @changetoskill_window.hide
  193.     changetoskill_on_enemy_ok
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ● 敵キャラ[キャンセル]
  197.   #--------------------------------------------------------------------------
  198.   alias changetoskill_on_enemy_cancel on_enemy_cancel
  199.   def on_enemy_cancel
  200.     changetoskill_on_enemy_cancel
  201.     case @actor_command_window.current_symbol
  202.     when :skill
  203.       if @change == true
  204.         @changetoskill_window.show.activate.select_last
  205.         @skill_window.show.deactivate.select(@skill_window.data_num.index(@last_skill2) || 0)
  206.         @help_window.visible = true
  207.         @skill_window.visible = true
  208.       else
  209.         @changetoskill_window.hide
  210.         @skill_window.hide
  211.       end
  212.     end
  213.   end  
  214. end
  215. #==============================================================================
  216. # ■ Window_Battlechangetoskill
  217. #------------------------------------------------------------------------------
  218. #  バトル画面で、使用する変化先スキルを選択するウィンドウです。
  219. #==============================================================================
  220.  
  221. class Window_BattleChangetoSkill < Window_SkillList
  222.   include LNX11_Window_FittingEXSkillList
  223.   include AKAHARA::CHANGETOSKILL
  224.   #--------------------------------------------------------------------------
  225.   # ● オブジェクト初期化
  226.   #     info_viewport : 情報表示用ビューポート
  227.   #--------------------------------------------------------------------------
  228.   def initialize(help_window, info_viewport)
  229.     y = help_window.height
  230.     super(0, y, Graphics.width / 2.3, info_viewport.rect.y - y)
  231.     self.visible = false
  232.     self.windowskin = Cache.system("window")
  233.     @help_window = help_window
  234.     @info_viewport = info_viewport
  235.     @changetoskills = nil
  236.   end
  237.   def col_max
  238.     return 1
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● 変化先スキルの設定
  242.   #--------------------------------------------------------------------------
  243.   def changetoskills=(changetoskills)
  244.     return if @changetoskills == changetoskills
  245.     @changetoskills = changetoskills
  246.     refresh
  247.     self.oy = 0
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ● スキルリストの作成
  251.   #--------------------------------------------------------------------------
  252.   def make_item_list
  253.     if @changetoskills
  254.       if LEARN_SWITCH
  255.         @changetoskills1 = @changetoskills.clone
  256.         @changetoskills.each {|i| @changetoskills1.delete(i) if !@actor.skill_learn?(i)}
  257.         @data = @changetoskills1
  258.       else
  259.         @data = @changetoskills
  260.       end
  261.     else
  262.       @data = []
  263.     end
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # ● ウィンドウの表示
  267.   #--------------------------------------------------------------------------
  268.   def show
  269.     select(0)
  270.     @help_window.show
  271.     super
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # ● ウィンドウの非表示
  275.   #--------------------------------------------------------------------------
  276.   def hide
  277.     @help_window.hide
  278.     super
  279.   end
  280. end
  281.  
  282. #==============================================================================
  283. # ■ Scene_Skill
  284. #------------------------------------------------------------------------------
  285. #  スキル画面の処理を行うクラスです。処理共通化の便宜上、スキルも「アイテム」
  286. # として扱っています。
  287. #==============================================================================
  288.  
  289. class Scene_Skill < Scene_ItemBase
  290.   #--------------------------------------------------------------------------
  291.   # ● 開始処理
  292.   #--------------------------------------------------------------------------
  293.   alias start2 start
  294.   def start
  295.     start2
  296.     create_changetoitem_window
  297.     @change = false
  298.     @last_skill2 = nil
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ● 変化先アイテムウィンドウの作成
  302.   #--------------------------------------------------------------------------
  303.   def create_changetoitem_window
  304.     wx = 0
  305.     wy = @status_window.y + @status_window.height
  306.     ww = Graphics.width / 2.3
  307.     wh = Graphics.height - wy
  308.     @changetoitem_window = Window_ChangetoSkillList.new(wx, wy, ww, wh)
  309.     @changetoitem_window.actor = @actor
  310.     @changetoitem_window.viewport = @viewport
  311.     @changetoitem_window.help_window = @help_window
  312.     @changetoitem_window.set_handler(:ok,     method(:on_changetoitem_ok))
  313.     @changetoitem_window.set_handler(:cancel, method(:on_changetoitem_cancel))
  314.     @changetoitem_window.hide
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● 現在選択されているアイテムの取得
  318.   #--------------------------------------------------------------------------
  319.   def item
  320.     @change ? @changetoitem_window.item : @item_window.item
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● カーソルが左列にあるかの判定
  324.   #--------------------------------------------------------------------------
  325.   def cursor_left?
  326.     @change ? @changetoitem_window.index % 2 == 0 : @item_window.index % 2 == 0
  327.   end
  328.   #--------------------------------------------------------------------------
  329.   # ● アイテム[決定]
  330.   #--------------------------------------------------------------------------
  331.   def on_item_ok
  332.     @change = false
  333.     @last_skill2 = item
  334.     if item.changetoskills != []
  335.       @item_window.deactivate
  336.       wx = Graphics.width/2 + (@item_window.index % 2 == 0 ? 0 : -Graphics.width / 2.3)
  337.       @changetoitem_window.x = wx      
  338.       wy = (@item_window.cursor_rect.y-@item_window.oy) + 50
  339.       @changetoitem_window.y = wy
  340.       if (@changetoitem_window.y+@changetoitem_window.height) >= Graphics.height
  341.         @changetoitem_window.height = Graphics.height-@changetoitem_window.y
  342.       end      
  343.       @changetoitem_window.changetoskills = item.changetoskills
  344.       @changetoitem_window.select(0)
  345.       @change = true
  346.       @changetoitem_window.show.activate
  347.       return
  348.     end
  349.     @actor.last_skill.object = item
  350.     determine_item
  351.   end
  352.   #--------------------------------------------------------------------------
  353.   # ● 変化先アイテム[決定]
  354.   #--------------------------------------------------------------------------
  355.   def on_changetoitem_ok
  356.     @actor.last_skill.object = item
  357.     determine_item
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● 変化先アイテム[キャンセル]
  361.   #--------------------------------------------------------------------------
  362.   def on_changetoitem_cancel
  363.     @changetoitem_window.hide
  364.     @item_window.show.activate.select(@item_window.data_num.index(@last_skill2) || 0)
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ● アクター[キャンセル]
  368.   #--------------------------------------------------------------------------
  369.   def on_actor_cancel
  370.     hide_sub_window(@actor_window)
  371.     if @change == true
  372.       @changetoitem_window.show.activate.select_last
  373.       @item_window.show.deactivate   
  374.     else
  375.       @changetoitem_window.hide
  376.       @item_window.show.activate
  377.     end
  378.   end
  379. end
  380. #==============================================================================
  381. # ■ Window_ChangetoSkillList
  382. #------------------------------------------------------------------------------
  383. #  スキル画面で、使用できるスキルの一覧を表示するウィンドウです。
  384. #==============================================================================
  385.  
  386. class Window_ChangetoSkillList < Window_SkillList
  387.   include LNX11_Window_FittingEXSkillList
  388.   include AKAHARA::CHANGETOSKILL
  389.   #--------------------------------------------------------------------------
  390.   # ● オブジェクト初期化
  391.   #--------------------------------------------------------------------------
  392.   def initialize(x, y, width, height)
  393.     super
  394.     self.windowskin = Cache.system("window")   
  395.     @actor = nil
  396.     @stype_id = 0
  397.     @data = []
  398.     @changetoskills = nil
  399.   end
  400.   def col_max
  401.     return 1
  402.   end  
  403.   #--------------------------------------------------------------------------
  404.   # ● 変化先スキルの設定
  405.   #--------------------------------------------------------------------------
  406.   def changetoskills=(changetoskills)
  407.     return if @changetoskills == changetoskills
  408.     @changetoskills = changetoskills
  409.     refresh
  410.     self.oy = 0
  411.   end
  412.   #--------------------------------------------------------------------------
  413.   # ● スキルリストの作成
  414.   #--------------------------------------------------------------------------
  415.   def make_item_list
  416.     if @changetoskills
  417.       if LEARN_SWITCH
  418.         @changetoskills1 = @changetoskills.clone
  419.         @changetoskills.each {|i| @changetoskills1.delete(i) if !@actor.skill_learn?(i)}
  420.         @data = @changetoskills1
  421.       else
  422.         @data = @changetoskills
  423.       end
  424.     else
  425.       @data = []
  426.     end
  427.   end
  428. end
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-4-20 12:09

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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