RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Target-All Weapon Elements

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Target-All Weapon Elements
Version: 1.0
Author: modern algebra
Date: May 29, 2009

Version History


  • <Version 1.0> 05.29.2009 - Original Release

Description


This script allows you to assign a target-all property to weapons that makes those weapons target all opponents. It can also be set as a property to enemies.

Features

  • Allows you to make weapons that target all enemies
  • Allows you to make enemies whose regular attack targets all actors
  • Can set multiple elements to have the target-all property
  • Easy element configuration

Screenshots



Instructions

Place above Main and below other default scripts

Please see the header of the script for setup details

Script


Code: [Select]
#==============================================================================
#  Target-All Weapon Element
#  Version 1.0
#  Author: modern algebra
#  Date: May 29, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#  
#    This script allows you to assign a target-all property to weapons that
#   makes those weapons target all opponents. It can also be set as a property
#   to enemies.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script above Main and below all other default scripts.
#
#    To set the IDs of what elements grant this property to weapons, go down to
#   line 35 and alter the array to include the IDs of the elements that you
#   want to grant the target-all property. Thus:
#
#     MA_TARGETALL_ELEMENTS = [12, 13, 17]
#
#   means that weapons with elements 12, 13, or 17 will target all opponents.
#
#    For weapons to have this property, merely give them one of the elements
#   you set in that array. For enemies to be given this property, just change
#   any of those element ranks to something other than C and their attack will
#   target all.
#==============================================================================

#==============================================================================
# ** Global Constant
#==============================================================================

MA_TARGETALL_ELEMENTS = [17]

#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - ma_weapon_target_all?
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Weapon Target All?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def ma_weapon_target_all?
    weapon = $data_weapons[@weapon_id]
    # If no weapon, return false
    return false if weapon == nil
    # Return true if
    MA_TARGETALL_ELEMENTS.each { |element_id|
      return true if weapon.element_set.include? (element_id)
    }
    return false
  end
end

#==============================================================================
# ** Game_Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - ma_weapon_target_all?
#    aliased method - element_rate
#==============================================================================

class Game_Enemy
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Element Rate
  #    element_id : the ID of the element being checked
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maga_targtallelmnt_elmntrate_74b5 element_rate
  def element_rate (element_id, *args)
    # Nullify Target-All element bonuses
    return 100 if MA_TARGETALL_ELEMENTS.include? (element_id)
    # Run Original Method
    return maga_targtallelmnt_elmntrate_74b5 (element_id, *args)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Weapon Target All?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def ma_weapon_target_all?
    # CHeck Element Ranks
    MA_TARGETALL_ELEMENTS.each { |element_id|
      # If not C, return true
      return true if element_rate (element_id) != 100
    }
    return false
  end
end

#==============================================================================
# ** Scene Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - start_enemy_select
#==============================================================================

class Scene_Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start Enemy Select
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modernalg_strt_emy_slct_trgtall_84b56 start_enemy_select
  def start_enemy_select (*args)
    if @active_battler.current_action.kind == 0 &&
          @active_battler.current_action.basic == 0 &&
          @active_battler.ma_weapon_target_all?
      phase3_next_actor
      return
    end
    # Run Original Method
    modernalg_strt_emy_slct_trgtall_84b56 (*args)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Make Basic Action Results
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mdrnalgbra_mkbsc_actrslt_trgtall_73b5 make_basic_action_result
  def make_basic_action_result (*args)
    # Run Original Method
    mdrnalgbra_mkbsc_actrslt_trgtall_73b5 (*args)
    # If attack
    if @active_battler.current_action.basic == 0 && @active_battler.ma_weapon_target_all?
      targets = []
      # If action battler is enemy
      if @active_battler.is_a?(Game_Enemy)
        for actor in $game_party.actors
          targets.push (actor) if actor.exist?
        end
      end
      # If action battler is actor
      if @active_battler.is_a?(Game_Actor)
        for enemy in $game_troop.enemies
          targets.push (enemy) if enemy.exist?
        end
      end
      # Set array of targeted battlers
      targets.each { |target|
        next if @target_battlers.include? (target)
        target.attack_effect(@active_battler)
      }
      # Get the intersection of actors
      @target_battlers |= targets
    end
  end
end

Credit


  • modern algebra

Thanks

  • GreenBanana, for the request

Support


Please post in this topic for the swiftest response

Known Compatibility Issues

Obviously won't work with exotic battle systems

« Last Edit: May 29, 2009, 03:23:53 AM by modern algebra »