查看: 64|回复: 0

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

[复制链接]
  • TA的每日心情
    开心
    前天 00:56
  • 签到天数: 33 天

    连续签到: 1 天

    [LV.5]常住居民I

    2022

    主题

    32

    回帖

    7144

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

                 本帖来自P1论坛作者sxjkjly8010,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=492553  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
    天天去同能,天天有童年!
    回复 论坛版权

    使用道具 举报

    ahome_bigavatar:guest
    ahome_bigavatar:welcomelogin
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2024-4-30 11:50 , Processed in 0.050746 second(s), 42 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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