All/Self/None Targetting Arrows
#1
All/Self/None Targeting Arrows

Version: 1.0


Introduction

This script adds targeting arrows to the None, All Allies, All Enemies, and The User skill and item targets.


Screenshots

[Image: acpw68.png]


Script
Code:
#==============================================================================
# ** Scene_Battle (part 3)
#------------------------------------------------------------------------------
#  Edits to skill and item select to standardize selection process.
#  By MechanicalPen for Save-Point.org
#  Use however you wish, but include a link to the thread:
#  http://save-point.org/thread-4961.html
#  if script is posted on other sites.
#==============================================================================
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 is none
      if @skill.scope == 0
        start_actor_self_select
      # If effect is single enemy
      elsif @skill.scope == 1
        # Start enemy selection
        start_enemy_select
      # If effect scope is all enemies
      elsif @skill.scope == 2
        start_all_enemies_select
      # If effect scope is single ally
      elsif @skill.scope == 3 or @skill.scope == 5
        # Start actor selection
        start_actor_select
      elsif @skill.scope == 4 or @skill.scope == 6
        start_all_actors_select
      elsif @skill.scope == 7
        start_actor_self_select
      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 none
      if @item.scope == 0
        start_actor_self_select
      # If effect scope is single enemy
      elsif @item.scope == 1
        # Start enemy selection
        start_enemy_select
      # If effect scope is all enemies
      elsif @item.scope == 2
        start_all_enemies_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 all allies
      elsif @item.scope == 4 or @item.scope == 6
        start_all_actors_select
      # If effect scope is user
      elsif @item.scope == 7
        start_actor_self_select
      else
        # End item selection
        end_item_select
        # Go to command input for next actor
        phase3_next_actor
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Start Enemy Selection (all)
  #--------------------------------------------------------------------------
  def start_all_enemies_select
    # Make enemy arrow
    @enemy_arrow = Arrow_All_Enemies.new(@spriteset.viewport1)
    # Associate help window
    @enemy_arrow.help_window = @help_window
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end
  #--------------------------------------------------------------------------
  # * Start Actor Selection (self)
  #--------------------------------------------------------------------------
  def start_actor_self_select
    # Make actor arrow
    @actor_arrow = Arrow_Self.new(@spriteset.viewport2)
    @actor_arrow.index = @actor_index
    # Associate help window
    @actor_arrow.help_window = @help_window
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end
  #--------------------------------------------------------------------------
  # * Start Actor Selection (all)
  #--------------------------------------------------------------------------
  def start_all_actors_select
    # Make actor arrow
    @actor_arrow = Arrow_All_Actors.new(@spriteset.viewport2)
    @actor_arrow.index = @actor_index
    # Associate help window
    @actor_arrow.help_window = @help_window
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end
end

#==============================================================================
# ** Arrow_All_Enemies
#------------------------------------------------------------------------------
#  This arrow cursor is used to choose all enemies. This class inherits from
#  the Arrow_Base class.
#==============================================================================
class Arrow_All_Enemies < Arrow_Base
  #--------------------------------------------------------------------------
  # * Object Initialization (Actor Arrow is flipped)
  #     viewport : viewport
  #--------------------------------------------------------------------------
  def initialize(viewport)
    @extra_arrows = []
    #generate an arrow for each enemy
    for i in 0...$game_troop.enemies.size
      @extra_arrows[i] = Arrow_Enemy.new(viewport)
      @extra_arrows[i].index = i
    end
    super(viewport)
    update
  end
  #--------------------------------------------------------------------------
  # * Get Enemy Indicated by Cursor
  #--------------------------------------------------------------------------
  def enemy
    return $game_troop.enemies[@index]
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    for i in 0...$game_troop.enemies.size
      @extra_arrows[i].update
    end
    # Set sprite coordinates
    # Set sprite coordinates
    if self.actor != nil
      self.x = self.actor.screen_x
      self.y = self.actor.screen_y
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    # Display actor status in help window
    @help_window.set_text("All Enemies", 1)
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #---------------------------------------------------------------------------
  def dispose
    super
    for i in 0...$game_troop.enemies.size
      @extra_arrows[i].dispose
    end
  end
end

#==============================================================================
# ** Arrow_Self
#------------------------------------------------------------------------------
#  This arrow cursor is used to show the actor selected.
#   This class inherits from the Arrow_Base class.
#==============================================================================
class Arrow_Self < Arrow_Base
  #--------------------------------------------------------------------------
  # * Object Initialization (Actor Arrow is flipped)
  #     viewport : viewport
  #--------------------------------------------------------------------------
  def initialize(viewport)
    super(viewport)
    #self.angle = 180
    update
  end
  #--------------------------------------------------------------------------
  # * Get Actor Indicated by Cursor
  #--------------------------------------------------------------------------
  def actor
    return $game_party.actors[@index]
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super    
    # Set sprite coordinates
    if self.actor != nil
      self.x = self.actor.screen_x
      self.y = self.actor.screen_y
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    # Display actor status in help window
    @help_window.set_actor(self.actor)
  end
end

#==============================================================================
# ** Arrow_Actor
#------------------------------------------------------------------------------
#  This arrow cursor is used to choose an actor. This class inherits from the
#  Arrow_Base class.
#==============================================================================
class Arrow_All_Actors < Arrow_Base
  #--------------------------------------------------------------------------
  # * Object Initialization (Actor Arrow is flipped)
  #     viewport : viewport
  #--------------------------------------------------------------------------
  def initialize(viewport)
    @extra_arrows = []
    for i in 0...$game_party.actors.size
      @extra_arrows[i] = Arrow_Self.new(viewport)
      @extra_arrows[i].index = i
    end
    super(viewport)
    #self.angle = 180
    update
  end
  #--------------------------------------------------------------------------
  # * Get Actor Indicated by Cursor
  #--------------------------------------------------------------------------
  def actor
    return $game_party.actors[@index]
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    for i in 0...$game_party.actors.size
      @extra_arrows[i].update
    end
    # Set sprite coordinates
    if self.actor != nil
      self.x = self.actor.screen_x
      self.y = self.actor.screen_y
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    # Display actor status in help window
    @help_window.set_text("All Allies", 1)
  end
  #----------------------------------------------------------------------------
  # * Dispose
  #----------------------------------------------------------------------------
  def dispose
    super
    for i in 0...$game_party.actors.size
      @extra_arrows[i].dispose
    end
  end
end


Instructions

Make a new script anywhere below 'Scene_Battle 3' (but above 'Main'). Do note that this script overwrites the methods 'update_phase3_skill_select' and 'update_phase3_item_select' so if you have any other scripts that modify those, you'll have to merge. I can assist with merging if you ask in this thread.


Credits and Thanks

Thanks to DerVVulfman and every other Save-Point scripter, for posting tons of scripts for me to study and learn how to make my own.


Author's Notes

This script was the third piece of code I wrote for my RPG Maker XP project. The lack of consistency between different skill targets bothered me, mostly because I have twitchy fingers and half the targeting options didn't have that confirmation "this is who the spell hits" display.

If anyone has a different idea for how the 'None' skill target should be displayed, let me know. Right now it shows targeting as if it was a "The User" skill.


Terms and Conditions

Free for Commercial and Non-Commercial use, but this is a semi-exclusive script and so if you post it anywhere you must include a link to this thread, and mention you got it from Save-Point.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Up/Down Key Targetting ParaDog 0 4,393 03-04-2008, 05:12 AM
Last Post: ParaDog
   Advanced Targetting Trickster 0 5,867 03-01-2008, 04:56 AM
Last Post: Trickster



Users browsing this thread: 1 Guest(s)