Element Efficiency States
Version: 1.0b
Author: modern algebra
Date: August 20, 2010
Version History
- <Version 1.0b> 08.20.2010 - fixed a bug when it applied to enemies.
- <Version 1.0> 05.15.2010 - Original Release
Description
By default, a state can only be setup to halve the damage done by an elemental attack of any nature. This script allows you to create states which can modify the damage done by any percentage you choose. Want to create a state which completely nullifies all damage from a fire attack? This script can do that. Want to create a state which makes attacks from a particular element heal instead of damage? That can be done too.
Features
- Allows you to make states that have more profound effects on the efficiency of elemental attacks; for instance you can make states that will convert damage from an element to healing.
- Easy configuration
Instructions
Paste this script into its own slot in the Script Editor (F11) somewhere above Main but below Materials. Please see the header of the script for details on configuring the script.
Script
#==============================================================================
# Element Efficiency States
# Version: 1.0b
# Author: modern algebra (rmrk.net)
# Date: August 20, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# By default, a state can only be setup to halve the damage done by an
# elemental attack of any nature. This script allows you to create states
# which can modify the damage done by any percentage you choose. Want to
# create a state which completely nullifies all damage from a fire attack?
# This script can do that. Want to create a state which makes attacks from
# a particular element heal instead of damage? That can be done too.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Paste this script into its own slot in the Script Editor (F11) somewhere
# above Main but below Materials.
#
# To set a state to have a particular element efficiency, you have to use
# the following code in a note box:
# \ELEMENT_EFFICIENCY[element_id, element_efficiency]
# element_id : the ID of the element to modify damage from
# element_efficiency : the efficiency of the element when this state is
# applied. This can be either A-F (corresponding to the normal table
# for element efficiencies), or you can set it as a direct percentage
# by putting an integer there for the total percentage (100 = 1xdamage;
# 200 = 2x damage; etc...)
# You can put as many of these codes in the notebox of the same state.
#
# EXAMPLE:
# \element_efficiency[9, E]
# \ELEMENT_EfficIENCY[10, 250]
#
# A state with that in the notebox, when applied, would make the battler
# immune to element 9 attacks (Fire), but element 10 attacks (Ice) would do
# 2.5x damage.
#==============================================================================
# ** RPG::State
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - ees_element_efficiency
#==============================================================================
class RPG::State
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Element Efficiency
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ees_element_efficiency
if !@ees_element_efficiency
@ees_element_efficiency = {}
@ees_element_efficiency.default = 100
note.gsub (/\\ELEMENT_EFFICIENCY\[(\d+),\s*([A-F]?)(-?\d*)\]/i) {
if $2.empty?
@ees_element_efficiency[$1.to_i] = $3.to_i
else
rank = ["A", "B", "C", "D", "E", "F"].index ($2.to_s.upcase)
@ees_element_efficiency[$1.to_i] = [200,150,100,50,0,-100][rank]
end
}
end
return @ees_element_efficiency
end
end
#==============================================================================
# ** Game Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - element_rate
#==============================================================================
class Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Element Efficiency
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mod_mord_ees_elrte_6yh2 element_rate
def element_rate (element_id, *args)
rate = mod_mord_ees_elrte_6yh2 (element_id, *args) # Run Original Method
for state in states
rate *= -1 if state.ees_element_efficiency[element_id] < 0 && rate < 0
rate *= (state.ees_element_efficiency[element_id].to_f / 100.0)
end
return rate.to_i
end
end
#==============================================================================
# ** Game Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - element_rate
#==============================================================================
class Game_Enemy
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Element Efficiency
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modrn_con_ees_mentr_4wc2 element_rate
def element_rate (element_id, *args)
rate = modrn_con_ees_mentr_4wc2 (element_id, *args)
for state in states
rate *= -1 if state.ees_element_efficiency[element_id] < 0 && rate < 0
rate *= (state.ees_element_efficiency[element_id].to_f / 100.0)
end
return rate.to_i
end
end
Credit
Thanks
- mordicon, for the request
Support
Please post in this topic at RMRK.net for support.
Known Compatibility Issues
No currently known compatibility problems.