03-09-2015, 07:52 PM
You can use bearcat's Absorb, Null, and Weak Armors script. Despite the name, it can also create states that absorb and nullify elements.
These two scripts are also necessary.
Code:
=begin
#=============================================================================
# Absorb, Null, and Weak Armors
#=============================================================================
# Bearcat
# Version 1.01
# 8.16.07
#=============================================================================
This script allows you to make armors and states that absorb, nullify, or
make the wearer weak to elemental damage. To set up an an armor or state,
put the armor id and the element id in the appropriate hash in Absorb_Setup.
There is no need to modify anything other than the hashes in Absorb_Setup.
Free use, modification, and distribution permitted (commercial projects
included) so long as credit is given to me, Bearcat.
==============================================================================
=end
module Absorb_Setup
#--------------------------------------------------------------------------
# * Absorb Armors
# syntax armor_id => [element1, element2...]
#--------------------------------------------------------------------------
Absorb_Armors = {
33 => [1]
}
#--------------------------------------------------------------------------
# * Null Armors
# syntax armor_id => [element1, element2...]
#--------------------------------------------------------------------------
Null_Armors = {
33 => [2]
}
#--------------------------------------------------------------------------
# * Weak Armors
# syntax armor_id => [element1, element2...]
#--------------------------------------------------------------------------
Weak_Armors = {
33 => [3]
}
#--------------------------------------------------------------------------
# * Absorb States
# syntax state_id => [element1, element2...]
#--------------------------------------------------------------------------
Absorb_States = {
17 => [1]
}
#--------------------------------------------------------------------------
# * Null States
# syntax state_id => [element1, element2...]
#--------------------------------------------------------------------------
Null_States = {
17 => [2]
}
#--------------------------------------------------------------------------
# * Weak States
# syntax state_id => [element1, element2...]
#--------------------------------------------------------------------------
Weak_States = {
17 => [3]
}
#--------------------------------------------------------------------------
# * Defaults DO NOT CHANGE
#--------------------------------------------------------------------------
Absorb_Armors.default = []
Null_Armors.default = []
Weak_Armors.default = []
Absorb_States.default = []
Null_States.default = []
Weak_States.default = []
end
These two scripts are also necessary.
Code:
class Game_Actor
def element_rate(element_id)
absorb_flag = false
# Get values corresponding to element effectiveness
table = [0,200,150,100,50,0,-100]
result = table[$data_classes[@class_id].element_ranks[element_id]]
# Run Armor Stuff
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
# Halve damage if element is protected
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
# Damage = 0 if element is nulled
if armor != nil and armor.null_element_set.include?(element_id)
result = 0
end
# Set flag to true if element is absorbed
if armor != nil and armor.absorb_element_set.include?(element_id)
absorb_flag = true
end
# Multiply damage if armor is weak to element
if armor != nil and armor.weak_element_set.include?(element_id)
result *= 2
end
end
# Run State Stuff
for i in @states
# Halve damage if element is protected
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
# Damage = 0 if element is nulled
if $data_states[i].null_element_set.include?(element_id)
result = 0
end
# Set flag to true if element is absorbed
if $data_states[i].absorb_element_set.include?(element_id)
absorb_flag = true
end
# Multiply damage if state is weak to element
if $data_states[i].weak_element_set.include?(element_id)
result *= 2
end
end
# If absorb_flag = true, multiply by -1
if absorb_flag
result *= -1
end
# End Method
return result
end
end
class Game_Enemy
def element_rate(element_id)
# Get a numerical value corresponding to element effectiveness
table = [0,200,150,100,50,0,-100]
result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
for i in @states
# Halve damage if element is protected
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
# Damage = 0 if element is nulled
if $data_states[i].null_element_set.include?(element_id)
result = 0
end
# Set flag to true if element is absorbed
if $data_states[i].absorb_element_set.include?(element_id)
absorb_flag = true
end
# Multiply damage if state is weak to element
if $data_states[i].weak_element_set.include?(element_id)
result *= 2
end
end
# If absorb_flag = true, multiply by -1
if absorb_flag
result *= -1
end
# End Method
return result
end
end
Code:
module RPG
class Armor
#------------------------------------------------------------------------------
# * Absorb Elements
#------------------------------------------------------------------------------
def absorb_element_set
return Absorb_Setup::Absorb_Armors[id]
end
#------------------------------------------------------------------------------
# * Null Elements
#------------------------------------------------------------------------------
def null_element_set
return Absorb_Setup::Null_Armors[id]
end
#------------------------------------------------------------------------------
# * Weak Elements
#------------------------------------------------------------------------------
def weak_element_set
return Absorb_Setup::Weak_Armors[id]
end
end
class State
#------------------------------------------------------------------------------
# * Absorb Elements
#------------------------------------------------------------------------------
def absorb_element_set
return Absorb_Setup::Absorb_States[id]
end
#------------------------------------------------------------------------------
# * Null Elements
#------------------------------------------------------------------------------
def null_element_set
return Absorb_Setup::Null_States[id]
end
#------------------------------------------------------------------------------
# * Weak Elements
#------------------------------------------------------------------------------
def weak_element_set
return Absorb_Setup::Weak_States[id]
end
end
end