Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Target All Enemies 1.11 (Updated on 03/22/11!)

Target All Enemies Version: 1.11
By: Glitchfinder and theory


Introduction

Target All Enemies is a simple, easy to use script snippet that allows game designers to create weapons that automatically attack all enemies in a battle, rather than just a single enemy.

Features
  • Easy to use!
  • Simple setup!
  • Create weapons that target all enemies!

Screenshots

Since this script has no visual elements, a screenshot cannot be taken.

Script

Code:
#≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

# ** Glitchfinder and theory's Target All Enemies DBS Addon      [RPG Maker XP]

#    Version 1.11

#------------------------------------------------------------------------------

#  This add-on enables Target All type weapons.

#==============================================================================

# * Version History

#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#   Version 1.00 ------------------------------------------------- (2009-05-29)

#     - Initial version

#     - Authors: theory and Glitchfinder

#    Version 1.10 ------------------------------------------------ (2011-03-16)

#      - Fixed crash on F12

#      - Removed forgotten print test

#      - Author: Glitchfinder

#     Version 1.11 ----------------------------------------------- (2011-03-22)

#       - Fixed crash when an actor with no weapon attacked

#       - Author: Glitchfinder

#==============================================================================

# * Instructions

#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#  Place this script above Main, and below the default scripts. (I realize this

#  is obvious to most, but some people don't get it.)

#

#  To use this script, simply create an element named "Target All" (without the

#  quotes), and add it to the weapons that you want to use this feature.

#==============================================================================

# *Glitchfinder's Advice

#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#  This script is plug 'n play. Simply insert in the proper location, and

#  any weapon that has a specifically named element will target all enemies.

#==============================================================================

# * Contact

#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#  Glitchfinder, the author of this script, may be contacted through his

#  website, found at [url=http://www.glitchkey.com]http://www.glitchkey.com[/url]

#

#  You may also find Glitchfinder at [url=http://www.hbgames.org]http://www.hbgames.org[/url]

#==============================================================================

# * Usage

#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#  This script may be used with the following terms and conditions:

#

#    1. This script is free to use in any noncommercial project. If you wish to

#       use this script in a commercial (paid) project, please contact

#       Glitchfinder at his website.

#    2. This script may only be hosted at the following domains:

#         [url=http://www.glitchkey.com]http://www.glitchkey.com[/url]

#         [url=http://www.hbgames.org]http://www.hbgames.org[/url]

#    3. If you wish to host this script elsewhere, please contact Glitchfinder

#       or theory.

#    4. If you wish to translate this script, please contact Glitchfinder or

#       or theory. They will need the web address that you plan to host the

#       script at, as well as the language this script is being translated to.

#    5. This header must remain intact at all times.

#    6. Glitchfinder and theory remain the sole owners of this code. They may

#       modify or revoke this license at any time, for any reason.

#    7. Any code derived from code within this script is owned by Glitchfinder

#       and theory, and you must have their permission to publish, host, or

#       distribute their code.

#    8. This license applies to all code derived from the code within this

#       script.

#    9. If you use this script within your project, you must include visible

#       credit to Glitchfinder and theory, within reason.

#≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

 

#==============================================================================

# ** Scene_Battle

#------------------------------------------------------------------------------

#  This class performs battle screen processing.

#==============================================================================

class Scene_Battle

  #--------------------------------------------------------------------------

  # * Alias Methods

  #--------------------------------------------------------------------------

  # If enemy selection method has not been aliased

  unless method_defined?(:targetall_enemy_select)

    # Alias the enemy selection method

    alias targetall_enemy_select start_enemy_select

  end

  #--------------------------------------------------------------------------

  # * Start Enemy Selection

  #--------------------------------------------------------------------------

  def start_enemy_select

    # Call original method

    targetall_enemy_select

    # Return if thr actor has no weapon equipped

    return unless (nil != $data_weapons[@active_battler.weapon_id])

    # Get current weapon's elements

    element_set = $data_weapons[@active_battler.weapon_id].element_set

    # Set up element name array

    element_names = []

    # Add the current weapon's element names to the element name array

    element_set.each {|i| element_names.push($data_system.elements[i])}

    # If the current weapon targets all

    if element_names.include?('Target All')

      # End enemy selection

      end_enemy_select

      # Set action

      @active_battler.current_action.basic = 128

      # Go to command input for next actor

      phase3_next_actor

    end

  end

  # If basic action result method has not been aliased

  unless method_defined?(:targetall_action)

    # Alias the basic action result method

    alias targetall_action make_basic_action_result

  end

  #--------------------------------------------------------------------------

  # * Make Basic Action Result

  #--------------------------------------------------------------------------

  def make_basic_action_result

    # If the current actor's weapon does not target all

    if @active_battler.current_action.basic != 128

      # Call the original method

      targetall_action

    else

      # Set animation ID

      @animation1_id = @active_battler.animation1_id

      @animation2_id = @active_battler.animation2_id

      # check restrictions and set targets

      @target_battlers = []

      # If attacking allies

      if @active_battler.restriction == 3

        # Attack all allies

        set_target_battlers(4)

      # If attacking enemies

      else

        # Attack all enemies

        set_target_battlers(2)

      end

      # Apply normal attack results

      for target in @target_battlers

        target.attack_effect(@active_battler)

      end

    end

  end

end

Instructions

Place this script above Main, and below the default scripts. (I realize this is obvious to most, but some people don't get it.)

To use this script, simply create an element named "Target All" (without the quotes), and add it to the weapons that you want to use this feature.

Terms and Conditions

  • This script is free to use in any noncommercial project. If you wish to use this script in a commercial (paid) project, please contact Glitchfinder at his website.
  • This script may only be hosted at the following domains:
    http://www.glitchkey.com
    http://www.hbgames.org
  • If you wish to host this script elsewhere, please contact Glitchfinder or theory.
  • If you wish to translate this script, please contact Glitchfinder or theory. They will need the web address that you plan to host the script at, as well as the language this script is being translated to.
  • The script header must remain intact at all times.
  • Glitchfinder and theory remain the sole owners of this code. They may modify or revoke this license at any time, for any reason.
  • Any code derived from code within this script is owned by Glitchfinder and theory, and you must have their permission to publish, host, or distribute their code.
  • This license applies to all code derived from the code within this script.
  • If you use this script within your project, you must include visible credit to Glitchfinder and theory, within reason.
 
As I just said over MSN: A great, simple, and very compatible script that's well documented as well :p Definately the way to go for whoever needs anything like it!
 
Thalesrar":19hwd66i said:
Even though that line 85 bugs :/

'' Target All 85, NoMethodError
undefined method ''Element_Set'' for Nil:Nilclass

I just double-checked and fixed the bug. It appears to be because your actor has no weapons equipped. (Which makes absolutely no sense with RMXP's finicky stat system. They'd be unable to do any damage, for the most part) Anyway, just try out the new version, and it should work.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top