#=============================================================
# Moogle_X given on rpgmakerweb.com forum 29 July 2015
# Enables Yanfly's Instant Cast script to apply to using an item
# as the instant action.
# Restricts to one instant action per turn.
# Restricts to one actor ID at line
#60
# Put below Yanfly's Instant Cast script.
#===========================================================
Â
class Game_Actor < Game_Battler
 attr_accessor :already_instant
Â
 alias moogle_setup_instant setup
 def setup(actor_id)
   moogle_setup_instant(actor_id)
   @already_instant = false
 end
Â
 #--------------------------------------------------------------------------
 # * Processing at Start of Battle
 #--------------------------------------------------------------------------
 def on_battle_start
   super
   @already_instant = false
 end
Â
 #--------------------------------------------------------------------------
 # * Processing at End of Battle
 #--------------------------------------------------------------------------
 def on_battle_end
   super
   @already_instant = false
 end
Â
 #--------------------------------------------------------------------------
 # * Processing at End of Turn
 #--------------------------------------------------------------------------
 def on_turn_end
   super
   @already_instant = false
 end
Â
end # Game_Actor
#==============================================================================
# ¡ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
Â
 #--------------------------------------------------------------------------
 # new method: instant_action?
 #--------------------------------------------------------------------------
 def instant_action?
   return false if BattleManager.actor.nil?
   return false if BattleManager.actor.input.nil?
   action = BattleManager.actor.input.item
   if action.is_a?(RPG::Item)
     return false if BattleManager.actor.id != 3 # <= CHANGE THIS TO ACTOR ID.
   end
   return false if action.nil?
   return false if BattleManager.actor.already_instant == true
   return action.instant
 end
Â
 #--------------------------------------------------------------------------
 # new method: perform_instant_action
 #--------------------------------------------------------------------------
 def perform_instant_action
   hide_instant_action_windows
   @subject = BattleManager.actor
   @subject.check_instant_action
   if @subject.current_action.valid?
     execute_action
     @subject.already_instant = true
   end
  Â
   process_event
   loop do
     @subject.remove_current_action
     break if $game_troop.all_dead?
     break unless @subject.current_action
     @subject.current_action.prepare
     execute_action if @subject.current_action.valid?
   end
   process_action_end
   @subject.make_actions
   @subject.restore_instant_action
   @subject = nil
   show_instant_action_windows
 end
end