[XP] Request - Battle Script to target Anyone with any type of Magic?

Started by Heretic86, May 04, 2012, 06:31:30 pm

Previous topic - Next topic

Heretic86

So Im looking at Blizz's Full Reflect System, and thinking of a way to add a bit of strategy to battles.  For example, an enemy that heals itself every round would reflect spells back.  But to target the enemy with Magic, I'd need to be able to cast an offensive spell on a Party Member that also has Reflect on.  IE, cast Fire on a Party Member and it Reflects to hit the Enemy.  Unfortunately, there is nothing in the Scope dropdown menu that allows a skill to target Anyone, hence I need to turn to a script.

The other thing I was thinking this might be useful for is Vs Undead.  I think there may be a script for this already, where Friendly Spells cast on Undead have the Opposite Effect.  IE Heal Spells Damage Undead, but first, I'd need to be able to Target the Undead with a Friendly Spell.

Any suggestions?
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

KK20

Took me a good chunk of time. I was naturally bored so I felt to give it a go. Note that this was written with the default battle system in mind since you didn't mention any (I probably wouldn't have tried if you did :P)
Target Anyone Scope: ShowHide
=begin
===============================================================================
Target Anyone Scope
Version 1.0

By KK20
===============================================================================
-[ Introduction ]-
This small script allows the player to make single target scopes reverse its
intended target. In other words, you can now choose to Heal a monster or one
of your allies.

-[ Instructions ]-
1.) Scroll down to the configurations and locate Constant TARGET_ANYONE_TAG.
     Change the string associated with it if you like.
2.) Modify the key press that will allow the player to shift between targetting
     the party and the troop.
3.) Create a new element in the Database. Name this new element the same as you
     have TARGET_ANYONE_TAG assigned to.
4.) Apply this new element to skills or items that you wish to have this
     effect.

     ~ NOTE: The effect will only work if you set the scope to "One Enemy"
             or "One Ally".

-[ Compatibility ]-
* This script was made with the default battle system in mind. Custom battle
   scripts will most likely not work with this script without edits.
* Not tested with SDK
* Changes made to Game_Actor, Game_Battler, and Scene_Battle

===============================================================================
Credits:
KK20 - Writing this script
Charlie Fleed - For the idea
===============================================================================
=end

#===========#
# Configure #
#===========#

# The element ID's name that allows the user to target any one battler
TARGET_ANYONE_TAG = "Any Target"

# The key that allows the player to change targetting party to/from troop
CHANGE_PARTY_TROOP_TARGET_KEY = Input::SHIFT

#===============#
# End Configure #
#===============#

#-------------------------------------------------------------------------
# Class Game Actor
#-------------------------------------------------------------------------
class Game_Actor < Game_Battler
  attr_accessor :changed_scope
 
  alias call_init_again initialize
  def initialize(actor_id)
    @changed_scope = false
    call_init_again(actor_id)
  end
 
end

#-------------------------------------------------------------------------
# Class Game Battler
#-------------------------------------------------------------------------
class Game_Battler
  #--------------------------------------------------------------------------
  # * Calculating Element Correction
  #     element_set : element
  #--------------------------------------------------------------------------
  def elements_correct(element_set)
    # If not an element
    if element_set == []
      # Return 100
      return 100
    end
    # Return the weakest object among the elements given
    # * "element_rate" method is defined by Game_Actor and Game_Enemy classes,
    #    which inherit from this class.
    weakest = -100
    for i in element_set
      # Skips the "Target anyone" element to avoid damage miscalculations
      next if i == $data_system.elements.index(TARGET_ANYONE_TAG)
      weakest = [weakest, self.element_rate(i)].max
    end
    return weakest
  end
end

#-------------------------------------------------------------------------
# Class Scene Battle
#-------------------------------------------------------------------------
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : skill selection)
  #--------------------------------------------------------------------------
  def update_phase3_skill_select
    # Make skill window visible
    @skill_window.visible = true
    # Update skill window
    @skill_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End skill selection
      end_skill_select
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the skill window
      @skill = @skill_window.skill
      # If it can't be used
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.skill_id = @skill.id
      # Make skill window invisible
      @skill_window.visible = false
      # If effect scope is single enemy or single ally and can target anyone
      if @skill.element_set.include?($data_system.elements.index(TARGET_ANYONE_TAG)) and
      (@skill.scope == 1 or @skill.scope == 3)
        # Define starting position of the arrow
        @orig_scope = @skill.scope
        start_enemy_select if @skill.scope == 1
        start_actor_select if @skill.scope == 3
        @any_target = true
      elsif @skill.scope == 1 
        # Start enemy selection
        start_enemy_select
      # If effect scope is single ally
      elsif @skill.scope == 3 or @skill.scope == 5
        # Start actor selection
        start_actor_select
      # If effect scope is not single
      else
        # End skill selection
        end_skill_select
        # Go to command input for next actor
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : item selection)
  #--------------------------------------------------------------------------
  def update_phase3_item_select
    # Make item window visible
    @item_window.visible = true
    # Update item window
    @item_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End item selection
      end_item_select
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      @item = @item_window.item
      # If it can't be used
      unless $game_party.item_can_use?(@item.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.item_id = @item.id
      # Make item window invisible
      @item_window.visible = false
      # If effect scope is single enemy or single ally and can target anyone
      if @item.element_set.include?($data_system.elements.index(TARGET_ANYONE_TAG)) and
      (@item.scope == 1 or @item.scope == 3)
        # Define starting position of the arrow
        @orig_scope = @skill.scope
        start_enemy_select if @item.scope == 1
        start_actor_select if @item.scope == 3
        @any_target = true
      # If effect scope is single enemy
      elsif @item.scope == 1 
        # Start enemy selection
        start_enemy_select
      # If effect scope is single ally
      elsif @item.scope == 3 or @item.scope == 5
        # Start actor selection
        start_actor_select
      # If effect scope is not single
      else
        # End item selection
        end_item_select
        # Go to command input for next actor
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Updat (actor command phase : enemy selection)
  #--------------------------------------------------------------------------
  def update_phase3_enemy_select
    # Update enemy arrow
    @enemy_arrow.update
    # If this skill/item can target anyone
    if @any_target == true
      # If player pressed the key to change targets
      if Input.trigger?(CHANGE_PARTY_TROOP_TARGET_KEY)
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Initialize actor select, end enemy select
        end_enemy_select
        start_actor_select
        @active_battler.changed_scope = !@active_battler.changed_scope
        # Stop processing
        return
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End enemy selection
      end_enemy_select
      @any_target = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.target_index = @enemy_arrow.index
      # End enemy selection
      end_enemy_select
      # If skill window is showing
      if @skill_window != nil
        # End skill selection
        end_skill_select
      end
      # If item window is showing
      if @item_window != nil
        # End item selection
        end_item_select
      end
      @any_target = false
      # Go to command input for next actor
      phase3_next_actor
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : actor selection)
  #--------------------------------------------------------------------------
  def update_phase3_actor_select
    # Update actor arrow
    @actor_arrow.update
    # If this skill/item can target anyone
    if @any_target == true
      # If player pressed the key to change targets
      if Input.trigger?(CHANGE_PARTY_TROOP_TARGET_KEY)
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Initialize actor select, end enemy select
        end_actor_select
        start_enemy_select
        @active_battler.changed_scope = !@active_battler.changed_scope
        # Stop processing
        return
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End actor selection
      end_actor_select
      @any_target = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.target_index = @actor_arrow.index
      # End actor selection
      end_actor_select
      # If skill window is showing
      if @skill_window != nil
        # End skill selection
        end_skill_select
      end
      # If item window is showing
      if @item_window != nil
        # End item selection
        end_item_select
      end
      @any_target = false
      # Go to command input for next actor
      phase3_next_actor
    end
  end
  #--------------------------------------------------------------------------
  # * Set Targeted Battler for Skill or Item
  #     scope : effect scope for skill or item
  #--------------------------------------------------------------------------
  alias modded_scopes_change_targets set_target_battlers
  def set_target_battlers(scope)
    # If the actor has changed the scope of the skill/item
    if @active_battler.is_a?(Game_Actor) and @active_battler.changed_scope
      # Reset the variable
      @active_battler.changed_scope = false
      # Determine targets
      case scope
      when 1 # single ally
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_party.smooth_target_actor(index))
      when 3 # single enemy
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_troop.smooth_target_enemy(index))
      end
    else
      # Call original method
      modded_scopes_change_targets(scope)
    end
  end
 
end


There's a SDK script by Trickster called Advanced Targetting if, for whatever reasons, you would like to get ideas/inspired.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Heretic86

Awesome!  Yeah I do have a custom battle script, but let me worry about trying to get that to work properly with it.  Quick request, the system Im using is a Front View, is it possible to set the Change Party Keys to Enemy on Input::UP and Party on Input::Down?

So, um, although it is pretty much what I wanted (at least for Undead), it seems that Heal spells seem to HURT bad guys...  Hopefully you have a quick fix for that?

I seriously appreciate the work you put into this, I know it isnt easy!  Thank you very much!
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

KK20

=begin
===============================================================================
Target Anyone Scope
Version 1.0

By KK20
===============================================================================
-[ Introduction ]-
This small script allows the player to make single target scopes reverse its
intended target. In other words, you can now choose to Heal a monster or one
of your allies.

-[ Instructions ]-
1.) Scroll down to the configurations and locate Constant TARGET_ANYONE_TAG.
     Change the string associated with it if you like.
2.) Create a new element in the Database. Name this new element the same as you
     have TARGET_ANYONE_TAG assigned to.
3.) Apply this new element to skills or items that you wish to have this
     effect.

     ~ NOTE: The effect will only work if you set the scope to "One Enemy"
             or "One Ally".

-[ Compatibility ]-
* This script was made with the default battle system in mind. Custom battle
   scripts will most likely not work with this script without edits.
* Not tested with SDK
* Changes made to Game_Actor, Game_Battler, and Scene_Battle

===============================================================================
Credits:
KK20 - Writing this script
Charlie Fleed - For the idea
===============================================================================
=end

#===========#
# Configure #
#===========#

# The element ID's name that allows the user to target any one battler
TARGET_ANYONE_TAG = "Any Target"

#===============#
# End Configure #
#===============#

#-------------------------------------------------------------------------
# Class Game Actor
#-------------------------------------------------------------------------
class Game_Actor < Game_Battler
  attr_accessor :changed_scope
 
  alias call_init_again initialize
  def initialize(actor_id)
    @changed_scope = false
    call_init_again(actor_id)
  end
 
end

#-------------------------------------------------------------------------
# Class Game Battler
#-------------------------------------------------------------------------
class Game_Battler
  #--------------------------------------------------------------------------
  # * Calculating Element Correction
  #     element_set : element
  #--------------------------------------------------------------------------
  def elements_correct(element_set)
    # If not an element
    if element_set == []
      # Return 100
      return 100
    end
    # Return the weakest object among the elements given
    # * "element_rate" method is defined by Game_Actor and Game_Enemy classes,
    #    which inherit from this class.
    weakest = -100
    for i in element_set
      # Skips the "Target anyone" element to avoid damage miscalculations
      next if i == $data_system.elements.index(TARGET_ANYONE_TAG)
      weakest = [weakest, self.element_rate(i)].max
    end
    return weakest
  end
end

#-------------------------------------------------------------------------
# Class Scene Battle
#-------------------------------------------------------------------------
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : skill selection)
  #--------------------------------------------------------------------------
  def update_phase3_skill_select
    # Make skill window visible
    @skill_window.visible = true
    # Update skill window
    @skill_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End skill selection
      end_skill_select
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the skill window
      @skill = @skill_window.skill
      # If it can't be used
      if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.skill_id = @skill.id
      # Make skill window invisible
      @skill_window.visible = false
      # If effect scope is single enemy or single ally and can target anyone
      if @skill.element_set.include?($data_system.elements.index(TARGET_ANYONE_TAG)) and
      (@skill.scope == 1 or @skill.scope == 3)
        # Define starting position of the arrow
        @orig_scope = @skill.scope
        start_enemy_select if @skill.scope == 1
        start_actor_select if @skill.scope == 3
        @any_target = true
      elsif @skill.scope == 1 
        # Start enemy selection
        start_enemy_select
      # If effect scope is single ally
      elsif @skill.scope == 3 or @skill.scope == 5
        # Start actor selection
        start_actor_select
      # If effect scope is not single
      else
        # End skill selection
        end_skill_select
        # Go to command input for next actor
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : item selection)
  #--------------------------------------------------------------------------
  def update_phase3_item_select
    # Make item window visible
    @item_window.visible = true
    # Update item window
    @item_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End item selection
      end_item_select
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      @item = @item_window.item
      # If it can't be used
      unless $game_party.item_can_use?(@item.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.item_id = @item.id
      # Make item window invisible
      @item_window.visible = false
      # If effect scope is single enemy or single ally and can target anyone
      if @item.element_set.include?($data_system.elements.index(TARGET_ANYONE_TAG)) and
      (@item.scope == 1 or @item.scope == 3)
        # Define starting position of the arrow
        @orig_scope = @skill.scope
        start_enemy_select if @item.scope == 1
        start_actor_select if @item.scope == 3
        @any_target = true
      # If effect scope is single enemy
      elsif @item.scope == 1 
        # Start enemy selection
        start_enemy_select
      # If effect scope is single ally
      elsif @item.scope == 3 or @item.scope == 5
        # Start actor selection
        start_actor_select
      # If effect scope is not single
      else
        # End item selection
        end_item_select
        # Go to command input for next actor
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Updat (actor command phase : enemy selection)
  #--------------------------------------------------------------------------
  def update_phase3_enemy_select
    # Update enemy arrow
    @enemy_arrow.update
    # If this skill/item can target anyone
    if @any_target == true
      # If player pressed the key to change targets
      if Input.trigger?(Input::DOWN)
        # Play decision SE
        $game_system.se_play($data_system.cursor_se)
        # Initialize actor select, end enemy select
        end_enemy_select
        start_actor_select
        @active_battler.changed_scope = !@active_battler.changed_scope
        # Stop processing
        return
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End enemy selection
      end_enemy_select
      @any_target = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.target_index = @enemy_arrow.index
      # End enemy selection
      end_enemy_select
      # If skill window is showing
      if @skill_window != nil
        # End skill selection
        end_skill_select
      end
      # If item window is showing
      if @item_window != nil
        # End item selection
        end_item_select
      end
      @any_target = false
      # Go to command input for next actor
      phase3_next_actor
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : actor selection)
  #--------------------------------------------------------------------------
  def update_phase3_actor_select
    # Update actor arrow
    @actor_arrow.update
    # If this skill/item can target anyone
    if @any_target == true
      # If player pressed the key to change targets
      if Input.trigger?(Input::UP)
        # Play decision SE
        $game_system.se_play($data_system.cursor_se)
        # Initialize actor select, end enemy select
        end_actor_select
        start_enemy_select
        @active_battler.changed_scope = !@active_battler.changed_scope
        # Stop processing
        return
      end
    end
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End actor selection
      end_actor_select
      @any_target = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.target_index = @actor_arrow.index
      # End actor selection
      end_actor_select
      # If skill window is showing
      if @skill_window != nil
        # End skill selection
        end_skill_select
      end
      # If item window is showing
      if @item_window != nil
        # End item selection
        end_item_select
      end
      @any_target = false
      # Go to command input for next actor
      phase3_next_actor
    end
  end
  #--------------------------------------------------------------------------
  # * Set Targeted Battler for Skill or Item
  #     scope : effect scope for skill or item
  #--------------------------------------------------------------------------
  alias modded_scopes_change_targets set_target_battlers
  def set_target_battlers(scope)
    # If the actor has changed the scope of the skill/item
    if @active_battler.is_a?(Game_Actor) and @active_battler.changed_scope
      # Reset the variable
      @active_battler.changed_scope = false
      # Determine targets
      case scope
      when 1 # single ally
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_party.smooth_target_actor(index))
      when 3 # single enemy
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_troop.smooth_target_enemy(index))
      end
    else
      # Call original method
      modded_scopes_change_targets(scope)
    end
  end
 
end


As for the healing, I got mine working the way it should. I just made a new element called "Heal", made any monsters that could be damaged by healing a rating of F, and....profit. Maybe your elements are just wonky? Or you changed Heal's base damage value, which should be a negative number. But anyways, no problem for the help  ;)

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Heretic86

I havent gotten to trying to integrate it yet, so I just tried it in a new empty project to test this script out.  I'll try adding a Heal State and give it an F to see if that helps.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Heretic86

Works pretty good!  Any suggestions on how to make a Revive or Resurrect Spell work the same way as Instant Death?
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

KK20

 :???:
Well, to create an instant death skill, all you have to do is make the skill apply the state "Knockout". So...to revive, all you do is make the skill remove "Knockout". There is a revival skill (Raise) whenever you start a new project--just make the skill look like that.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Heretic86

Quick Fix: Item Scope

Spoiler: ShowHide
=begin
===============================================================================
Target Anyone Scope
Version 1.0

By KK20
===============================================================================
-[ Introduction ]-
This small script allows the player to make single target scopes reverse its
intended target. In other words, you can now choose to Heal a monster or one
of your allies.

-[ Instructions ]-
1.) Scroll down to the configurations and locate Constant TARGET_ANYONE_TAG.
    Change the string associated with it if you like.
2.) Create a new element in the Database. Name this new element the same as you
    have TARGET_ANYONE_TAG assigned to.
3.) Apply this new element to skills or items that you wish to have this
    effect.

    ~ NOTE: The effect will only work if you set the scope to "One Enemy"
            or "One Ally".

-[ Compatibility ]-
* This script was made with the default battle system in mind. Custom battle
  scripts will most likely not work with this script without edits.
* Not tested with SDK
* Changes made to Game_Actor, Game_Battler, and Scene_Battle

===============================================================================
Credits:
KK20 - Writing this script
Charlie Fleed - For the idea
===============================================================================
=end

#===========#
# Configure #
#===========#

# The element ID's name that allows the user to target any one battler
TARGET_ANYONE_TAG = "Any Target"

#===============#
# End Configure #
#===============#

#-------------------------------------------------------------------------
# Class Game Actor
#-------------------------------------------------------------------------
class Game_Actor < Game_Battler
 attr_accessor :changed_scope
 
 alias call_init_again initialize
 def initialize(actor_id)
   @changed_scope = false
   call_init_again(actor_id)
 end
 
end

#-------------------------------------------------------------------------
# Class Game Battler
#-------------------------------------------------------------------------
class Game_Battler
 #--------------------------------------------------------------------------
 # * Calculating Element Correction
 #     element_set : element
 #--------------------------------------------------------------------------
 def elements_correct(element_set)
   # If not an element
   if element_set == []
     # Return 100
     return 100
   end
   # Return the weakest object among the elements given
   # * "element_rate" method is defined by Game_Actor and Game_Enemy classes,
   #    which inherit from this class.
   weakest = -100
   for i in element_set
     # Skips the "Target anyone" element to avoid damage miscalculations
     next if i == $data_system.elements.index(TARGET_ANYONE_TAG)
     weakest = [weakest, self.element_rate(i)].max
   end
   return weakest
 end
end

#-------------------------------------------------------------------------
# Class Scene Battle
#-------------------------------------------------------------------------
class Scene_Battle
 #--------------------------------------------------------------------------
 # * Frame Update (actor command phase : skill selection)
 #--------------------------------------------------------------------------
 def update_phase3_skill_select
   # Make skill window visible
   @skill_window.visible = true
   # Update skill window
   @skill_window.update
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # End skill selection
     end_skill_select
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Get currently selected data on the skill window
     @skill = @skill_window.skill
     # If it can't be used
     if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
       # Play buzzer SE
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # Play decision SE
     $game_system.se_play($data_system.decision_se)
     # Set action
     @active_battler.current_action.skill_id = @skill.id
     # Make skill window invisible
     @skill_window.visible = false
     # If effect scope is single enemy or single ally and can target anyone
     if @skill.element_set.include?($data_system.elements.index(TARGET_ANYONE_TAG)) and
     (@skill.scope == 1 or @skill.scope == 3)
       # Define starting position of the arrow
       @orig_scope = @skill.scope
       start_enemy_select if @skill.scope == 1
       start_actor_select if @skill.scope == 3
       @any_target = true
     elsif @skill.scope == 1  
       # Start enemy selection
       start_enemy_select
     # If effect scope is single ally
     elsif @skill.scope == 3 or @skill.scope == 5
       # Start actor selection
       start_actor_select
     # If effect scope is not single
     else
       # End skill selection
       end_skill_select
       # Go to command input for next actor
       phase3_next_actor
     end
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (actor command phase : item selection)
 #--------------------------------------------------------------------------
 def update_phase3_item_select
   # Make item window visible
   @item_window.visible = true
   # Update item window
   @item_window.update
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # End item selection
     end_item_select
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Get currently selected data on the item window
     @item = @item_window.item
     # If it can't be used
     unless $game_party.item_can_use?(@item.id)
       # Play buzzer SE
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # Play decision SE
     $game_system.se_play($data_system.decision_se)
     # Set action
     @active_battler.current_action.item_id = @item.id
     # Make item window invisible
     @item_window.visible = false
     # If effect scope is single enemy or single ally and can target anyone
     if @item.element_set.include?($data_system.elements.index(TARGET_ANYONE_TAG)) and
     (@item.scope == 1 or @item.scope == 3)
       # Define starting position of the arrow
       @orig_scope = @item.scope
       start_enemy_select if @item.scope == 1
       start_actor_select if @item.scope == 3
       @any_target = true
     # If effect scope is single enemy
     elsif @item.scope == 1  
       # Start enemy selection
       start_enemy_select
     # If effect scope is single ally
     elsif @item.scope == 3 or @item.scope == 5
       # Start actor selection
       start_actor_select
     # If effect scope is not single
     else
       # End item selection
       end_item_select
       # Go to command input for next actor
       phase3_next_actor
     end
     return
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Updat (actor command phase : enemy selection)
 #--------------------------------------------------------------------------
 def update_phase3_enemy_select
   # Update enemy arrow
   @enemy_arrow.update
   # If this skill/item can target anyone
   if @any_target == true
     # If player pressed the key to change targets
     if Input.trigger?(Input::DOWN)
       # Play decision SE
       $game_system.se_play($data_system.cursor_se)
       # Initialize actor select, end enemy select
       end_enemy_select
       start_actor_select
       @active_battler.changed_scope = !@active_battler.changed_scope
       # Stop processing
       return
     end
   end
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # End enemy selection
     end_enemy_select
     @any_target = false
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Play decision SE
     $game_system.se_play($data_system.decision_se)
     # Set action
     @active_battler.current_action.target_index = @enemy_arrow.index
     # End enemy selection
     end_enemy_select
     # If skill window is showing
     if @skill_window != nil
       # End skill selection
       end_skill_select
     end
     # If item window is showing
     if @item_window != nil
       # End item selection
       end_item_select
     end
     @any_target = false
     # Go to command input for next actor
     phase3_next_actor
   end
 end
 #--------------------------------------------------------------------------
 # * Frame Update (actor command phase : actor selection)
 #--------------------------------------------------------------------------
 def update_phase3_actor_select
   # Update actor arrow
   @actor_arrow.update
   # If this skill/item can target anyone
   if @any_target == true
     # If player pressed the key to change targets
     if Input.trigger?(Input::UP)
       # Play decision SE
       $game_system.se_play($data_system.cursor_se)
       # Initialize actor select, end enemy select
       end_actor_select
       start_enemy_select
       @active_battler.changed_scope = !@active_battler.changed_scope
       # Stop processing
       return
     end
   end
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # End actor selection
     end_actor_select
     @any_target = false
     return
   end
   # If C button was pressed
   if Input.trigger?(Input::C)
     # Play decision SE
     $game_system.se_play($data_system.decision_se)
     # Set action
     @active_battler.current_action.target_index = @actor_arrow.index
     # End actor selection
     end_actor_select
     # If skill window is showing
     if @skill_window != nil
       # End skill selection
       end_skill_select
     end
     # If item window is showing
     if @item_window != nil
       # End item selection
       end_item_select
     end
     @any_target = false
     # Go to command input for next actor
     phase3_next_actor
   end
 end
 #--------------------------------------------------------------------------
 # * Set Targeted Battler for Skill or Item
 #     scope : effect scope for skill or item
 #--------------------------------------------------------------------------
 alias modded_scopes_change_targets set_target_battlers
 def set_target_battlers(scope)
   # If the actor has changed the scope of the skill/item
   if @active_battler.is_a?(Game_Actor) and @active_battler.changed_scope
     # Reset the variable
     @active_battler.changed_scope = false
     # Determine targets
     case scope
     when 1 # single ally
       index = @active_battler.current_action.target_index
       @target_battlers.push($game_party.smooth_target_actor(index))
     when 3 # single enemy
       index = @active_battler.current_action.target_index
       @target_battlers.push($game_troop.smooth_target_enemy(index))
     end
   else
     # Call original method
     modded_scopes_change_targets(scope)
   end
 end

One liner.  Changed in  # * Frame Update (actor command phase : item selection)         @orig_scope = @skill.scope to         @orig_scope = @item.scope
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)