Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #============================================================================01=
- # MITCHI Auto Battle when Idle
- #------------------------------------------------------------------------------
- # Script version: 1.1
- # By: //mitchi.exe
- # On: Nov. 2, 2011
- # Originally requested by: SortaCool
- # (This is my first completed script!)
- #------------------------------------------------------------------------------
- # Description:
- # This script will make all actors in the party to auto attack when the player
- # is not doing anything (idling) during a party or actor command selection
- # after a specified amount of frames. This is very useful when you suddenly
- # have to do something else IRL and you don't want to waste game play time!
- # This is also beneficial when you're sleepy or lazy... or somethin'...
- #------------------------------------------------------------------------------
- # Features:
- # ~Party attacks automatically if player is idle
- # ~Can set a specific amount of frames before the auto-battle starts
- # ~Can be disabled by a switch
- # ~Change an actor's auto-battle setting via event script command
- #------------------------------------------------------------------------------
- # Instructions:
- # Change the value of IDLE_FRAMES below to the amount you want:
- # IDLE_FRAMES = n
- # The party will automatically attack after 'n' frames.
- IDLE_FRAMES = 300
- # Change the value of DISABLE_IDLE_SWITCH below to a switch you want:
- # DISABLE_IDLE_SWITCH = n
- # If the switch 'n' is turned ON, auto battle when idle WILL NOT WORK.
- DISABLE_IDLE_SWITCH = 85
- # You can alter an actor's auto-battle setting with an event script command:
- # $game_actors[<id of actor>].idle_auto_battler(<true or false>)
- # *Note that ^this will still work even if DISABLE_IDLE_SWITCH is on.
- #------------------------------------------------------------------------------
- # Compatibility:
- # -Only supports UP, DOWN, OKAY(C), and CANCEL(B) keys for idling
- # -This should work with battle systems that uses
- # @actor_command_window and @party_command_window
- #===========================================================================42=
- # Changelog:
- # v1.1 - auto.battle -> make.action to prevent screwing up
- # each actor's default auto-battle setting
- #==============================================================================
- ##### START OF CODE #####
- class Game_Actor < Game_Battler
- def idle_auto_battler(boolean)
- actor.auto_battle = (boolean)
- end
- end
- class Scene_Battle < Scene_Base
- alias idle_auto_start start
- alias idle_auto_update update
- alias idle_auto_turn_end turn_end
- def start
- idle_auto_start
- @idle_counter = 0
- end
- def idle_auto_key_trigger?
- if (Input.trigger?(Input::DOWN) or Input.trigger?(Input::UP))
- return true
- elsif (Input.trigger?(Input::C) or Input.trigger?(Input::B))
- return true
- end
- return false
- end
- def update
- idle_auto_update
- if !$game_switches[DISABLE_IDLE_SWITCH]
- if @party_command_window.active or @actor_command_window.active
- @idle_counter = 0 if idle_auto_key_trigger?
- @idle_counter += 1
- if @idle_counter == (IDLE_FRAMES)
- for i in 0..$game_party.members.size
- actor_set_auto = $game_party.members[i].id
- $game_actors[actor_set_auto].make_action
- end
- Sound.play_decision
- start_main
- end
- end
- end
- end
- def turn_end
- @idle_counter = 0
- idle_auto_turn_end
- end
- end
- ##### END OF CODE #####
- #==============================================================================
- # _ _ _ _____ ____ _ _ _
- # | \ / | | | |_ _| | __| | |_| | | |
- # | ' | | | | | | |__ | _ | | |
- # |_|_|_| |_| |_| |____| |_| |_| |_|
- # "Yay for my first completed script!"
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement