Advertisement
Double_X

DoubleX RMVXA Targeting Hotkeys Compatibility v1.00a

May 22nd, 2015 (edited)
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 11.66 KB | None | 0 0
  1. #==============================================================================|
  2. #  ** Script Info                                                              |
  3. #------------------------------------------------------------------------------|
  4. #  * Script Name                                                               |
  5. #    DoubleX RMVXA Targeting Hotkeys Compatibility                             |
  6. #------------------------------------------------------------------------------|
  7. #  * Functions                                                                 |
  8. #    Fixes compatibility issues in DoubleX RMVXA Targeting Hotkeys             |
  9. #    Scripts Addressed:                                                        |
  10. #    1. Yanfly Engine Ace - Ace Battle Engine                                  |
  11. #    2. YSA Battle System: Classical ATB                                       |
  12. #    3. DoubleX RMVXA Bug Fix to YSA Battle System: Classical ATB              |
  13. #    4. DoubleX RMVXA Compatibility Fix to YSA Battle System: Classical ATB    |
  14. #    5. DoubleX RMVXA Action Addon to YSA Battle System: Classical ATB         |
  15. #    6. DoubleX RMVXA Cooldown Addon to YSA Battle System: Classical ATB       |
  16. #    7. DoubleX RMVXA Charge Addon to YSA Battle System: Classical ATB         |
  17. #    8. DoubleX RMVXA Unison Addon to YSA Battle System: Classical ATB         |
  18. #    9. DoubleX RMVXA Enhanced YSA Battle System: Classical ATB                |
  19. #------------------------------------------------------------------------------|
  20. #  * Terms Of Use                                                              |
  21. #    You shall keep this script's Script Info part's contents intact           |
  22. #    You shalln't claim that this script is written by anyone other than       |
  23. #    DoubleX or his aliases                                                    |
  24. #    None of the above applies to DoubleX or his aliases                       |
  25. #------------------------------------------------------------------------------|
  26. #  * Prerequisites                                                             |
  27. #    Scripts:                                                                  |
  28. #    1. DoubleX RMVXA Targeting Hotkeys                                        |
  29. #------------------------------------------------------------------------------|
  30. #  * Instructions                                                              |
  31. #    1. Open the script editor and put this script into an open slot between   |
  32. #       Materials and Main, save to take effect.                               |
  33. #------------------------------------------------------------------------------|
  34. #  * Links                                                                     |
  35. #    Script Usage 101:                                                         |
  36. #    1. forums.rpgmakerweb.com/index.php?/topic/32752-rmvxa-script-usage-101/  |
  37. #    2. rpgmakervxace.net/topic/27475-rmvxa-script-usage-101/                  |
  38. #    This script:                                                              |
  39. #    1. https://pastebin.com/KwmQCn83                                          |
  40. #    Mentioned Patreon Supporters:                                             |
  41. #    https://www.patreon.com/posts/71738797                                    |
  42. #------------------------------------------------------------------------------|
  43. #  * Authors                                                                   |
  44. #    DoubleX                                                                   |
  45. #------------------------------------------------------------------------------|
  46. #  * Changelog                                                                 |
  47. #    v1.00a(GMT 0400 23-5-2015):                                               |
  48. #    1. 1st version of this script finished                                    |
  49. #==============================================================================|
  50.  
  51. ($doublex_rmvxa ||= {})[:Targeting_Hotkeys_Compatibility] = "v1.00a"
  52.  
  53. #==============================================================================|
  54. #  ** Script Implementations                                                   |
  55. #     You need not edit this part as it's about how this script works          |
  56. #------------------------------------------------------------------------------|
  57. #  * Script Support Info:                                                      |
  58. #    1. Prerequisites                                                          |
  59. #       - Decent understanding of how the addressed scripts work               |
  60. #    2. Method documentation                                                   |
  61. #       - The 1st part informs which version rewritten, aliased or created this|
  62. #         method                                                               |
  63. #       - The 2nd part informs whether the method's rewritten, aliased or new  |
  64. #       - The 3rd part describes what the method does for new methods only     |
  65. #       - The 4th part describes what the arguments of the method are          |
  66. #       - The 5th part describes how this method works for new methods only,   |
  67. #         and describes the parts added or rewritten for rewritten or aliased  |
  68. #         methods only                                                         |
  69. #       Example:                                                               |
  70. # #----------------------------------------------------------------------------|
  71. # #  (Version X+)Rewrite/Alias/New method: def_name                            |
  72. # #  - What this method does                                                   |
  73. # #----------------------------------------------------------------------------|
  74. # # *args: What these arguments are                                            |
  75. # def def_name(*args)                                                          |
  76. #   # How this method works                                                    |
  77. #   def_name_code                                                              |
  78. #   #                                                                          |
  79. # end # def_name                                                               |
  80. #------------------------------------------------------------------------------|
  81.  
  82. if $doublex_rmvxa[:Targeting_Hotkeys]
  83.  
  84. if $imported["YEA-BattleEngine"]
  85.  
  86.   TARGETING_HOTKEY = %Q(
  87.     @actor_window.hide.deactivate if @actor_window.active
  88.     @enemy_window.hide.deactivate if @enemy_window.active
  89.     @skill_window.hide
  90.     @item_window.hide
  91.     next_command
  92.     return unless @actor_window.active
  93.     @status_window.show
  94.     if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
  95.       @actor_command_window.visible = !@confirm_command_window.visible
  96.     else
  97.       @actor_command_window.show
  98.     end
  99.     @status_aid_window.hide
  100.   )
  101.  
  102. #------------------------------------------------------------------------------|
  103. #  * Edit class: Scene_Battle                                                  |
  104. #------------------------------------------------------------------------------|
  105.  
  106. class Scene_Battle < Scene_Base
  107.  
  108.   #----------------------------------------------------------------------------|
  109.   #  Rewrite method: create_targeting_hotkey_defs                              |
  110.   #----------------------------------------------------------------------------|
  111.  
  112.   if $imported["YSA-CATB"]
  113.  
  114.   def create_targeting_hotkey_defs(hotkeys)
  115.     # Rewritten to mimic the target confirming methods in CATB
  116.     hotkeys.each_index { |index|
  117.       eval(%Q(
  118.   def targeting_hotkey_#{index.to_s}
  119.     return unless (actor = BattleManager.actor) && actor.input.item.for_one?
  120.     if BattleManager.btype?(:catb)
  121.       if @enemy_window.active
  122.         return if $game_troop.all_dead?
  123.         if @enemy_window.data.size != $game_troop.alive_members.size
  124.           @enemy_window.make_item_list
  125.           @enemy_window.index = [@enemy_window.index, @enemy_window.data.size - 1].min
  126.         end
  127.       end
  128.       if $imported["DoubleX RMVXA Unison Addon to YSA-CATB"] && actor && actor.input && actor.input.item && !actor.input.item.catb_unison_actor_id.empty?
  129.         if (actor.input.item.catb_unison_actor_id - BattleManager.action_list(:actor).select { |a| !a.auto_battle? && !a.confusion? }.collect { |a| a.id }).empty?
  130.           actor.input.item.catb_unison_actor_id.each { |actor_id|
  131.             a = $game_actors[actor_id]
  132.             a.input.confirm = true
  133.             a.input.target_index = #{index} unless a == actor
  134.             if $imported["DoubleX RMVXA Cooldown Addon to YSA-CATB"]
  135.               a.item_cooldown = a.input.item.cooldown_rate
  136.               a.unison_cooldown_actor_id = a.input.item.catb_unison_actor_id
  137.               a.unison_cooldown_rule = a.input.item.catb_unison_rule
  138.             end
  139.             a.item_action = a.input.item.action if $imported["DoubleX RMVXA Action Addon to YSA-CATB"]
  140.             a.item_instant = a.input.item.instant if $imported["YEA-InstantCast"]
  141.             next unless $imported["DoubleX RMVXA Charge Addon to YSA-CATB"]
  142.             a.pay_prior_catb_charge
  143.             @status_window.draw_item(a.index)
  144.           }
  145.         end
  146.       else
  147.         actor.input.confirm = true
  148.         actor.item_instant = actor.input.item.instant if $imported["YEA-InstantCast"]
  149.         actor.item_action = actor.input.item.action if $imported["DoubleX RMVXA Action Addon to YSA-CATB"]
  150.         actor.item_cooldown = actor.input.item.cooldown_rate if $imported["DoubleX RMVXA Cooldown Addon to YSA-CATB"]
  151.         if $imported["DoubleX RMVXA Charge Addon to YSA-CATB"]
  152.           actor.pay_prior_catb_charge
  153.           @status_window.draw_item(actor.index)
  154.         end
  155.       end
  156.     end
  157.     $game_temp.battle_aid = nil
  158.     actor.input.target_index = #{index}
  159.     #{TARGETING_HOTKEY}
  160.   end
  161.       ))
  162.     }
  163.     #
  164.   end # create_targeting_hotkey_defs
  165.  
  166.   elsif $doublex_rmvxa[:ECATB]
  167.  
  168.   def create_targeting_hotkey_defs(hotkeys)
  169.     # Rewritten to mimic the target confirming methods in ECATB
  170.     hotkeys.each_index { |index|
  171.       eval(%Q(
  172.   def targeting_hotkey_#{index.to_s}
  173.     return unless (actor = BattleManager.actor) && actor.input.item.for_one?
  174.     if @actor_window.active
  175.       if BattleManager.btype?(:ecatb) && on_ecatb_unison?(:ok, @actor_window)
  176.         return
  177.       end
  178.     else
  179.       return unless @enemy_window.ecatb_update?
  180.       if BattleManager.btype?(:ecatb) && on_ecatb_unison?(:ok, @enemy_window)
  181.         return
  182.       end
  183.     end
  184.     if BattleManager.btype?(:ecatb)
  185.       actor.confirm_ecatb_item
  186.       @status_window.draw_item(actor.index)
  187.     end
  188.     $game_temp.battle_aid = nil
  189.     actor.input.target_index = #{index}
  190.     #{TARGETING_HOTKEY}
  191.   end
  192.       ))
  193.     }
  194.     #
  195.   end # create_targeting_hotkey_defs
  196.  
  197.   else
  198.  
  199.   def create_targeting_hotkey_defs(hotkeys)
  200.     # Rewritten to mimic the target confirming methods in YEA-BattleEngine
  201.     hotkeys.each_index { |index|
  202.       eval(%Q(
  203.   def targeting_hotkey_#{index.to_s}
  204.     return unless BattleManager.actor.input.item.for_one?
  205.     $game_temp.battle_aid = nil
  206.     BattleManager.actor.input.target_index = #{index}
  207.     #{TARGETING_HOTKEY}
  208.   end
  209.       ))
  210.     }
  211.     #
  212.   end # create_targeting_hotkey_defs
  213.  
  214.   end
  215.  
  216. end # Scene_Battle
  217.  
  218. end # if $imported["YEA-BattleEngine"]
  219.  
  220. #------------------------------------------------------------------------------|
  221.  
  222. else
  223.  
  224.   # Informs users that they didn't place ECATB above this script
  225.   msgbox("To use DoubleX RMVXA Targeting Hotkeys Compatibility, " +
  226.          "put it below:\n DoubleX RMVXA Targeting Hotkeys\n but above Main")
  227.  
  228. end # if $doublex_rmvxa[:Targeting_Hotkeys]
  229.  
  230. #==============================================================================|
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement