Advertisement
MiKeMiTchi

MITCHI Auto Battle when Idle [VXA]

Dec 7th, 2011
1,123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.41 KB | None | 0 0
  1. #===========================================================================01=
  2. #  MITCHI Auto Battle when Idle [VXA]
  3. #------------------------------------------------------------------------------
  4. #  Script version: 1.2
  5. #  By: //mitchi.exe                        
  6. #  Converted on: Dec. 8, 2011
  7. #  (This is my first completed VX and VXA script!)
  8. #------------------------------------------------------------------------------
  9. #  Description:
  10. #  This script will make all actors in the party to auto attack when the player
  11. #  is not doing anything (idling) during a party or actor command selection
  12. #  after the specified amount of frames or by pressing a certain button. This
  13. #  is very useful when you suddenly have to do something else IRL and you don't
  14. #  want to waste game play time! This is also beneficial when you're sleepy
  15. #  or lazy... or somethin'...
  16. #------------------------------------------------------------------------------
  17. #  Features:
  18. #  ~The party attacks automatically if player is idle or by a key press
  19. #  ~Can set a specific amount of frames before the auto battle starts
  20. #  ~Can be disabled by a switch
  21. #------------------------------------------------------------------------------
  22. #  Instructions:
  23. #  Change the value of MAB_IDLE_FRAMES below to the amount you want:
  24. #  MAB_IDLE_FRAMES = n
  25. #  Party will automatically attack after 'n' frames. (usu. 60 frames = 1 sec.)
  26. MAB_IDLE_FRAMES = 300
  27.  
  28. #  Change the value of DISABLE_IDLE_SWITCH below to a switch you want:
  29. #  DISABLE_IDLE_SWITCH = n
  30. #  If the switch 'n' is turned ON, the script's features WILL NOT WORK.
  31. DISABLE_IDLE_SWITCH = 85
  32.  
  33. #  You can also enter auto mode by pressing a button.
  34. #  IDLE_AUTO_KEY = button
  35. #  where 'button' can be (:A,:X,:Y,:Z,:L,:R)
  36. IDLE_AUTO_KEY = :L
  37.  
  38. #------------------------------------------------------------------------------
  39. #  Compatibility:
  40. #  -Only supports UP, DOWN, OKAY(C), and CANCEL(B) keys for idling
  41. #  -This will not work on battle systems that alters turns like the ATB and TBS
  42. #===========================================================================42=
  43. #  Special Thanks:
  44. #  -IMP1 for the frame count and seconds info
  45. #  -Yanfly for helping me fix an error for the conversion
  46. #  -SortaCool for originally requesting the script
  47. #  -Peva for the manual key press suggestion
  48. #
  49. #   Changelog:
  50. #   v1.2 - Script converted to VXA
  51. #   v1.1 - auto.battle -> make.action to prevent screwing up
  52. #          each actor's default auto-battle setting (VX)
  53. #==============================================================================
  54. ##### START OF CODE #####
  55. puts "MITCHI Auto Battle when Idle loaded"
  56.  
  57. class Scene_Battle < Scene_Base
  58.  
  59.   alias idle_auto_start start
  60.   alias idle_auto_update update
  61.   alias idle_auto_turn_end turn_end
  62.  
  63.   def start
  64.     idle_auto_start
  65.     @idle_counter = 0
  66.   end
  67.    
  68.   def idle_auto_key_trigger?
  69.     if (Input.trigger?(:DOWN) or Input.trigger?(:UP))
  70.       return true
  71.     elsif (Input.trigger?(:C) or Input.trigger?(:B))
  72.       return true
  73.     end
  74.     return false
  75.   end
  76.  
  77.   def idle_manual_key_press?
  78.     if (Input.trigger?(IDLE_AUTO_KEY))
  79.       return true
  80.     end
  81.     return false
  82.   end
  83.  
  84.   def update
  85.     idle_auto_update
  86.     if !$game_switches[DISABLE_IDLE_SWITCH]
  87.       if @party_command_window.active or @actor_command_window.active
  88.         @idle_counter = 0 if idle_auto_key_trigger?
  89.         @idle_counter += 1
  90.     @idle_counter = MAB_IDLE_FRAMES if idle_manual_key_press?
  91.         if @idle_counter == (MAB_IDLE_FRAMES)
  92.       puts "Auto Battle Idle mode enabled!"
  93.           for i in 0..$game_party.members.size-1
  94.             actor_set_auto = $game_party.members[i].id
  95.             $game_actors[actor_set_auto].make_auto_battle_actions
  96.           end
  97.           Sound.play_ok
  98.       @party_command_window.deactivate if @party_command_window.active
  99.       @actor_command_window.deactivate if @actor_command_window.active
  100.           turn_start
  101.         end
  102.       end
  103.     end
  104.   end  
  105.  
  106.   def turn_end
  107.     @idle_counter = 0
  108.     idle_auto_turn_end
  109.   end
  110.  
  111. end
  112.  
  113. ##### END OF CODE #####
  114. #==============================================================================
  115. #  _   _   _   _____   ____   _   _   _
  116. # | \ / | | | |_   _| |  __| | |_| | | |
  117. # |  '  | | |   | |   | |__  |  _  | | |
  118. # |_|_|_| |_|   |_|   |____| |_| |_| |_|
  119. #  "Yay for my first completed VXA script!"
  120. #==============================================================================
  121.  
  122.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement