Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2011
1,048
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.80 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Shanghai Simple Script - Autobattle Command
  4. # Last Date Updated: 2010.05.06
  5. # Level: Easy
  6. #
  7. # This takes off like Final Fantasy XIII. There's an Auto-Battle command where
  8. # it lets the game choose a skill that's best for them to use. This does not
  9. # mean it will pick a smart skill though. This was remade to have compatibility
  10. # with Battle Engine Melody.
  11. #===============================================================================
  12. # Instructions
  13. # -----------------------------------------------------------------------------
  14. # To install this script, open up your script editor and copy/paste this script
  15. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  16. #===============================================================================
  17.  
  18. $imported = {} if $imported == nil
  19. $imported["AutobattleCommand"] = true
  20.  
  21. module SSS
  22.   # This is the text used for AutoBattle
  23.   AUTOBATTLE_COMMAND = "Auto"
  24. end
  25.  
  26. #==============================================================================
  27. # Window_ActorCommand
  28. #==============================================================================
  29. class Window_ActorCommand < Window_Command
  30.   #--------------------------------------------------------------------------
  31.   # * Setup
  32.   #     actor : actor
  33.   #--------------------------------------------------------------------------
  34.   alias setup_sss_window_actorcommand setup unless $@
  35.   def setup(actor)
  36.     setup_sss_window_actorcommand(actor)
  37.     @commands.insert(0, SSS::AUTOBATTLE_COMMAND)
  38.     if $imported["BattleEngineMelody"]
  39.       @data.insert(0, :autobattle)
  40.     end
  41.     @item_max = @commands.size
  42.     create_contents
  43.     refresh
  44.     self.index = 0
  45.   end
  46. end
  47. #==============================================================================
  48. # Scene_Battle
  49. #==============================================================================
  50. class Scene_Battle < Scene_Base
  51.   #--------------------------------------------------------------------------
  52.   # * Update Actor Command Selection
  53.   #--------------------------------------------------------------------------
  54.   unless $imported["BattleEngineMelody"]
  55.     alias update_actor_command_selection_sss_ab update_actor_command_selection
  56.     def update_actor_command_selection
  57.       if Input.trigger?(Input::C)
  58.         case @actor_command_window.index
  59.         when 0
  60.           Sound.play_decision
  61.           @active_battler.make_action
  62.           next_actor
  63.         when 1  # Attack
  64.           Sound.play_decision
  65.           @active_battler.action.set_attack
  66.           start_target_enemy_selection
  67.         when 2  # Skill
  68.           Sound.play_decision
  69.           start_skill_selection
  70.         when 3  # Guard
  71.           Sound.play_decision
  72.           @active_battler.action.set_guard
  73.           next_actor
  74.         when 4  # Item
  75.           Sound.play_decision
  76.           start_item_selection
  77.         end
  78.       else
  79.         update_actor_command_selection_sss_ab
  80.       end
  81.     end
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # actor_command_case
  85.   #--------------------------------------------------------------------------
  86.   if $imported["BattleEngineMelody"]
  87.     alias actor_command_case_sss_ab actor_command_case
  88.     def actor_command_case
  89.       case @actor_command_window.item
  90.       when :autobattle
  91.         Sound.play_decision
  92.         make_auto_command
  93.       else
  94.         actor_command_case_sss_ab
  95.       end
  96.     end
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # * make_auto_command
  100.   #--------------------------------------------------------------------------
  101.   def make_auto_command
  102.     @selected_battler.make_action
  103.     @status_window.draw_item(@selected_battler.index)
  104.     if $scene.dtb?
  105.       next_actor if $game_switches[YEM::BATTLE_ENGINE::OPTIONS[:next_actor_sw]]
  106.     elsif $scene.ptb?
  107.       perform_instant_action
  108.     elsif $scene.atb?
  109.       make_action_orders
  110.       if $game_switches[YEM::BATTLE_ENGINE::OPTIONS[:next_actor_sw]]
  111.         @actor_index = -1 if @actor_index == $game_party.members.size - 1
  112.         next_actor
  113.       end
  114.     elsif $scene.ctb?
  115.       if @selected_battler.ctb_active?
  116.         $game_troop.ctb_ready.shift
  117.         $game_troop.clear_ctb_cache
  118.         make_action_orders
  119.         update_ctb_clockticks
  120.         return
  121.       end
  122.       make_action_orders
  123.       if $game_switches[YEM::BATTLE_ENGINE::OPTIONS[:next_actor_sw]]
  124.         @actor_index = -1 if @actor_index == $game_party.members.size - 1
  125.         next_actor
  126.       end
  127.     end
  128.   end
  129. end
  130. #===============================================================================
  131. #
  132. # END OF FILE
  133. #
  134. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement