Auto Battle when Idle
-El equipo ataca automáticamente cuando pasa determinado número de frames.
Versión: 1.2
Creditos: //mitchi.exe
Código:
#===========================================================================01=
# MITCHI Auto Battle when Idle [VXA]
#------------------------------------------------------------------------------
# Script version: 1.2
# By: //mitchi.exe
# Converted on: Dec. 8, 2011
# (This is my first completed VX and VXA 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 the specified amount of frames or by pressing a certain button. 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:
# ~The party attacks automatically if player is idle or by a key press
# ~Can set a specific amount of frames before the auto battle starts
# ~Can be disabled by a switch
#------------------------------------------------------------------------------
# Instructions:
# Change the value of MAB_IDLE_FRAMES below to the amount you want:
# MAB_IDLE_FRAMES = n
# Party will automatically attack after 'n' frames. (usu. 60 frames = 1 sec.)
MAB_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, the script's features WILL NOT WORK.
DISABLE_IDLE_SWITCH = 85
# You can also enter auto mode by pressing a button.
# IDLE_AUTO_KEY = button
# where 'button' can be (:A,:X,:Y,:Z,:L,:R)
IDLE_AUTO_KEY = :L
#------------------------------------------------------------------------------
# Compatibility:
# -Only supports UP, DOWN, OKAY(C), and CANCEL(B) keys for idling
# -This will not work on battle systems that alters turns like the ATB and TBS
#===========================================================================42=
# Special Thanks:
# -IMP1 for the frame count and seconds info
# -Yanfly for helping me fix an error for the conversion
# -SortaCool for originally requesting the script
# -Peva for the manual key press suggestion
#
# Changelog:
# v1.2 - Script converted to VXA
# v1.1 - auto.battle -> make.action to prevent screwing up
# each actor's default auto-battle setting (VX)
#==============================================================================
##### START OF CODE #####
puts "MITCHI Auto Battle when Idle loaded"
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?(:DOWN) or Input.trigger?(:UP))
return true
elsif (Input.trigger?(:C) or Input.trigger?(:B))
return true
end
return false
end
def idle_manual_key_press?
if (Input.trigger?(IDLE_AUTO_KEY))
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
@idle_counter = MAB_IDLE_FRAMES if idle_manual_key_press?
if @idle_counter == (MAB_IDLE_FRAMES)
puts "Auto Battle Idle mode enabled!"
for i in 0..$game_party.members.size-1
actor_set_auto = $game_party.members[i].id
$game_actors[actor_set_auto].make_auto_battle_actions
end
Sound.play_ok
@party_command_window.deactivate if @party_command_window.active
@actor_command_window.deactivate if @actor_command_window.active
turn_start
end
end
end
end
def turn_end
@idle_counter = 0
idle_auto_turn_end
end
end
##### END OF CODE #####
#==============================================================================
# _ _ _ _____ ____ _ _ _
# | \ / | | | |_ _| | __| | |_| | | |
# | ' | | | | | | |__ | _ | | |
# |_|_|_| |_| |_| |____| |_| |_| |_|
# "Yay for my first completed VXA script!"
#==============================================================================