Data File Save - Change database parameters mid-game

I shall warn this will be a long presentation, this system has a lot going on, and in fact I'll divide it into multiple posts. That's because it's a bit of a "scripters tool" so it can be used in many cases.

Introduction
To explain what this script does, first I have to talk very briefly about how the Database parameters are stored by default.

RMXP saves the data on files in the Data folder of the project, for example items data is stored in Data/Items.rxdata.
Then, it loads that when the Scene Title starts, with the method load_data through an internal module that stores the parameters (RPG::Item) and into a global ($data_items), where you can get those by ID.
For example $data_items[1].name returns "Potion".

By default, you can change parameters mid-game, with something like $data_items[1].name = "Potion HP", and from then on that item will have that name, but with two important issues:

1. You can't get the "default" parameter back, nor check if it has been changed. The only way would be loading the whole file again with load_data, and that's a slow process.

2. Changes aren't saved when you save your game.

This script solves both issues. It may seem like a big rewrite, but it's fairly simple after all.

Terms
- Giving credits (Wecoc) is optional.
- You can use this script both in commercial and non-commercial RMXP games.
- You can share this and make addons too. If you do, you can post them here as well if you want.
- Those terms also apply to the addons I include in this topic if I don't say otherwise.

Spoiler: Code
Ruby:
#==============================================================================
# ** [XP] Data File Save v1.0
#------------------------------------------------------------------------------
#  Author: Wecoc (no credits required)
#==============================================================================

#==============================================================================
# ** Kernel
#==============================================================================

module Kernel
  def attr_reader(var)
    var = var.to_s
    eval "def #{var}() @#{var} end"
  end
  def attr_writer(var)
    var = var.to_s
    eval "def #{var}=(#{var}) @#{var}=#{var} end"
  end
  def attr_accessor(var)
    attr_reader(var) ; attr_writer(var)
  end
end

#==============================================================================
# ** RPG
#==============================================================================

module RPG
 
  DATA_FOLDERS = {}
  DATA_FOLDERS["Actors"]       = RPG::Actor
  DATA_FOLDERS["Classes"]      = RPG::Class
  DATA_FOLDERS["Skills"]       = RPG::Skill
  DATA_FOLDERS["Items"]        = RPG::Item
  DATA_FOLDERS["Weapons"]      = RPG::Weapon
  DATA_FOLDERS["Armors"]       = RPG::Armor
  DATA_FOLDERS["Enemies"]      = RPG::Enemy
  DATA_FOLDERS["Troops"]       = RPG::Troop
  DATA_FOLDERS["States"]       = RPG::State
  DATA_FOLDERS["Animations"]   = RPG::Animation
  DATA_FOLDERS["Tilesets"]     = RPG::Tileset
  DATA_FOLDERS["CommonEvents"] = RPG::CommonEvent
 
end

#==============================================================================
# ** Hash
#==============================================================================

class Hash
  def get_key(value)
    each_pair { |k, v| return k if value == v }
  end
end

#==============================================================================
# ** Klass
#==============================================================================

for Klass in RPG::DATA_FOLDERS.values
  class Klass
    def self.===(klass)
      folder = RPG::DATA_FOLDERS.get_key(self)
      return true if klass.is_a?(DataFile) && klass.data_name == folder
      super
    end
    def self.define_method(method, &block)
      super(method, &block)
      if block_given?
        name = "@#{method.to_s}"
        attr_writer(method)
        instance_variable_set(name, block.call)
      end
    end
  end
end

#==============================================================================
# ** DataFile
#==============================================================================

class DataFile
 
  attr_reader :id
  attr_reader :data_name
  attr_reader :default
 
  def initialize(name, id, default)
    @data_name = name
    @id = id
    @default = default[id]
    setup
  end
 
  def setup
    for i in @default.instance_variables
      var = i[1...i.size]
      next if var == "id"
      instance_variable_set(i, @default.instance_eval(var))
      attr_accessor(var)
    end
  end
 
  def reset
    for i in @default.instance_variables
      var = i[1...i.size]
      next if var == "id"
      eval "self.#{var} = @default.#{var}"
    end
  end
 
  def is_default?
    for i in @default.instance_variables
      var = i[1...i.size]
      result = eval "self.#{var} == @default.#{var}"
      return false if result == false
    end
    return true
  end
 
  def is_a?(klass)
    for files in RPG::DATA_FOLDERS
      f, k = *files
      return true if klass == k && @data_name == f
    end
    super
  end
end

#==============================================================================
# ** DataList
#==============================================================================

class DataList < Array
  def initialize(name)
    super([nil])
    data = load_data("Data/#{name}.rxdata")
    for i in RPG::DATA_FOLDERS[name].instance_variables
      var = i[1...i.size]
      data.each do |d|
        next if d == nil
        d.attr_accessor(var)
        result = d.instance_eval(var)
        d.send("#{var}=", result)
      end
    end
    for i in 1...data.size
      self[i] = DataFile.new(name, i, data)
    end
  end
end

#==============================================================================
# ** Scene_Title
#==============================================================================

class Scene_Title
  def main
    if $BTEST
      battle_test
      return
    end
    $data_actors        = DataList.new("Actors")
    $data_classes       = DataList.new("Classes")
    $data_skills        = DataList.new("Skills")
    $data_items         = DataList.new("Items")
    $data_weapons       = DataList.new("Weapons")
    $data_armors        = DataList.new("Armors")
    $data_enemies       = DataList.new("Enemies")
    $data_troops        = DataList.new("Troops")
    $data_states        = DataList.new("States")
    $data_animations    = DataList.new("Animations")
    $data_tilesets      = DataList.new("Tilesets")
    $data_common_events = DataList.new("CommonEvents")
    $data_system        = load_data("Data/System.rxdata")
    $game_system = Game_System.new
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)
    s1 = "New game"
    s2 = "Continue"
    s3 = "Shutdown"
    @command_window = Window_Command.new(192, [s1, s2, s3])
    @command_window.back_opacity = 160
    @command_window.x = 320 - @command_window.width / 2
    @command_window.y = 288
    @continue_enabled = false
    for i in 0..3
      if FileTest.exist?("Save#{i+1}.rxdata")
        @continue_enabled = true
      end
    end
    if @continue_enabled
      @command_window.index = 1
    else
      @command_window.disable_item(1)
    end
    $game_system.bgm_play($data_system.title_bgm)
    Audio.me_stop
    Audio.bgs_stop
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @sprite.bitmap.dispose
    @sprite.dispose
  end
end

#==============================================================================
# ** Scene_Save
#==============================================================================

class Scene_Save < Scene_File
  alias data_file_wsd write_save_data unless $@
  def write_save_data(file)
    data_file_wsd(file)
    hash_actors        = {}
    hash_classes       = {}
    hash_skills        = {}
    hash_items         = {}
    hash_weapons       = {}
    hash_armors        = {}
    hash_enemies       = {}
    hash_troops        = {}
    hash_states        = {}
    hash_animations    = {}
    hash_tilesets      = {}
    hash_common_events = {}
    for i in 1...$data_actors.size
      if !$data_actors[i].is_default?
        hash_actors[i] = $data_actors[i]
      end
    end
    for i in 1...$data_classes.size
      if !$data_classes[i].is_default?
        hash_classes[i] = $data_classes[i]
      end
    end
    for i in 1...$data_skills.size
      if !$data_skills[i].is_default?
        hash_skills[i] = $data_skills[i]
      end
    end
    for i in 1...$data_items.size
      if !$data_items[i].is_default?
        hash_items[i] = $data_items[i]
      end
    end
    for i in 1...$data_weapons.size
      if !$data_weapons[i].is_default?
        hash_weapons[i] = $data_weapons[i]
      end
    end
    for i in 1...$data_armors.size
      if !$data_armors[i].is_default?
        hash_armors[i] = $data_armors[i]
      end
    end
    for i in 1...$data_enemies.size
      if !$data_enemies[i].is_default?
        hash_enemies[i] = $data_enemies[i]
      end
    end
    for i in 1...$data_troops.size
      if !$data_troops[i].is_default?
        hash_troops[i] = $data_troops[i]
      end
    end
    for i in 1...$data_states.size
      if !$data_states[i].is_default?
        hash_states[i] = $data_states[i]
      end
    end
    for i in 1...$data_animations.size
      if !$data_animations[i].is_default?
        hash_animations[i] = $data_animations[i]
      end
    end
    for i in 1...$data_tilesets.size
      if !$data_tilesets[i].is_default?
        hash_tilesets[i] = $data_tilesets[i]
      end
    end
    for i in 1...$data_common_events.size
      if !$data_common_events[i].is_default?
        hash_common_events[i] = $data_common_events[i]
      end
    end
    Marshal.dump(hash_actors, file)
    Marshal.dump(hash_classes, file)
    Marshal.dump(hash_skills, file)
    Marshal.dump(hash_items, file)
    Marshal.dump(hash_weapons, file)
    Marshal.dump(hash_armors, file)
    Marshal.dump(hash_enemies, file)
    Marshal.dump(hash_troops, file)
    Marshal.dump(hash_states, file)
    Marshal.dump(hash_animations, file)
    Marshal.dump(hash_tilesets, file)
    Marshal.dump(hash_common_events, file)
  end
end

#==============================================================================
# ** Scene_Load
#==============================================================================

class Scene_Load < Scene_File
  alias data_file_rsd read_save_data unless $@
  def read_save_data(file)
    data_file_rsd(file)
    hash_actors        = Marshal.load(file)
    hash_classes       = Marshal.load(file)
    hash_skills        = Marshal.load(file)
    hash_items         = Marshal.load(file)
    hash_weapons       = Marshal.load(file)
    hash_armors        = Marshal.load(file)
    hash_enemies       = Marshal.load(file)
    hash_troops        = Marshal.load(file)
    hash_states        = Marshal.load(file)
    hash_animations    = Marshal.load(file)
    hash_tilesets      = Marshal.load(file)
    hash_common_events = Marshal.load(file)
    for i in hash_actors.keys
      if i < $data_actors.size
        $data_actors[i] = hash_actors[i].clone
      end
    end
    for i in hash_classes.keys
      if i < $data_classes.size
        $data_classes[i] = hash_classes[i].clone
      end
    end
    for i in hash_skills.keys
      if i < $data_skills.size
        $data_skills[i] = hash_skills[i].clone
      end
    end
    for i in hash_items.keys
      if i < $data_items.size
        $data_items[i] = hash_items[i].clone
      end
    end
    for i in hash_weapons.keys
      if i < $data_weapons.size
        $data_weapons[i] = hash_weapons[i].clone
      end
    end
    for i in hash_armors.keys
      if i < $data_armors.size
        $data_armors[i] = hash_armors[i].clone
      end
    end
    for i in hash_enemies.keys
      if i < $data_enemies.size
        $data_enemies[i] = hash_enemies[i].clone
      end
    end
    for i in hash_troops.keys
      if i < $data_troops.size
        $data_troops[i] = hash_troops[i].clone
      end
    end
    for i in hash_states.keys
      if i < $data_states.size
        $data_states[i] = hash_states[i].clone
      end
    end
    for i in hash_animations.keys
      if i < $data_animations.size
        $data_animations[i] = hash_animations[i].clone
      end
    end
    for i in hash_tilesets.keys
      if i < $data_tilesets.size
        $data_tilesets[i] = hash_tilesets[i].clone
      end
    end
    for i in hash_common_events.keys
      if i < $data_common_events.size
        $data_common_events[i] = hash_common_events[i].clone
      end
    end
  end
end

Instructions
The script works with all the data globals except $data_system and Game_Map:map, which wouldn't make much sense. I'll keep using $data_items[1] (Potion) as an example so it's easier to understand.

Spoiler: Script calls
Get a parameter
$data_items[1].name # Returns "Potion". Works as default.

Set a parameter
$data_items[1].name = "HP Potion"

Get the default value for that parameter
$data_items[1].default.name

Check if the current parameter has the default value
$data_items[1].name == $data_items[1].default.name

Check if all the parameters of the item are default
$data_items[1].is_default?

Make all the parameters of the item back to default
$data_items[1].reset

Spoiler: How to define new parameters
To create a new dynamic parameter, create a new script below Data Save File, and apply this structure:

Ruby:
#==============================================================================
# ** [XP] New parameters
#==============================================================================

module RPG
  class Item
    define_method(:agi_plus) { 20 }
  end
end

The class name can be Actor, Class, Skill, Item, Weapon, Armor, Enemy, Troop, State.
The name of the parameter, in this case agi_plus, can be whatever you want. You'll have to check the guide to know which ones are currently used. Finally, the default value can be an integer like in this case or something else. In the following example, a new parameter description_b is defined, which by default is exactly the same as the description of the item.

define_method(:description_b) { @description }

You can define custom values for each item on those new parameters when starting a new game.

Ruby:
class Scene_Title
  alias new_parameters_game command_new_game unless $@
  def command_new_game
    # Define here the custom values of your new parameter
    $data_items[1].description_b = "Test"
    # ---------------------------------------------------
    new_parameters_game
  end
end

Compatibility
This script overwrites:

- Scene_Title :main
- Scene_Save :write_save_file (alias)
- Scene_Load :read_save_data (alias)

The ones using alias won't cause any trouble if you put this script below others that change them, and the title one should be easy to solve, it only changes the lines with "load_data".

Game savefiles made before implementing this script may stop working after this. You can update them with this.

Tags System (AddOn)

This AddOn allows to group anything by tags, so then it's more easily accessible by script call. Since it uses Data File Save it's dynamic, you can change it wherever you want through the game.

Spoiler: Script calls
For example, you can define some tags to a certain enemy like this:
$data_enemies[1].set_tags("Fire", "Dragon", "Fly")

And then check if it's a Dragon with:
$data_enemies[1].has_tag?("Dragon")

Spoiler: Tags System
Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# Tags System. Group each DataFile item using multiple tags
#------------------------------------------------------------------------------
# Requires: Data File Save
#==============================================================================

class DataFile
  alias tag_ini initialize unless $@
  def initialize(name, id, default)
    tag_ini(name, id, default)
    @tags = []
  end
  def set_tags(*args)
    for i in 0...args.size
      @tags.push(args[i])
    end
    @tags.uniq!
    @tags.sort!
    return @tags
  end
  def has_tag?(name)
    return @tags.include?(name)
  end
end

Usage examples
You may still be wondering what's all this for. I made some very short scripts that use this system, you have to place them below the Data File Save script. They're meant to be adapted, so I recomment to play with the IDs, the formulas used, the effects, etc.

Spoiler: Usage Examples
Spoiler: Molten Giant
Skill with variable SP cost depending on current actor's parameters, in the example it depends on the HP / Max HP ratio.

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 1. Molten Giant
#------------------------------------------------------------------------------
# Description: Skill with SP cost depending on current actor's parameters
# Requires: Data File Save
#==============================================================================

class Window_Skill < Window_Selectable
  alias molten_giant_refresh refresh unless $@
  def refresh
    #--------------------------------------------------------------------------
    # Define here the custom formulas of SP cost
    #--------------------------------------------------------------------------
    hp = @actor.hp
    maxhp = @actor.maxhp
    $data_skills[1].sp_cost = [(hp * 100) / maxhp, 10].max
    #--------------------------------------------------------------------------
    molten_giant_refresh
  end
end

Spoiler: Chicken knife
Weapon which attack increases each time you escape from battle (it must be equipped).

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 2. Chicken Knife
#------------------------------------------------------------------------------
# Description: Weapon which attack increases each time you escape from battle
# Requires: Data File Save
#==============================================================================

class Game_System
  attr_accessor :chicken_escape_count
  alias chicken_escape_count_ini initialize unless $@
  def initialize
    chicken_escape_count_ini
    @chicken_escape_count = 0
  end
end

class Scene_Battle
  alias chicken_knife_escape battle_end unless $@
  def battle_end(result)
    if result == 1 # Escape
      for i in 0...$game_party.actors.size
        actor = $game_party.actors[i]
        next if actor.dead?
        #----------------------------------------------------------------------
        # Define here the atk custom formula
        #----------------------------------------------------------------------
        if actor.weapon_id == 1 # Weapon ID
          $game_system.chicken_escape_count += 1
          atk = $data_weapons[actor.weapon_id].default.atk
          new_atk = [atk + 10 * $game_system.chicken_escape_count, 250].min
          $data_weapons[actor.weapon_id].atk = new_atk
        end
        #----------------------------------------------------------------------
      end
    end
    chicken_knife_escape(result)
  end
end

Spoiler: Hestia knife
Weapon which strength increases proportionally to the strength of its wearer.

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 3. Hestia Knife
#------------------------------------------------------------------------------
# Description: Weapon which strength increases based on the wearer's strength
# Requires: Data File Save
#==============================================================================

class Game_Actor < Game_Battler
  alias hestia_knife_equip equip unless $@
  def equip(equip_type, id)
    case equip_type
    when 0 # Weapon
      #------------------------------------------------------------------------
      # Define here the new parameters of the item when equipped
      #------------------------------------------------------------------------
      if id == 1
        equip_str = $data_weapons[1].default.str_plus
        actor_str = self.str
        $data_weapons[1].str_plus = equip_str * actor_str / 100
      end
      #------------------------------------------------------------------------
    end
    hestia_knife_equip(equip_type, id)
  end
end

It only updates when equipped, so you may want to change it when the actors strength changes (on level up) as well.

Spoiler: Mejai's Soulstealer
Each actor has a glory score that increases when they win a battle, but decreases when they lose (or are dead when battle ends). That's the first part, the second is a weapon which strength uses that variable.

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 4. Mejai's Soulstealer
#------------------------------------------------------------------------------
# Description: Each actor has a glory score that increases when winning and
# decreases when losing battle. A weapon's strength depends on that.
# Requires: Data File Save
#==============================================================================

#==============================================================================
# ** Glory Score
#==============================================================================

class Game_Actor < Game_Battler
  attr_accessor :already_dead
 
  alias glory_score_setup setup unless $@
  def setup(actor_id)
    glory_score_setup(actor_id)
    @glory_score = 0
    @already_dead = false
  end
 
  def glory_score
    return @glory_score
  end
 
  def glory_score=(score)
    @glory_score = score
  end
end

class Scene_Battle
  unless $@
    alias glory_score_main main
    alias glory_score_end battle_end
  end
 
  def main
    for actor in $game_party.actors
      if actor.dead?
        actor.already_dead = true
      end
    end
    glory_score_main
  end
 
  def battle_end(result)
    if result < 2
      #------------------------------------------------------------------------
      # Define here the points distribution when battle ends (except escape)
      #------------------------------------------------------------------------
      for actor in $game_party.actors
        if actor.dead?
          if actor.already_dead == false
            actor.glory_score -= 1
          end
        else
          actor.glory_score += 1
        end
        actor.already_dead = false
      end
      #------------------------------------------------------------------------
    end
    glory_score_end(result)
  end
end

#==============================================================================
# ** Mejai's Soulstealer
#==============================================================================

class Game_Actor < Game_Battler
  alias mejai_soul_equip equip unless $@
  def glory_score=(score)
    @glory_score = score
    #--------------------------------------------------------------------------
    # Define here how the glory score affects the weaponry
    #--------------------------------------------------------------------------
    if @weapon_id == 1
      str = $data_weapons[1].default.str_plus
      new_str = str + 4 * @glory_score
      $data_weapons[1].str_plus = [[new_str, 999].min, 1].max
    end
    #--------------------------------------------------------------------------
  end
 
  def equip(*args)
    mejai_soul_equip(*args)
    self.glory_score = @glory_score
  end
end

Spoiler: Roaming Mend
This state increases the resistance to physical damage, but when attacked it deactivates, and reactivates into a random ally. It can do this up to three times if there are more alive allies available.

I recommend deactivating it after battle as well. The script has two parts, first one to make the state "jump" through the party, and the second one to apply the damage reduction.

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 5. Roaming Mend
#------------------------------------------------------------------------------
# Descripción: This state increases the resistance to physical damage, but when
# attacked it deactivates and reactivates into a random ally multiple times.
# Requires: Data File Save
#==============================================================================

#==============================================================================
# ** State Travel Count
#==============================================================================

class RPG::State
  define_method(:travel_count) { @travel_count ||= 0 }
end

class Game_Battler
  #----------------------------------------------------------------------------
  # Define here the states that "travel" between allies
  #----------------------------------------------------------------------------
  TRAVEL_STATES = [17]
  #----------------------------------------------------------------------------
  unless $@
    alias travel_count_add_state add_state
    alias travel_count_remove_state remove_state
    alias travel_count_attack attack_effect
  end
 
  def add_state(state_id, force=false, reset_travel=true)
    travel_count_add_state(state_id, force)
    $data_states[state_id].travel_count = 0 if reset_travel
    if TRAVEL_STATES.include?(state_id) and reset_travel == false
      $data_states[state_id].travel_count = 1 + rand(3)
    end
  end
 
  def remove_state(state_id, force=false, reset_travel=true)
    travel_count_remove_state(state_id, force)
    $data_states[state_id].travel_count = 0 if reset_travel
  end
 
  def attack_effect(attacker)
    effective = travel_count_attack(attacker)
    if self.damage.to_i > 0
      for i in TRAVEL_STATES
        if self.state?(i)
          $data_states[i].travel_count -= 1
          if self.is_a?(Game_Actor)
            array = $game_party.actors.clone
          else
            array = $game_party.enemies.clone
          end
          array.delete(self)
          array.delete_if {|battler| battler.dead?}
          if array.size == 0 or $data_states[i].travel_count == 0
            remove_state(i)
            next
          end
          new_member = array[rand(array.size)]
          remove_state(i, false, false)
          new_member.add_state(i, false, false)
        end
      end
    end
    return effective
  end
end

#==============================================================================
# ** Damage edit
#==============================================================================

class Game_Battler
  alias roaming_mend_attack attack_effect unless $@
  def attack_effect(attacker)
    effective = roaming_mend_attack(attacker)
    if self.damage.to_i > 0
      #------------------------------------------------------------------------
      # Change here the damage formula with the special state(s)
      #------------------------------------------------------------------------
      if self.state?(17) # State ID
        self.damage = (self.damage * 0.85).floor
      end
      #------------------------------------------------------------------------
    end
    return effective
  end
end

Spoiler: Judgement
Skill that changes its element based on the current accessory equipped.

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 6. Judgement
#------------------------------------------------------------------------------
# Description: Skill that changes its element based on the accessory equipped
# Requires: Data File Save
#==============================================================================

class Game_Battler
  alias judgement_skill skill_effect unless $@
  def skill_effect(user, skill)
    if user.is_a?(Game_Actor)
      #------------------------------------------------------------------------
      # Define here the element based on the current equip
      #------------------------------------------------------------------------
      if skill.id == 1
        case user.armor4_id
        when 1 # Fire Ring
          $data_skills[1].element_set = [1]
        when 2 # Ice Ring
          $data_skills[1].element_set = [2]
        when 3 # Thunder Ring
          $data_skills[1].element_set = [3]
        when 4 # Water Ring
          $data_skills[1].element_set = [4]
        else
          $data_skills[1].element_set = []
        end
      end
      #------------------------------------------------------------------------
    end
    return judgement_skill(user, skill)
  end
end

Spoiler: Heighten Magic
State increases the SP cost of certain skills, but it also increases their power.

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 7. Heighten Magic
#------------------------------------------------------------------------------
# Description: State increases the SP cost of certain skills, but it also
# increases their power.
# Requires: Data File Save
#==============================================================================

class Window_Skill < Window_Selectable
  alias heighten_magic_refresh refresh unless $@
  def refresh
    #--------------------------------------------------------------------------
    # Define here the SP cost formula for each skill
    #--------------------------------------------------------------------------
    if @actor.state?(17)
      $data_skills[1].sp_cost = ($data_skills[1].default.sp_cost * 1.25).floor
      $data_skills[2].sp_cost = ($data_skills[2].default.sp_cost * 1.25).floor
      $data_skills[3].sp_cost = ($data_skills[3].default.sp_cost * 1.25).floor
      $data_skills[4].sp_cost = ($data_skills[4].default.sp_cost * 1.25).floor
    end
    #--------------------------------------------------------------------------
    heighten_magic_refresh
  end
end

class Game_Battler
  alias heighten_magic_skill skill_effect unless $@
  def skill_effect(user, skill)
    effective = false
    #--------------------------------------------------------------------------
    # Define here the power formula for each skill
    #--------------------------------------------------------------------------
    if user.state?(17)
      $data_skills[1].power = ($data_skills[1].default.power * 1.25).floor
      $data_skills[2].power = ($data_skills[2].default.power * 1.25).floor
      $data_skills[3].power = ($data_skills[3].default.power * 1.25).floor
      $data_skills[4].power = ($data_skills[4].default.power * 1.25).floor
      effective = true
    end
    #--------------------------------------------------------------------------
    effective |= heighten_magic_skill(user, skill)
    #--------------------------------------------------------------------------
    # Reset skill SP cost and power after using
    #--------------------------------------------------------------------------
    if user.state?(17)
      $data_skills[1].sp_cost = $data_skills[1].default.sp_cost
      $data_skills[2].sp_cost = $data_skills[2].default.sp_cost
      $data_skills[3].sp_cost = $data_skills[3].default.sp_cost
      $data_skills[4].sp_cost = $data_skills[4].default.sp_cost
      $data_skills[1].power = $data_skills[1].default.power
      $data_skills[2].power = $data_skills[2].default.power
      $data_skills[3].power = $data_skills[3].default.power
      $data_skills[4].power = $data_skills[4].default.power
    end
    #--------------------------------------------------------------------------
    return effective
  end
end

Spoiler: Adapting Armor
Armor that when attacked with an element becomes of that element, which means it temporarily becomes more resistant to that element. It resets when battle ends.

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 8. Adapting Armor
#------------------------------------------------------------------------------
# Description: Armor that when attacked with an element becomes of that element
# Requires: Data File Save
#==============================================================================

class Game_Battler
  unless $@
    alias adapting_armor_attack attack_effect
    alias adapting_armor_skill skill_effect
  end
 
  def attack_effect(attacker)
    effective = adapting_armor_attack(attacker)
    if effective && self.is_a?(Game_Actor)
      #------------------------------------------------------------------------
      # Define the armors by ID that adapt with elements (attack effect)
      #------------------------------------------------------------------------
      if self.armor3_id == 1
        $data_armors[1].guard_element_set = attacker.element_set
      end
      #------------------------------------------------------------------------
    end
    return effective
  end
 
  def skill_effect(user, skill)
    effective = adapting_armor_skill(user, skill)
    if effective && self.is_a?(Game_Actor)
      #------------------------------------------------------------------------
      # Define the armors by ID that adapt with elements (skill effect)
      #------------------------------------------------------------------------
      if self.armor3_id == 1
        $data_armors[1].guard_element_set = skill.element_set
      end
      #------------------------------------------------------------------------
    end
    return effective
  end
end

class Scene_Battle
  alias adapting_armor_battle_end battle_end unless $@
  def battle_end(result)
    adapting_armor_battle_end(result)
    #--------------------------------------------------------------------------
    # Change armors back to normal when battle ends
    #--------------------------------------------------------------------------
    $data_armors[1].guard_element_set = []
    #--------------------------------------------------------------------------
  end
end

Spoiler: Map States
Certain actors or enemies can have a permanent state based on the current map.

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 9. Map States
#------------------------------------------------------------------------------
# Certain actors or enemies can have a permanent state based on the current map
# Requires: Data File Save
#==============================================================================

#==============================================================================
# * RPG::Actor / RPG::Enemy
#==============================================================================

class DataFile
  #--------------------------------------------------------------------------
  # * Get the maps with altered states
  #--------------------------------------------------------------------------
  def get_map_auto_states(map)
    @map_states = {} if @map_states.nil?
    return @map_states[map]
  end
  #--------------------------------------------------------------------------
  # * Set the maps with altered states
  #--------------------------------------------------------------------------
  def set_map_auto_states(map, states)
    @map_states = {} if @map_states.nil?
    @map_states[map] = states.to_a
  end
end

#==============================================================================
# * Game_Actor / Game_Enemy
#==============================================================================

class Game_Actor < Game_Battler
  def map_auto_states
    result = $data_actors[@actor_id].get_map_auto_states($game_map.map_id)
    return !result.nil? ? result : []
  end
end

class Game_Enemy < Game_Battler
  def map_auto_states
    result = $data_enemies[@enemy_id].get_map_auto_states($game_map.map_id)
    return !result.nil? ? result : []
  end
end

#==============================================================================
# * Game_Party
#==============================================================================

class Game_Party
  alias map_states_setup_start setup_starting_members
  def setup_starting_members
    map_states_setup_start
    #--------------------------------------------------------------------------
    # Define here permanently the auto-states on each actor/enemy by ID
    #--------------------------------------------------------------------------
    $data_actors[1].set_map_auto_states(1, [2])  # (Map ID, [States])
    $data_enemies[1].set_map_auto_states(1, [2]) # (Map ID, [States])
    #--------------------------------------------------------------------------
  end
end

#==============================================================================
# * Game_Map
#==============================================================================

class Game_Map
  alias map_states_setup setup unless $@
  def setup(map_id)
    map_states_setup(map_id)
    for actor in $game_party.actors
      states = actor.map_auto_states
      if !states.nil? and states.size > 0
        #----------------------------------------------------------------------
        # Add map states to actors when entering the map
        #----------------------------------------------------------------------
        for state in states
          actor.add_state(state, true)
        end
      end
    end
  end
end

#==============================================================================
# * Game_Troop
#==============================================================================

class Game_Troop
  alias map_states_setup setup unless $@
  def setup(troop_id)
    map_states_setup(troop_id)
    for enemy in @enemies
      states = enemy.map_auto_states
      if !states.nil? and states.size > 0
        #----------------------------------------------------------------------
        # Add map states to enemies when starting battle
        #----------------------------------------------------------------------
        for state in states
          enemy.add_state(state, true)
        end
      end
    end
  end
end

#==============================================================================
# * Scene_Map
#==============================================================================

class Scene_Map
  alias map_states_transfer transfer_player unless $@
  def transfer_player
    if $game_map.map_id != $game_temp.player_new_map_id
      for actor in $game_party.actors
        states = actor.map_auto_states
        if !states.nil? and states.size > 0
          #--------------------------------------------------------------------
          # Remove map states when exiting the current map
          #--------------------------------------------------------------------
          for state in states
            actor.remove_state(state, true)
          end
        end
      end
      map_states_transfer
    end
  end
end

Spoiler: Walk Armor
Armor which physical defense increases when increasing your step count.
There are multiple ways to approach this, I'll try to cover the main two.

The first one would be making its pdef depend on the total step count.

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 11. Walk Armor
#------------------------------------------------------------------------------
# Armor which pdef depends on your total step count, increasing every X steps
# Requires: Data File Save
#==============================================================================

class Game_Party
  alias walk_armor_increase increase_steps unless $@
  def increase_steps
    walk_armor_increase
    if @steps % 100 == 0       # Every few steps it increases
      armor = $data_armors[16] # Armor ID
      armor.pdef += 1          # How much it increases
    end
  end
end

The second one increasing only when equipped.

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 11(*). Walk Armor
#------------------------------------------------------------------------------
# Armor which pdef increases when walking and you have it equipped
# Requires: Data File Save
#==============================================================================

class Game_Party
  alias walk_armor_increase increase_steps unless $@
  def increase_steps
    walk_armor_increase
    if @steps % 100 == 0       # Every few steps it increases
      armor = $data_armors[16] # Armor ID
      if equipped?(3, 16) # (Equip type, Equip ID)
        armor.pdef += 1        # How much it increases
      end
    end
  end
 
  def equipped?(slot, id)
    for i in [email hidden]
      actor = $game_party.actors[i]
      case slot
      when 0 # Weapon
        return true if actor.weapon_id == id
      when 1 # Shield
        return true if actor.armor1_id == id
      when 2 # Head
        return true if actor.armor2_id == id
      when 3 # Body
        return true if actor.armor3_id == id
      when 4 # Accessory
        return true if actor.armor4_id == id
      end
    end
    return false
  end
end

Spoiler: Upgrading Shield
Shield which defense increases when you're attacked and it's equipped. You can optionally make it increase only when guarding.

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 12. Upgrading Shield
#------------------------------------------------------------------------------
# Shield which defense increases when you're attack and it's equipped
# Required: Data File Save
#==============================================================================

class Game_Battler
  #----------------------------------------------------------------------------
  UPGRADING_SHIELD = 4 # Shield ID
  #----------------------------------------------------------------------------
  alias upgrading_shield_effect attack_effect unless $@
  def attack_effect(attacker)
    effective = upgrading_shield_effect(attacker)
    if effective && self.damage.to_i > 0
      if self.is_a?(Game_Actor)
        # You can optionally make it increase only when guarding
        if self.armor1_id == UPGRADING_SHIELD # and self.guarding?
          armor = $data_armors[UPGRADING_SHIELD]
          # Set here the effect when being attacked and wearing it
          armor.pdef += 2
        end
      end
    end
    return effective
  end
end

Spoiler: Learning Heal
Skill that each time you use it, its SP cost decreases slightly (with a minumum cost).

Ruby:
#==============================================================================
# ** Data File Save Tips & Tricks
#------------------------------------------------------------------------------
# 13. Learning Heal
#------------------------------------------------------------------------------
# Skill that decreases its SP cost each time you use it
# Requires: Data File Save
#==============================================================================

class Game_Battler
  alias learning_heal_effect skill_effect unless $@
  def skill_effect(user, skill)
    effective = learning_heal_effect(user, skill)
    if effective && self.damage.to_i.abs > 0
      if user.is_a?(Game_Actor) && skill.id == 17 # Skill ID
        #----------------------------------------------------------------------
        sp_cost_min   = 50 # Minimum SP Cost
        sp_cost_learn = 5  # SP cost reduction
        skill.sp_cost = [skill.sp_cost - sp_cost_learn, sp_cost_min].max
        #----------------------------------------------------------------------
      end
    end
    return effective
  end
end
Skill & Item Animation Effects (AddOn)

This Data File Save addon allows modifying frame by frame the effects of a skill or item in battle. That mainly means adding effects during the animations on the user and target, but it can affect anything else involving that skill or item, starting from its display on the help window and until the common event call, if that's enabled.

That means with this you can make skills with multiple hits, or that happen multiple times, or change the normal order (for example showing the user animation after the target animation), concatenate multiple effects, make ambiance changes (battleback, tone, shake...) or whatever.

I would say it's a bit of a weird beast, but it's not very incompatible after all.

Spoiler: Code
Ruby:
#==============================================================================
# ** [XP] Skill & Item Animation Effects
#------------------------------------------------------------------------------
#  This script allows setting advanced frame-based effects on skills and items
#  Requires the script Data File Save
#  Author: Wecoc (no credits required)
#==============================================================================

#==============================================================================
# ** RPG [ timigs ]
#==============================================================================

class RPG::Skill
  define_method(:timings) { @timings ||= {} }
  define_method(:frames)  { @frames  ||= 0 }
end
class RPG::Item
  define_method(:timings) { @timings ||= {} }
  define_method(:frames)  { @frames  ||= 0 }
end
class DataFile
  def clear_timings
    @timings.clear
  end
  def set_timing(*data)
    @timings[@timings.keys.size] = data
  end
end

#==============================================================================
# ** RPG [ Damage Fix ]
#==============================================================================

module RPG
  class Sprite < ::Sprite
    def initialize(viewport = nil)
      super(viewport)
      @_whiten_duration = 0
      @_appear_duration = 0
      @_escape_duration = 0
      @_collapse_duration = 0
      @_damage_sprite = []
      @_damage_duration = []
      @_animation_duration = 0
      @_blink = false
    end
    def damage(value, critical)
      if value.is_a?(Numeric)
        damage_string = value.abs.to_s
      else
        damage_string = value.to_s
      end
      bitmap = Bitmap.new(160, 48)
      bitmap.font.name = "Arial Black"
      bitmap.font.size = 32
      bitmap.font.color.set(0, 0, 0)
      bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
      if value.is_a?(Numeric) and value < 0
        bitmap.font.color.set(176, 255, 144)
      else
        bitmap.font.color.set(255, 255, 255)
      end
      bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
      if critical
        bitmap.font.size = 20
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
        bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
        bitmap.font.color.set(255, 255, 255)
        bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
      end
      sprite = ::Sprite.new(self.viewport)
      sprite.bitmap = bitmap
      sprite.ox = 80
      sprite.oy = 20
      sprite.x = self.x
      n = @_damage_sprite.size
      case n % 3
      when 1
        sprite.x -= 8
      when 2
        sprite.x += 8
      end
      sprite.y = self.y - self.oy / 2 - n * 12
      sprite.z = 3000
      @_damage_sprite.push(sprite)
      @_damage_duration.push(40)
    end
    def dispose_damage
      @_damage_sprite.each do |sprite|
        sprite.bitmap.dispose
        sprite.dispose
      end
    end
    def effect?
      @_whiten_duration > 0 or
      @_appear_duration > 0 or
      @_escape_duration > 0 or
      @_collapse_duration > 0 or
      @_damage_duration.any? {|d| d > 0} or
      @_animation_duration > 0
    end
    def update
      super
      if @_whiten_duration > 0
        @_whiten_duration -= 1
        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
      end
      if @_appear_duration > 0
        @_appear_duration -= 1
        self.opacity = (16 - @_appear_duration) * 16
      end
      if @_escape_duration > 0
        @_escape_duration -= 1
        self.opacity = 256 - (32 - @_escape_duration) * 10
      end
      if @_collapse_duration > 0
        @_collapse_duration -= 1
        self.opacity = 256 - (48 - @_collapse_duration) * 6
      end
      for i in 0...@_damage_duration.size
        if @_damage_duration[i] > 0
          @_damage_duration[i] -= 1
          duration = @_damage_duration[i]
          sprite = @_damage_sprite[i]
          case duration
          when 38..39
            sprite.y -= 4
          when 36..37
            sprite.y -= 2
          when 34..35
            sprite.y += 2
          when 28..33
            sprite.y += 4
          end
          sprite.opacity = 256 - (12 - duration) * 32
          if duration == 0
            sprite.bitmap.dispose
            sprite.dispose
            @_damage_sprite[i] = nil
            @_damage_duration[i] = nil
            @_damage_sprite.compact!
            @_damage_duration.compact!
            retry
          end
        end
      end
      if @_animation != nil and (Graphics.frame_count % 2 == 0)
        @_animation_duration -= 1
        update_animation
      end
      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
        update_loop_animation
        @_loop_animation_index += 1
        @_loop_animation_index %= @_loop_animation.frame_max
      end
      if @_blink
        @_blink_count = (@_blink_count + 1) % 32
        if @_blink_count < 16
          alpha = (16 - @_blink_count) * 6
        else
          alpha = (@_blink_count - 16) * 6
        end
        self.color.set(255, 255, 255, alpha)
      end
      @@_animations.clear
    end
  end
end

#==============================================================================
# ** Scene_Title
#==============================================================================

class Scene_Title
  alias wecfix_command_new_game command_new_game unless $@
  def command_new_game
    wecfix_command_new_game
    define_default_data_timings
    define_custom_data_timings
  end
  #--------------------------------------------------------------------------
  # * Define default effects (when starting new game)
  #--------------------------------------------------------------------------
  def define_default_data_timings
    #------------------------------------------------------------------------
    # * Skills
    #------------------------------------------------------------------------
    for i in 1...$data_skills.size
      skill = $data_skills[i]
      n = 0
      # Display text on help window: Skill name
      skill.set_timing(n, :help_text, skill.name)
      # Get target battlers
      skill.set_timing(n, :set_target_battlers, skill.scope)
      # Apply effect (damage, states...)
      skill.set_timing(n, :skill_effect, skill.id)
      # Show user animation
      skill.set_timing(n, :animation1, skill.animation1_id)
      if skill.animation1_id != 0
        animation = $data_animations[skill.animation1_id]
        n += animation.frame_max
      end
      n += 8
      # Show target animation
      skill.set_timing(n, :animation2, skill.animation2_id)
      if skill.animation2_id != 0
        animation = $data_animations[skill.animation2_id]
        n += animation.frame_max
      end
      n += 8
      # Remove help window
      skill.set_timing(n, :help_text, "")
      # Display damage
      skill.set_timing(n, :damage)
      n += 40
      # Call common event (if available)
      skill.set_timing(n, :common_event_id, skill.common_event_id)
      # Define total frames of the effect
      skill.frames = n + 1
    end
    #------------------------------------------------------------------------
    # * Items
    #------------------------------------------------------------------------
    for i in 1...$data_items.size
      item = $data_items[i]
      n = 0
      # Display text on help window: Item name
      item.set_timing(n, :help_text, item.name)
      # Get target battlers
      item.set_timing(n, :set_target_battlers, item.scope)
      # Apply effect (damage, states...)
      item.set_timing(n, :item_effect, item.id)
      # Show user animation
      item.set_timing(n, :animation1, item.animation1_id)
      if item.animation1_id != 0
        animation = $data_animations[item.animation1_id]
        n += animation.frame_max
      end
      n += 8
      # Show target animation
      item.set_timing(n, :animation2, item.animation2_id)
      if item.animation2_id != 0
        animation = $data_animations[item.animation2_id]
        n += animation.frame_max
      end
      n += 8
      # Remove help window
      item.set_timing(n, :help_text, "")
      # Display damage
      item.set_timing(n, :damage)
      n += 40
      # Call common event (if available)
      item.set_timing(n, :common_event_id, item.common_event_id)
      # Define total frames of the effect
      item.frames = n + 1
    end
  end
  #--------------------------------------------------------------------------
  # * Define custom effects (when starting new game)
  #--------------------------------------------------------------------------
  def define_custom_data_timings
  end
end

#==============================================================================
# ** Game_Temp
#==============================================================================

class Game_Temp
  attr_accessor :action_counter
  alias action_counter_ini initialize unless $@
  def initialize
    action_counter_ini
    @action_counter = 0
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    if $game_system.battle_interpreter.running?
      $game_system.battle_interpreter.update
      if $game_temp.forcing_battler == nil
        unless $game_system.battle_interpreter.running?
          unless judge
            setup_battle_event
          end
        end
        if @phase != 5
          @status_window.refresh
        end
      end
    end
    $game_system.update
    $game_screen.update
    if $game_system.timer_working and $game_system.timer == 0
      $game_temp.battle_abort = true
    end
    @help_window.update
    @party_command_window.update
    @actor_command_window.update
    @status_window.update
    @message_window.update
    @spriteset.update
    if $game_temp.transition_processing
      $game_temp.transition_processing = false
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    if $game_temp.message_window_showing
      return
    end
    #------------------------------------------------------------------------
    if @spriteset.effect? && $game_temp.action_counter == 0
      return
    end
    #------------------------------------------------------------------------
    if $game_temp.gameover
      $scene = Scene_Gameover.new
      return
    end
    if $game_temp.to_title
      $scene = Scene_Title.new
      return
    end
    if $game_temp.battle_abort
      $game_system.bgm_play($game_temp.map_bgm)
      battle_end(1)
      return
    end
    if @wait_count > 0
      @wait_count -= 1
      return
    end
    if $game_temp.forcing_battler == nil and
       $game_system.battle_interpreter.running?
      return
    end
    case @phase
    when 1  # pre-battle phase
      update_phase1
    when 2  # party command phase
      update_phase2
    when 3  # actor command phase
      update_phase3
    when 4  # main phase
      update_phase4
    when 5  # after battle phase
      update_phase5
    end
  end
  #--------------------------------------------------------------------------
  # * Update Phase 4 - Action
  #--------------------------------------------------------------------------
  alias update_phase4_timing update_phase4 unless $@
  def update_phase4
    if $game_temp.action_counter > 0
      update_action
      return
    end
    update_phase4_timing
  end
  #--------------------------------------------------------------------------
  # * Update Action
  #--------------------------------------------------------------------------
  def update_action
    item = [email protected]? ? @skill : @item
    if item.nil?
      $game_temp.action_counter = 0
      return
    end
    frame = item.frames - $game_temp.action_counter
    for action in item.timings.values
      if action[0] == frame
        evaluate_action(action)
      end
    end
    $game_temp.action_counter -= 1
    if $game_temp.action_counter == 0
      $game_temp.forcing_battler = nil
      @phase4_step = 1
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Evaluate action
  #--------------------------------------------------------------------------
  def evaluate_action(action)
    action_type = action[1]
    case action_type
    # Help text
    when :help_text
      text = action[2]
      if text != ""
        @help_window.set_text(text, 1)
      else
        @help_window.visible = false
      end
    # Get targets
    when :set_target_battlers
      scope = action[2]
      set_target_battlers(scope)
    # Show user animation
    when :animation1
      animation_id = action[2]
      if animation_id > 0
        @active_battler.animation_id = animation_id
        @active_battler.animation_hit = true
      else
        @active_battler.white_flash = true
      end
    # Show target animation
    when :animation2
      animation_id = action[2]
      for target in @target_battlers
        target.animation_id = animation_id
        target.animation_hit = (target.damage != "Miss")
      end
    # Apply effect (damage, states...)
    when :skill_effect
      skill = $data_skills[action[2]]
      for target in @target_battlers
        target.skill_effect(@active_battler, skill)
      end
    # Apply effect (damage, states...)
    when :item_effect
      item = $data_items[action[2]]
      for target in @target_battlers
        target.item_effect(item)
      end
    # Display damage
    when :damage
      @status_window.refresh
      for target in @target_battlers
        if target.damage != nil
          target.damage_pop = true
        end
      end
    # Call common event (if available)
    when :common_event_id
      common_event_id = action[2]
      if common_event_id > 0
        common_event = $data_common_events[common_event_id]
        $game_system.battle_interpreter.setup(common_event.list, 0)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Call skill
  #--------------------------------------------------------------------------
  def make_skill_action_result
    @skill = $data_skills[@active_battler.current_action.skill_id]
    unless @active_battler.current_action.forcing
      unless @active_battler.skill_can_use?(@skill.id)
        $game_temp.forcing_battler = nil
        @phase4_step = 1
        return
      end
    end
    @active_battler.sp -= @skill.sp_cost
    @status_window.refresh
    $game_temp.action_counter = @skill.frames
  end
  #--------------------------------------------------------------------------
  # * Call item
  #--------------------------------------------------------------------------
  def make_item_action_result
    @item = $data_items[@active_battler.current_action.item_id]
    unless $game_party.item_can_use?(@item.id)
      @phase4_step = 1
      return
    end
    $game_party.lose_item(@item.id, 1) if @item.consumable
    @status_window.refresh
    $game_temp.action_counter = @item.frames
  end
end

Spoiler: Basic Instructions
The script has two main methods: On define_custom_data_timings you define the custom timings for skills and items as shortcuts, and on evaluate_action you define what those shortcuts mean, in case you want to make new ones.

To apply effects on an item or skill, use set_timing(frame, type, properties).

Here's an example of a skill with multiple hits.

Ruby:
class Scene_Title
  def define_custom_data_timings
    skill = $data_skills[7] # Fire
    skill.clear_timings # Clear default timings
    skill.set_timing(0, :help_text, skill.name)
    skill.set_timing(0, :set_target_battlers, skill.scope)
    skill.set_timing(0, :animation1, skill.animation1_id)
    skill.set_timing(16, :animation2, skill.animation2_id)
    #-----------------------------------------------------------------
    # First hit
    skill.set_timing(15, :skill_effect, skill.id)
    skill.set_timing(20, :damage)
    # Second hit
    skill.set_timing(25, :skill_effect, skill.id)
    skill.set_timing(30, :damage)
    # Third hit
    skill.set_timing(35, :skill_effect, skill.id)
    skill.set_timing(40, :damage)
    #-----------------------------------------------------------------
    skill.set_timing(40, :help_text, "")
    skill.set_timing(40, :common_event_id, skill.common_event_id)
    skill.frames = 41
  end
end

On :skill_effect the same skill.id has been used each time, which means the same effect will be applied on each hit. If you want one of the hits to deal more damage, you can use an effect from another skill instead. That means you can create skills with more than one slot in the Database and join their effects via script.

I'll show below an example of a custom effect; temporarily change the battleback during the skill. We'll create some new effects: :memorize_battleback, :set_battleback, and :restore_battleback. Everything else will be as default, so in this case we won't use clear_timings.

Ruby:
class Scene_Title
  def define_custom_data_timings
    skill = $data_skills[7] # Fire
    skill.set_timing(0, :memorize_battleback)
    skill.set_timing(1, :set_battleback, "002-Woods01")
    skill.set_timing(skill.frames - 1, :restore_battleback)
  end
end

class Scene_Battle
  alias evaluate_action_example_battleback evaluate_action unless $@
  def evaluate_action(action)
    evaluate_action_example_battleback(action)
    action_type = action[1]
    case action_type
    # Memorize Battleback
    when :memorize_battleback
      @battleback_name = $game_temp.battleback_name
    # Set Battleback
    when :set_battleback
      battleback = action[2]
      $game_temp.battleback_name = battleback
    # Restore Battleback
    when :restore_battleback
      $game_temp.battleback_name = @battleback_name
    end
  end
end

Spoiler: Advanced Instructions
You can create shortcut methods to configurate very similar skills more easily.
For example, in other versions there's an option for skills and items that doesn't exist on RMXP: Repeat. You can create a method that repeats a skill N times automatically. If you want to use that, paste this on the very end of the Skill & Item Animation Effects script.

Ruby:
module SkillData
  module_function
  #-------------------------------------------------------------------------
  # * Set repeats
  #-------------------------------------------------------------------------
  def set_repeats(skill, repeats)
    skill.clear_timings
    n = 0
    skill.set_timing(n, :help_text, skill.name)
    skill.set_timing(n, :set_target_battlers, skill.scope)
    skill.set_timing(n, :animation1, skill.animation1_id)
    if skill.animation1_id != 0
      animation = $data_animations[skill.animation1_id]
      n += animation.frame_max
    end
    n += 8
    (repeats + 1).times do
      skill.set_timing(n, :skill_effect, skill.id)
      skill.set_timing(n, :animation2, skill.animation2_id)
      if skill.animation2_id != 0
        animation = $data_animations[skill.animation2_id]
        n += animation.frame_max
      end
      n += 8
      skill.set_timing(n, :damage)
    end
    skill.set_timing(n, :help_text, "")
    n += 40
    skill.set_timing(n, :common_event_id, skill.common_event_id)
    skill.frames = n + 1
  end
  # Set more shortcuts here
end

module ItemData
  module_function
  #-------------------------------------------------------------------------
  # * Set repeats
  #-------------------------------------------------------------------------
  def set_repeats(item, repeats)
    item.clear_timings
    n = 0
    item.set_timing(n, :help_text, item.name)
    item.set_timing(n, :set_target_battlers, item.scope)
    item.set_timing(n, :animation1, item.animation1_id)
    if item.animation1_id != 0
      animation = $data_animations[item.animation1_id]
      n += animation.frame_max
    end
    n += 8
    (repeats + 1).times do
      item.set_timing(n, :item_effect, item.id)
      item.set_timing(n, :animation2, item.animation2_id)
      if item.animation2_id != 0
        animation = $data_animations[item.animation2_id]
        n += animation.frame_max
      end
      n += 8
      item.set_timing(n, :damage)
    end
    item.set_timing(n, :help_text, "")
    n += 40
    item.set_timing(n, :common_event_id, item.common_event_id)
    item.frames = n + 1
  end
  # Set more shortcuts here
end

Usage example:

Ruby:
class Scene_Title
  def define_custom_data_timings
    SkillData.set_repeats($data_skills[7], 2)
    ItemData.set_repeats($data_items[1], 1)
  end
end

I hope some of these AddOns are useful to someone. I'll post more very soon. :asad:

Original thread: https://forums.rpgmakerweb.com/threads/data-file-save-change-database-parameters-mid-game.139740/