Author Topic: [XP] Target Anyone  (Read 6302 times)

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3043
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
[XP] Target Anyone
« on: December 09, 2012, 09:21:35 AM »
Target Anyone
Authors: KK20
Version: 1.02
Type: Unique Skills
Key Term: Battle Add-on

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 or cast Fire on a monster or one of your allies.

Yes, you can make enemies undead and attack them with Heal. Likewise, you can create armor that absorbs fire and cast Fire on your allies.

Features

  • Player can choose to attack an enemy or an ally with skills that target One Actor/One Enemy
  • ...that’s pretty much it.

Screenshots

None--Can’t really screenshot this.

Demo

None

Script

Below the default scripts and above Main.
If wishing to test for compatibility with another battle system, place this below it.
(click to show/hide)

Instructions

It should all be there in the script, right near the beginning of it.
To change scopes/target, use the UP and DOWN arrow keys.

Compatibility

Made with the default battle system in mind. Probably won’t work with custom battle systems.
Not tested with SDK.
Modifies methods in Game_Battler, Game_Actor, and Scene_Battle.

Credits and Thanks

  • KK20 - Creator
  • Charlie Fleed – For the idea on how to implement this
  • Heretic86 – Requesting, fixing a couple of bugs, and encouraging me to database it

Author's Notes

Note that this only works for actors and not for enemies. In other words, the enemy is not programmed to heal your allies or attack its troop.
« Last Edit: September 08, 2013, 02:18:00 AM by KK20 »



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 741
  • LV: 29
    • View Profile
Re: [XP] Target Anyone
« Reply #1 on: December 09, 2012, 10:18:23 AM »
I have to point out how this script can be quite useful.

One idea I had was to use this script in conjunction with Blizzards Reflect Spell.  Make an Boss Enemy that constantly casts very strong heals on itself.  Use this script to cast Reflect on the Enemy instead of the Party.  This very powerful Boss Enemy will be powerless if all of its efforts to heal itself only heal the party!

I have tried it, and it works just fine.

Another idea I had was to use Healing Items and Spells to Harm Undead.  Since Undead are, well, Undead, Heals have the Opposite Effect!  That works too, but I'll have to do some work to show how that is done.

Level Up!
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.)

Offline Diamond Star

  • Trained Member
  • *
  • Posts: 45
  • LV: 0
  • Gender: Male
    • View Profile
Re: [XP] Target Anyone
« Reply #2 on: December 10, 2012, 12:26:47 AM »
This small script seems good and add nice feature to the battles.
it would give me good ideas for my project.
Level Up my FRIEND KK20 !
I have many dreams and look for who understand me and help me to achieve them

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 741
  • LV: 29
    • View Profile
Re: [XP] Target Anyone
« Reply #3 on: December 10, 2012, 10:48:14 AM »
Minor bug.

decide_random_target_for_actor / enemy needs to match scope assigned by player.  Otherwise, target an enemy with a friendly spell, and if the enemy is dead, it targets the party.
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.)

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3043
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] Target Anyone
« Reply #4 on: December 11, 2012, 05:22:42 AM »
Not sure by what you mean. Give me an example of what happened.



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 741
  • LV: 29
    • View Profile
Re: [XP] Target Anyone
« Reply #5 on: December 11, 2012, 09:05:38 AM »
This happens during Scope Change.

Set an actor to use an item or spell on an enemy that normally defaults to the Actors.  Then kill that enemy before the spell is cast, and it will default back to Actors, not enemies.

Likewise with enemies (using Blizz's reflect spell to bounce effects), select Fire, target an Actor (with reflect)with Fire (because Enemy has Reflect also, and Fire defaults to Enemies), and spell targets Enemies by default if that Actor dies before the spell is cast. 

IE, when the Target is killed prior to spell / item usage, a random target will be selected, but that random target is always the Original Scope (actors or enemies), not the Changed Scope.  What I am suggesting is that if you try to cast Fire, change scope to cast on an Ally, then the Ally is killed, the randomly selected target should be the same scope, which, in this case would have Fire cast on a randomly selected Ally due to the scope change.

Does that make more sense?
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.)

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3043
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] Target Anyone
« Reply #6 on: December 11, 2012, 10:12:23 AM »
At first I was like "Uh...no, it's attacking another enemy..." but it wasn't until I went into another battle that I saw the problem: Reset the @changed_scope variable back to false at the end of the battle.

Fixed and updated.



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 741
  • LV: 29
    • View Profile
Re: [XP] Target Anyone
« Reply #7 on: December 14, 2012, 07:40:53 AM »
One of the reasons I pushed for this script to get put in the Database was so I could do this:

Early Version (so ignore 1.0), I suspect there are a couple of bugs, but basically it allows Healing and Resurrection to be treated as Elemental Effects.  It took some extra work to allow for Elemental Resistances by inverting the effects on Undead.  So now casting Heal on an Undead does Damage.  Casting Resurrect on an Undead can cause Instant Death.  I always thought this was a cool effect in old Final Fantasy games.

(click to show/hide)

One more thing to request for the Target Anyone script.  Is there any chance to allow for Target Any Items or Spells with All Allies or All Enemeies to allow selecting a Target Side?  The pain I think would be to have the Target Arrow point to All Enemies or All Allies...
« Last Edit: December 14, 2012, 09:58:30 AM by Heretic86 »
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.)

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3043
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] Target Anyone
« Reply #8 on: December 15, 2012, 02:35:17 AM »
I actually did contemplate something like that before. By RMXP default, whenever you use a skill that targets an entire party/troop, it entirely skips the actor/enemy selection (for obvious reasons). Thus, I'd have to create another phase in the Scene_Battle that mimics this selection process.

I've seen some scripts do this already (in fact, I believe this script already exists in Charliee Fleed's CBS), but I guess I can make an add-on to this.

The whole "healing undead to deal damage" part of your script is unneccessary as I can recreate that easily already. But the "revival deals instant death on undead" is much more interesting.



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 741
  • LV: 29
    • View Profile
Re: [XP] Target Anyone
« Reply #9 on: December 15, 2012, 04:32:14 AM »
I actually did contemplate something like that before. By RMXP default, whenever you use a skill that targets an entire party/troop, it entirely skips the actor/enemy selection (for obvious reasons). Thus, I'd have to create another phase in the Scene_Battle that mimics this selection process.

I've seen some scripts do this already (in fact, I believe this script already exists in Charliee Fleed's CBS), but I guess I can make an add-on to this.

The whole "healing undead to deal damage" part of your script is unneccessary as I can recreate that easily already. But the "revival deals instant death on undead" is much more interesting.

Okay, how else would you do it?  I figure you might come up with something better...

The intent I had was to allow Elemental Defense against Healing as an Element.  That means Rank A does Max Dmg, but Ranks B thru D also still do damage.  The "normal" way would normally just heal an Undead with Ranks A thru D, nada on E, and F would do Damage.  Thus, it would not allow varying degrees of effectiveness.  Also, States that provide Elemental Defense against Healing as an Element can cause more variations in the outcome.  I am curious how else this could be accomplished differently, as what I came up with is definitely far too limiting in regards to scripting for specific elements.

(click to show/hide)

I dont know if you'll like it because it flashes the arrow over each Actor / Enemy.
« Last Edit: December 15, 2012, 05:44:37 AM by Heretic86 »
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.)

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3043
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] Target Anyone
« Reply #10 on: December 15, 2012, 08:36:17 AM »
Quote
The intent I had was to allow Elemental Defense against Healing as an Element.  That means Rank A does Max Dmg, but Ranks B thru D also still do damage.  The "normal" way would normally just heal an Undead with Ranks A thru D, nada on E, and F would do Damage.  Thus, it would not allow varying degrees of effectiveness.
Since you put it that way...Traditionally, there aren't levels of effectiveness for undead being healed, but I guess some people would want that. Alright, go ahead with the script.

Played around a bit and this is what I got:
(click to show/hide)
I went ahead and turned the arrows invisible just to see what it looks like. Made me think of just drawing arrows over all the party/troop members.



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 741
  • LV: 29
    • View Profile
Re: [XP] Target Anyone
« Reply #11 on: December 15, 2012, 03:15:57 PM »
Seems to work quite well!

Only thing I see that could be changed is Asthetics.  In def start_select_all(scope) I added @enemy and @actor_arrow.visible = false  That takes care of that initial flash of the arrow before it disappears.
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.)

Offline ArcaneAlchemy

  • Awakened Visionist
  • **
  • Posts: 97
  • LV: 6
  • Gender: Male
    • View Profile
Re: [XP] Target Anyone
« Reply #12 on: January 18, 2013, 12:13:12 PM »
Hey, I noticed that this script was unable to attack party members with a physical attack. So, I modified it so that it can. It is not necessary to add the "Target Any" element to a weapon or anything, this is global for the basic attack.

Code: [Select]
=begin
===============================================================================
Target Anyone Scope
Version 1.01
12/11/12
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
Heretic86 - Requesting and bug fixing/finding
===============================================================================
=end

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

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

#===============#
# 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
 
  def clear
    super
    @changed_scope = false
    @target_type = nil
  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.physical_attack_my_party = true #ADDED STUFF
################################################################################
        @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
      @active_battler.changed_scope = false     
      @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
      @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.physical_attack_my_party = false #ADDED STUFF
################################################################################
        @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
      @active_battler.changed_scope = false     
      @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
  #--------------------------------------------------------------------------
  # * Battle Ends
  #     result : results (0:win 1:lose 2:escape)
  #--------------------------------------------------------------------------
  alias reset_changed_scopes battle_end
  def battle_end(result)
    # Reset all the actors' changed_scope variable
    for actor in $game_party.actors
      actor.changed_scope = false
    end
    # Call alias
    reset_changed_scopes(result)
  end
end




################################################################################
        # MORE ADDED BELOW
################################################################################
class Game_Battler
 
  alias add_stuff_initialize initialize
 
  def initialize
  add_stuff_initialize
 
  @physical_attack_my_party = false
  end
  attr_accessor :physical_attack_my_party
 
  def physical_attack_my_party
    return @physical_attack_my_party
    #switch that will decide whether a party member or an enemy party member
    #should be the one receiving the damage.
  end
 
end

################################################################################
################################################################################

class Scene_Battle
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
  def update_phase3_basic_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Go to command input for previous actor
      phase3_prior_actor
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by actor command window cursor position
      case @actor_command_window.index
      when 0  # attack
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 0
        # Start enemy selection
##############################################################
        @any_target = true
##############################################################
        start_enemy_select
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.kind = 1
        # Start skill selection
        start_skill_select
      when 2  # guard
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 1
        # Go to command input for next actor
        phase3_next_actor
      when 3  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Set action
        @active_battler.current_action.kind = 2
        # Start item selection
        start_item_select
      end
      return
    end
  end
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
 
  #--------------------------------------------------------------------------
  # * Make Basic Action Results
  #--------------------------------------------------------------------------
  def make_basic_action_result
    # If attack
    if @active_battler.current_action.basic == 0
      # Set anaimation ID
      @animation1_id = @active_battler.animation1_id
      @animation2_id = @active_battler.animation2_id
      # If action battler is enemy
      if @active_battler.is_a?(Game_Enemy)
        if @active_battler.restriction == 3
          target = $game_troop.random_target_enemy
        elsif @active_battler.restriction == 2
          target = $game_party.random_target_actor
        else
          index = @active_battler.current_action.target_index
          target = $game_party.smooth_target_actor(index)
        end
      end
      # If action battler is actor
      if @active_battler.is_a?(Game_Actor)
        if @active_battler.restriction == 3
          target = $game_party.random_target_actor
        elsif @active_battler.restriction == 2
          target = $game_troop.random_target_enemy
################################################################################
#------------------------------------------------------------------------------
#                       Physical Target Selection
#------------------------------------------------------------------------------
        elsif @active_battler.physical_attack_my_party == true
        index = @active_battler.current_action.target_index
        target = $game_party.smooth_target_actor(index)
       
        @active_battler.physical_attack_my_party = false
################################################################################
        else
          index = @active_battler.current_action.target_index
          target = $game_troop.smooth_target_enemy(index)
        end
      end
      # Set array of targeted battlers
      @target_battlers = [target]
      # Apply normal attack results
      for target in @target_battlers
        target.attack_effect(@active_battler)
      end
      return
    end
    # If guard
    if @active_battler.current_action.basic == 1
      # Display "Guard" in help window
      @help_window.set_text($data_system.words.guard, 1)
      return
    end
    # If escape
    if @active_battler.is_a?(Game_Enemy) and
       @active_battler.current_action.basic == 2
      # Display "Escape" in help window
      @help_window.set_text("Escape", 1)
      # Escape
      @active_battler.escape
      return
    end
    # If doing nothing
    if @active_battler.current_action.basic == 3
      # Clear battler being forced into action
      $game_temp.forcing_battler = nil
      # Shift to step 1
      @phase4_step = 1
      return
    end
  end
 
 
end #end Scent_Battle class
"Wait? Do I look like a waiter?" -Kefka

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3043
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] Target Anyone
« Reply #13 on: January 18, 2013, 02:15:14 PM »
It was originally intended for skills, but I guess that makes sense to do that too. I should update this script again with the Target All Enemies/Allies toggle and add your snippet too. ;)

But literally leaving for work in 5 minutes. brb



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Offline ArcaneAlchemy

  • Awakened Visionist
  • **
  • Posts: 97
  • LV: 6
  • Gender: Male
    • View Profile
Re: [XP] Target Anyone
« Reply #14 on: January 18, 2013, 05:58:24 PM »
Yeah, I didn't really bother being clean about it so sorry if it's messy, but you get the idea. I did notice that your script is compatible with the Tanketai script but my addition is not :( If I figure out a way to make it more universally compatible I'll let you know or maybe you'll just figure it out :)
« Last Edit: January 19, 2013, 02:07:21 PM by ArcaneAlchemy »
"Wait? Do I look like a waiter?" -Kefka

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 741
  • LV: 29
    • View Profile
Re: [XP] Target Anyone
« Reply #15 on: September 04, 2013, 02:49:06 AM »
BUGFIX

Minor bug in the code in Game_Battler Elements Correct
(click to show/hide)

I came across this using Basil's Leg Sweep.  In the Database, I set it to be able to Target Anyone, but it has no other associated Elements.  Normally that would be considered to be an Empty Element Set which would return 100, but since Target Anyone was applied, the ELement Set is not considered Empty, and weakest is set to -100, not 100, which caused Basil's Leg Sweep to actually have the Opposite Effect.  I changed it around so the Element Rate for Target Any would be set to 100 to prevent -100 from ever seeing the light of day.

Cant really consider this a Necropost, although the thread is old, it is a bugfix for an existing bug that was a pain to discover and may still plauge other users of this script.
« Last Edit: September 08, 2013, 12:54:12 AM by Heretic86 »
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.)

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 741
  • LV: 29
    • View Profile
Re: [XP] Target Anyone
« Reply #16 on: September 04, 2013, 05:06:58 AM »
Okay, fix #1 didnt work.  It caused ELements that would normally be absorbed to be treated as Hits.  I changed around the bugfix so that the element_id is removed from the element_set argument before going further.
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.)

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3043
  • LV: 372
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: [XP] Target Anyone
« Reply #17 on: September 04, 2013, 10:10:00 PM »
Duly noted and fixed in main post. Thanks~

(click to show/hide)



Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!


NNID: KK20-CP
Discord: KK20 Tyler#8901
Join the CP Discord Server

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 741
  • LV: 29
    • View Profile
Re: [XP] Target Anyone
« Reply #18 on: September 08, 2013, 12:59:52 AM »
I screwed up again.  Okay, third time is a charm.

element_set returns Reference to $data

Need to add this as the first line of def elements_correct:
Code: [Select]
# Important! - Remove direct access to $data so $data is not altered
element_set = element_set.clone

Since the code I altered deletes info from the element_set, being that it passes by Reference not Value, it causes the $data variable to be edited, not just the argument passed.  What happens is you'll end up being able to use an Item or Skill just once after switching from Enemy to Actors or Actors to Enemy, but the next time you try to use that same Item or Skill, you wont be able to switch from Actors to Enemies and vice versa.

This was a pain to figure out.  My fault.  Sorry for the inconvenience.
« Last Edit: September 08, 2013, 01:01:06 AM by Heretic86 »
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.)