Main Menu
  • Welcome to The RPG Maker Resource Kit.

Elemental Attack Accessories

Started by Leon_Westbrooke, January 02, 2008, 07:18:16 PM

0 Members and 1 Guest are viewing this topic.

Leon_Westbrooke

This script was requested by Erk, and so I decided just to take a crack at it.  It is a script that allows accessories to give elemental attacks.  Pretty straightforward, and because of the way it works, screenshots are kind of out of the question.  The instructions are in the header of the script, so enjoy.

[spoiler="Script"]

#===============================================================================
#  Elemental Attack Accessories v. 1.0
#    by Leon_Westbrooke
#-------------------------------------------------------------------------------
#  Allows accessories to give elemental attack(s).
#
#  Instruction:
#    -Place above main, but below any scripts that alter the method 'element_set'.
#    -In the method, where it says Elemental_Acc, below that, follow the example
#      in the comments.
#
#  Notes:
#    -Allows a crossover for Guillaume777's Multislot script.  To use it, set
#      Multislot_Script equal to true.
#
#  Compatability:
#    -It is compatible with any script that does NOT alter the method element_set
#     for the Game_Actor class.
#===============================================================================
module EAtk_Acc
  #-----------------------------------------------------------------------------
  #  Elemental_Acc = {
  #    accessory_id1 => [element_id, element_id],
  #    accessory_id2 => [element_id], etc
  #-----------------------------------------------------------------------------
  Elemental_Acc = {
  25 => [4, 7],
  26 => [5]
  }
 
  Multislot_Script = false
end


class Game_Actor
  def element_set
    ea = EAtk_Acc
    new_element_set = []
    if ea::Multislot_Script == false
      weapon = $data_weapons[@weapon_id]
      if weapon != nil
        new_element_set = weapon.element_set
      end
      if @armor4_id != nil
        if ea::Elemental_Acc.keys.include?(@armor4_id)
          for i in 0...ea::Elemental_Acc[@armor4_id].size
            unless new_element_set.include?(ea::Elemental_Acc[@armor4_id][i])
              new_element_set.push(ea::Elemental_Acc[@armor4_id][i])
            end
          end
        end
      end
    else
      weapon = self.get_weapon_data
      if weapon != nil
        new_element_set = weapon.element_set
      end
      for h in 0...armor_ids[3]
        if @armor_ids[3][h] != nil
          if ea::Elemental_Acc.keys.include?(@armor_ids[3][h])
            for i in 0...ea::Elemental_Acc[@armor_ids[3][h]].size
              unless new_element_set.include?(ea::Elemental_Acc[@armor_ids[3][h]][i])
                new_element_set.push(ea::Elemental_Acc[@armor_ids[3][h]][i])
              end
            end
          end
        end
      end
    end
    return new_element_set
  end
end
[/spoiler]