XRXS No38: Element Limitation/Correction
#1
XRXS No38 - Element Correction
By Xiderowg
Site: (http://sboox.hp.infoseek.co.jp/xp/)

Introduction
This sciptlet configures the element_correct method in Game_Battler3, which affects the method in which the elemental multiplier is calculated and applied to the battler's damage, as well as limiting the element list in the database so that 'special elements' - ones that shouldn't affect the skill's damage, don't.

Screenshots
  • Level 99 Aluxes is using a skill that has the properties Fire and vs. Aquatic.
  • The Sahagin has a defense level of F (-100% DMG) against Fire and of A (200% DMG) against Aquatic.
  • Goes in order from method 0 to method 3 of calculation.

[Image: method0.png] [Image: method1.png] [Image: method2.png] [Image: method3.png]

Script
Code:
#==============================================================================
# XRXS No38. Element Limitation and Correction
#------------------------------------------------------------------------------
# Written by Xiderowg (http://sboox.hp.infoseek.co.jp/xp/)
#------------------------------------------------------------------------------
# * FUNCTION
#   Configures the element_correct method in Game_Battler3,
#   which affects the method in which the elemental multiplier
#   is calculated and applied to the battler's damage, as well
#   as limiting the element list in the database so that
#   'special elements' - ones that shouldn't affect the skill's
#   damage, don't.  
#
#==============================================================================
module XRXS38
  #=========================================================================
  # Establish Elements
  #-------------------------------------------------------------------------
  # Number of initial elements, eg. fire, ice, wind, water, etc. in the
  # database.  This counts from the first (usually fire) to the number
  # entered below.  In this case, only elements 1-16 are calculated.
  #=========================================================================
  ELEMENTS_NUMBER_LIMIT = 16
  #=========================================================================
  # Determine element correct method.
  #-------------------------------------------------------------------------
  # The Sahagin used in the example is weak against vsAquatic (200% dmg)
  # and absorbs Fire (-100% dmg).  
  #-------------------------------------------------------------------------
  # 0: ?STRONGEST (RGSS Default)
  #     Only the strongest element applies.
  #     EX:  Fire/vsAquatic vs. Sahagin => 200% dmg
  # 1:  MULTIPLICATION
  #     All elements are included in the calculation.
  #     EX:  Fire/vsAquatic vs. Sahagin => -200% dmg
  # 2:  AVERAGE
  #     Average power of elements are used in the calculation.
  #     EX:  Fire/vsAquatic vs. Sahagin => 50% dmg
  # 3:  WEAKEST
  #     Only the weakest element applies.
  #     EX:  Fire/vsAquatic vs. Sahagin => -100% dmg
  #=========================================================================
  ELEMENT_CORRECT_METHOD = 2
end

#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  # * Calculation + Element correction methods
  #--------------------------------------------------------------------------
  alias xrxs38_elements_correct elements_correct
  def elements_correct(element_set)
    # Initially duplicates
    elements = element_set.dup
    # Checks element restriction and if it exceeds the limit
    for element_id in element_set
      if element_id >XRXS38:: ELEMENTS_NUMBER_LIMIT
        elements.delete(element_id)
      end
    end
    # If it is not an element, return 100
    return 100 if elements.size == 0
    #
    case XRXS38::ELEMENT_CORRECT_METHOD
    when 0 # Strongest
      return xrxs38_elements_correct(elements)
    when 1 # Multiplication
      result = 100.0
      minus_enable = false
      for i in elements
        n = self.element_rate(i)
        minus_enable |= (n < 0)
        result *= n / 100.0
      end
      result = -1 * result.abs if minus_enable
      return result.to_i
    when 2 # Average
      rates = []
      result = 0
      for i in elements
        rates.push(self.element_rate(i))
      end
      for rate in rates
        result += rate
      end
      return result / rates.size
    when 3 # Weakest
      for i in elements
        n = self.element_rate(i)
        result = n if result.nil? or result > n
      end
      return result
    end
  end
end

Instructions
Insert below Scene_Debug, above Main.

Compatibility
Aliases elements_correct.
Compatible with just about everything.

Terms and Conditions

Xiderwog Wrote:These scripts are for RPG Maker XP. Permission is not required to use them in your game.
Reply }
#2
Well... this beat's RPG Advocate's Elemental Damage Fix script thanks to the ability to set preferences.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   ACBS FIX SCRIPT #2: Advanced Cry Correction DerVVulfman 1 4,780 08-09-2019, 03:42 PM
Last Post: aeliath
   Element Absorbing Armor Bearcat 5 13,666 04-25-2013, 01:08 AM
Last Post: Metalknight
   ProjectMeLT XRXS - 5-6 Character Menu JackMonty 0 5,621 04-16-2013, 02:41 PM
Last Post: JackMonty
   XRXS' Platformer XRXS 4 10,950 05-30-2011, 05:57 PM
Last Post: xnadvance
   XRXS No114: Manage Battle Speed Helel 0 6,148 12-07-2009, 09:18 AM
Last Post: Helel
   XRXS's Full-View Battleback & Movable Camera XRXS 0 5,773 06-10-2009, 03:30 AM
Last Post: XRXS



Users browsing this thread: 1 Guest(s)