Equipment Set Bonuses

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Equipment Set Bonuses
Version: 1.0
Author: modern algebra
Date: May 24, 2010

Version History


  • <Version 1.0> 05.24.2010 - Original Release

Description


This script allows you to set bonuses to stats if an actor is wearing equipment of the same set, such as in Diablo II or Dragon Age: Origins. With this script, for instance, you could make a sword with ATK 10 and a Shield with DEF 10, but if you have both that sword and shield equipped you would get an additional 5 ATK and DEF, so that you would get 15 ATK and 15 DEF. By default, you can make sets that can give bonuses to maxhp, maxmp, atk, def, spi, and agi, as well as apply states. As well, the Global Text Codes script is recommended if you wish to colour code sets.

Features

  • Allows you to give bonuses to stats if an actor is wearing all the items of a set
  • Can see what set the item belongs to by pressing a button (SHIFT by default) while hovering over it
  • Can create sets that will give smaller bonuses if they are only partially completed

Screenshots



Instructions

Please see the header and Editable regions for instructions on configuring the script.

Script


Code: [Select]
#==============================================================================
#    Equipment Set Bonuses
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: May 24, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:

#    This script allows you to set bonuses to stats if an actor is wearing
#   equipment of the same set, such as in Diablo II or Dragon Age: Origins.
#    With this script, for instance, you could make a sword with ATK 10 and
#   a Shield with DEF 10, but if you have both that sword and shield equipped
#   you would get an additional 5 ATK and DEF, so that you would get 15 ATK and
#   15 DEF. By default, you can make sets that can give bonuses to maxhp, maxmp,
#   atk, def, spi, and agi, as well as apply states.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script in its own slot in the Script Editor (F11), somewhere
#   below Materials but above Main.
#
#    To setup sets and the bonuses they will give, go to line x38 and read the
#   instructions located there.
#
#    To assign an equipment to a set, simply put the following code in its
#   notebox:
#        \SET[set_id]
#          set_id : the ID of the set this equipment belongs to, as per the
#            setup at line 48.
#    Note that you can assign the same piece of equipment to multiple sets by
#   placing a comma and writing the next set_id, like so:
#        \SET[set_id_1, set_id_2, ..., set_id_n]
#==============================================================================
ESB_SET_BONUSES = { # <- Do not touch this line
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#  EDITABLE REGION
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  ESB_SET_BONUSES -
#    This is where you set up the sets, give them a name, and determine what
#   bonuses they give if an actor is wearing a complete set. The format for
#   setting it up is:
#
#     set_id => {
#       :name => "name",
#       :states => [state_ids],
#       :maxhp => maxhp_bonus,
#       :maxmp => maxmp_bonus,
#       :atk => atk_bonus,
#       :def => def_bonus,
#       :spi => spi_bonus,
#       :agi => agi_bonus
#     }
#
#    where:
#      set_id - the ID of the set. This is used to identify which equipment
#        belongs to which set, which you do in the note field of the equipment.
#        See line 27 for details. Note that this must be an integer, but beyond
#        that can be anything. Whatever you do though, this must be unique, so
#        don't make more than one set with this ID.
#      "name" - the name of the set. This is what will show up in the help box
#        when you press the Display button (see line yy to set) on a set item.
#        It can be used for more than one set, if you want to create bonuses
#        for partial sets.
#      [state_ids] - this is an array of states that should be applied if an
#        actor has completed this set. So, if you want an actor who wears a
#        complete set to have a state applied, put the ID of that state in this
#        array, like so: [10] - that would apply state 10 (by default, DEF UP)
#        for as long as the complete set is equipped. [9, 10] would apply both
#        states 9 and 10 (by default, ATK UP and DEF UP).
#      stat_bonus - the rest of them are the value of whatever bonus you want
#        applied to that stat. So, if you want a complete set to give a bonus
#        of 10 to DEF and a bonus of 5 to agi, you would have:
#          :def => 10,
#          :agi => 5
#        If you do not set a stat, it will default to 0, meaning it won't give
#        a bonus to that particular stat.
#  EXAMPLES:
#
#    1 => {
#      :name => "Leopold's Outfit",
#      :atk => 5,
#      :def => 15,
#      :agi => 3
#    },
#
#  That code creates a set with ID 1, meaning that all items that have the code
# \set[1] in their note field must be equipped for these bonuses to be active.
# The name that shows up when hovering over an item of that script and pressing
# the display button is Leopold's Outfit. When all items of that set are
# equipped, the actor gets a bonus of 5 to his/her attack, 15 to his/her
# defence, and 3 to his/her agility.
#
#    3 => {
#      :name => "Heaven's Wrath",
#      :states => [9]
#      :maxhp => 250,
#      :maxmp => -250,
#      :spi => -25
#    },
#
#  That code creates a set with ID 3, meaning that all items that have the code
# \set[3] in their note field must be equipped for these bonuses to be active.
# The name that shows up when hovering over an item of that script and pressing
# the display button is Heaven's Wrath. When all items of that set are equipped,
# the actor has the state with ID 9 applied (ATK UP by default), gets an extra
# 250 MaxHP, loses 250 MaxMP, and loses 25 Spirit
#
#  Note that you can potentially add more stats via ESB_STAT_MODS at line zz,
# but only if you are using some script that gives more stats to actors and it
# follows the same format as the atk, def, spi, and agi methods. Read the
# instructions at line zz for more details.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  1 => {
    :name => "",
    :states => [],
    :maxhp => 0,
    :maxmp => 0,
    :atk => 0,
    :def => 0,
    :spi => 0,
    :agi => 0
  },
  2 => { # EXAMPLE
    :name => "Leopold's Haven",
    :def => 10
  }
} # <- do not touch the } on this line
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ESB_SET_DISPLAY_BUTTON -
#  This allows you to set a button, that, when pressed while hovering over a set
# item in the item or equip scenes, will show the name of the set(s) it belongs
# to. Note that it requires a button, which doesn't necessarily correspond to
# that key on the keyboard. Press F1 during testplay to see a list of the
# buttons and what key they correspond to.
ESB_SET_DISPLAY_BUTTON = Input::SHIFT
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ESB_SET_DISPLAY_VOCAB -
#  This is the text that will appear directly before the list of names of the
# sets the item belongs to when pressing ESB_SET_DISPLAY_BUTTON while hovering
# over a set item.
ESB_SET_DISPLAY_VOCAB = "Set Item: "
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ESB_STAT_MODS -
#  You probably shouldn't touch this. It is simply a way to add other
# possibilities for stat bonuses, where those stats are set up more or less in
# the same way that the default atk, def, spi, and agi stats are. For example,
# if you are using YEM New Battler Stats, you could add them to this array as
#   :res, :dex
# Then, where you set up the set bonuses at line 38, you could use the codes:
#    :res => x,
#    :dex => y
# and those bonuses would be granted when you complete the set. But you need to
# add them to the below array if you want to be able to do it, so:
#  ESB_STAT_MODS = [:maxhp, :maxmp, :atk, :def, :spi, :agi, :res, :dex]
#
#  NB: that's only if you have YEM New Battler Stats, and if you do, you will
# need to put the New Battler Stats script above this one in the editor, and you
# would need to get the compatibility patch located in the main topic thread
ESB_STAT_MODS = [:maxhp, :maxmp, :atk, :def, :spi, :agi]
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  END EDITABLE REGION
#//////////////////////////////////////////////////////////////////////////////
ESB_SET_BONUSES.each_value { |set|
  set[:name] = "" if !set[:name]
  set[:states] = [] if !set[:states]
  set.default = 0
}
#==============================================================================
# ** Data_EquipmentSet
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This struct holds all relevant data on an Equipment Set
#==============================================================================

Data_EquipmentSet = Struct.new (:id, :name, :equips, :states, *ESB_STAT_MODS)
#==============================================================================
# ** Data_EquipmentSets
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This class is a wrapper for an array of Data_EquipmentSet objects
#==============================================================================

class Data_EquipmentSets
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize
    @data = []
    @equips = {}
    for i in 1...$data_weapons.size
      $data_weapons[i].set_ids.each { |set_id|
        @equips[set_id] = [] if !@equips[set_id]
        @equips[set_id].push ([1, i])
      }
    end
    for i in 1...$data_armors.size
      $data_armors[i].set_ids.each { |set_id|
        @equips[set_id] = [] if !@equips[set_id]
        @equips[set_id].push ([2, i])
      }
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Set
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def [] (id)
    if !@data[id]
      name = ESB_SET_BONUSES[id][:name].to_s
      states = ESB_SET_BONUSES[id][:states]
      stats = []
      ESB_STAT_MODS.each { |sym| stats.push (ESB_SET_BONUSES[id][sym]) }
      @data[id] = Data_EquipmentSet.new (id, name, @equips[id], states, *stats)
    end
    return @data[id]
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Equips
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def get_equips (id)
    equips = []
    @equips[id].each { |type, item_id|
      equip = case type
      when 1 then $data_weapons[item_id]
      when 2 then $data_armors[item_id]
      end
      equips.push (equip)
    }
    return equips
  end
end

#==============================================================================
# ** RPG::BaseItem
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - set_ids
#==============================================================================

class RPG::BaseItem
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set IDs
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def set_ids
    set_ids = []
    self.note.scan (/\\SET\[[\d,\s]+\]/i).each { |string|
      string.scan (/\d+/).each { |id| set_ids.push (id.to_i) }
    }
    return set_ids
  end
end

#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - initialize, change_equip, (+ ESB_STAT_MODS)
#    new methods - calculate_set_bonuses
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * ESB_STATS aliases
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  (ESB_STAT_MODS).each { |sym|
    attr_accessor "set_#{sym}".to_sym
    next if [:maxhp, :maxmp].include? (sym)
EQPSET_ALIAS = <<__END__
    alias malg_eqpsets_#{sym} #{sym}
    def #{sym} (*args)
      @#{sym}_plus = 0 if !@#{sym}_plus
      @#{sym}_plus += @set_#{sym}
      value = malg_eqpsets_#{sym} (*args)
      @#{sym}_plus -= @set_#{sym}
      return value
    end
__END__
    eval (EQPSET_ALIAS)
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * MaxHP, MaxMP
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalgb_esbmaxhp_8i3k maxhp
  def maxhp (*args)
    @maxhp_plus += @set_maxhp
    value = modalgb_esbmaxhp_8i3k (*args)
    @maxhp_plus -= @set_maxhp
    @hp = [@hp, value].min
    return value
  end
  alias modrn_esb_mxmp_5sc2 maxmp
  def maxmp (*args)
    @maxmp_plus += @set_maxmp
    value = modrn_esb_mxmp_5sc2 (*args)
    @maxmp_plus -= @set_maxmp
    @mp = [@mp, value].min
    return value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias monalb_esb_intze_6yj2 initialize
  def initialize (*args)
    ESB_STAT_MODS.each { |sym| self.send ("set_#{sym}=".to_sym, 0) }
    @set_states = []
    monalb_esb_intze_6yj2 (*args) # Run Original Method
    calculate_set_bonuses
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Calculate Set Bonuses
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def calculate_set_bonuses
    ESB_STAT_MODS.each { |sym| self.send ("set_#{sym}=".to_sym, 0) }
    @set_states = []
    sets_to_check = []
    equips.each { |equip|
      next unless equip
      sets_to_check.push (*equip.set_ids)
    }
    sets_to_check.uniq.each { |set_id|
      set_equips = $data_equipmentsets.get_equips (set_id)
      if (set_equips & equips).size == set_equips.size
        eqpset = $data_equipmentsets[set_id]
        ESB_STAT_MODS.each { |sym|
          self.send ( "set_#{sym}=".to_sym, self.send ("set_#{sym}".to_sym) + eqpset.send (sym) )
        }
        @set_states += eqpset.states
      end
    }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Change Equipment
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias monab_eqsetbon_chngeqp_1ax3 change_equip
  def change_equip (*args)
    monab_eqsetbon_chngeqp_1ax3 (*args) # Run Original Method
    calculate_set_bonuses
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * States
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias monabra_equps_states_1dc4 states
  def states (*args)
    result = monabra_equps_states_1dc4 (*args) # Run Original Method
    for state_id in @set_states
      state = $data_states[state_id]
      next if result.include? (state)
      skip = false
      result.each { |state2|
        if state2.state_set.include? (state.id)
          skip = true
          break
        end
      }
      next if skip
      state.state_set.each { |state_id|
        result.delete ($data_states[state_id])
        remove_state (state_id)
        @removed_states.delete (state_id) # Don't report its removal
      }
      result.push (state)
    end
    return result
  end
end

#==============================================================================
# ** Window_Selectable
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - esb_help_display_check
#==============================================================================

class Window_Selectable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * ESB Help Display Check
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def esb_help_display_check
    if Input.press? (ESB_SET_DISPLAY_BUTTON)
      return true if @esb_item_check == item
      @esb_item_check = item
      if item && !item.set_ids.empty?
        set_names = []
        item.set_ids.each { |id|
          name = $data_equipmentsets[id].name
          set_names.push (name) if !set_names.include? (name) && !name.empty?
        }
        if !set_names.empty?
          string = ESB_SET_DISPLAY_VOCAB
          set_names.each { |name| string += "#{name}; " }
          string.slice! (-2, 2)
          @help_window.set_text (string)
          return true
        end
      end
    else
      @esb_item_check = nil
    end
    return false
  end
end

#==============================================================================
# ** Window_Item
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - update_help
#==============================================================================

class Window_Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Help
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mdrnab_esb_updhlp_7ux4 update_help
  def update_help (*args)
    # Run Original Method if not showing set
    mdrnab_esb_updhlp_7ux4 (*args) unless esb_help_display_check
  end
end

#==============================================================================
# ** Window_Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - update_help
#==============================================================================

class Window_Equip
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Help
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modlg_esbonus_hlpupte_6yh2 update_help
  def update_help (*args)
    # Run Original Method if not showing set
    modlg_esbonus_hlpupte_6yh2 (*args) unless esb_help_display_check
  end
end

#==============================================================================
# ** Scene_Title
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - load_database; load_bt_database
#==============================================================================

class Scene_Title
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Load Database
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalb_eqpsets_loddata_8ik4 load_database
  def load_database (*args)
    modalb_eqpsets_loddata_8ik4 (*args) # Run Original Method
    $data_equipmentsets = Data_EquipmentSets.new
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Load Battle Test Database
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias morn_ests_btdatald_3ez2 load_bt_database
  def load_bt_database (*args)
    morn_ests_btdatald_3ez2 (*args) # Run Original Method
    $data_equipmentsets = Data_EquipmentSets.new
  end
end

Credit


  • modern algebra

Thanks

  • Zeriab, for the countless aid he's given me over the years, and in particular for a few tricks that came in handy for this script.

Support


Please post in this thread at RMRK if you have any bugs or incompatibilities to report, or if you have ideas for a new version.

Known Compatibility Issues

No currently known compatibility errors. While the script allows you to set up other scripts within it, such as the YEM New Battler Stats, they will only work if those stats abide by the same structure that the default stats do, meaning that they need to have a method in Game_Battler that returns the value, and they need to have an instance variable: @plus_<> that allows to give bonuses. If you are unsure if a script will work with this, then please post in this topic and I will tell you.

Demo


Demo Link. Please note, however, that this is only meant to be a sample of what the script can do. It is better for you if you retrieve the script from this post, rather than the demo, as the demo is setup for use with Global Text Codes.
« Last Edit: September 16, 2010, 08:31:26 PM by modern algebra »

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Holy fucking shit way cool

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
Epically awesome.

**
Rep: +0/-0Level 83
...whatever
Wow I didn't even thought about such a thing yet. It's really awesome Modern Algebra, but so are all your scripts. Easy to use(atleast I think it is), they are awesome, they add awesome features to your game and it has an awesome creator!:D

Which Final Fantasy Character Are You?
Final Fantasy 7

1 thing: my english is very bad because im dislexion and im dutchXD

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
I'm glad you all like it :)

***
Rep:
Level 75
What the...?
Well, I'm unsure if this is considered Necroposting.  I got the 60 day warning there.  If so, I apologize.

But, I have an idea about this script and a question about the global text codes option, Modern.

I have seen scripts called "LevelUpEffects" or something like that where Leveling up causes other things to happen at the moment it occurs.  I was wondering if there was a way to make an "EquipmentSetEffect".  Like, if the player equips all the items in the set, it calls a common event, like a quick cut scene or something, which shows the actor transforming into his new form.   Anyway, it's just a thought.

As far as the Global Text thing goes.  I'm not quite sure I get how to use it.  Do I just place the codes into weapon/item/armor name box preceding the name of the armor?  And if I do this, then will the ATS pick up on this if I have made reference to the weapon/item/armor name in a message box?  What I mean is if I put \wn (or whatever it is in the ATS to call the weapon's name into a message), Will it read the wierd slash code in front of the weapon name which I used to change it's color in other scenes?


I ask this because it's something that's always confused me about placing codes in Map Names for instance.   If I have a Quick Map Name PopUp script and then try to add "NOJUMP" like one of my scripts suggests, would the popup read "New York City NOJUMP" or just "New York City".

I know that's not your script.  But it was just a concern I had about the Global Text Script and the ATS together.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Well, it's a valid concern. Sticking with your example, there are ways that a scripter can make it so that special codes placed in a map name do not show up in anything else that shows the map name. Basically, it involves a simple alias of the name method that returns the name without the code. Most of the scripts like this I've seen don't unfortunately, but it is a very easy modification in the case of most scripts like what you mention.

Global Text Codes is a little different, since for it to work, it requires that the codes be retrieved with the name and so that nice solution doesn't exist. As for the ATS or other message systems, there is the potential that this could be problematic, since they parse scripts by character and so provide no opportunity for the Global Text Codes script to work. However, most of the codes used in Global Text codes correspond to the ATS codes, which means that it will generally be OK, since while GTC won't interpret "\c[1]Sword\c[0]" so as to recolor the word Sword, the ATS will since it uses the same codes to do the same things. There may be issues with bold and italics though, since they operate a little differently between the two scripts.

So in short, the ATS and GTC will likely work together, however you will be stuck with the codes in the GTC. So if the name is "\c[1]Sword\c[0]", but in a message you wanted to color it to 2 instead with the code: "\c[2]\nw[1]\c[0], you're out of luck - it will color it to 1 instead. If you really wanted it, you'd have to write out the name of the weapon manually in the ATS, like: "\c[2]Sword\c[0]". Similarly, with other message systems, the scripts will work together to the extent that their special codes correspond. So stuff like the color code \c[a] will work across all message systems since it's default, whereas other codes like \vocab[a] may only work with the ATS.

Generally though, you could've figured that out a lot faster simply by trying the two scripts together :P

***
Rep:
Level 75
What the...?
Yeah.  You're right.  I should've tried first.  But that was a great explanation, and I can see myself resorting back to this post at some point.  Thanks for the insight.

**
Rep:
Level 66
Haven't been on for ages -.-
EXCELLENT MAN you've done it again....

but is it compatible with grid inventory?

**
Rep: +0/-0Level 65
RMRK Junior
okay so i got the script in my game and every time i run the test play an error pops up about line 342 in the script. I'm not sure what to do here so any helpful advice would be very appreciated.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
My guess would be an incompatibility with one of your other scripts. What does the error say?

Also, you must make sure your configuration is in order. You shouldn't have items that refer to non-existent sets.

Also, take a look at the Script Incompatibilities heading of this post: http://rmrk.net/index.php/topic,40220.0.html

Go through that process and identify which of the other scripts is causing the incompatibility. Then try putting the Equipment Set Bonuses script underneath that one (but still above Main).

« Last Edit: September 15, 2011, 01:56:14 AM by modern algebra »

**
Rep: +0/-0Level 65
RMRK Junior
alright so it did post lol
and thanks. the link you gave me helped out a lot.
it was as simple as just starting a new game instead of trying to load my old one.
but once again thanks for you time and the help(:

***
Rep:
Level 68
RMRK Junior
Keep getting a syntax error at the end of script line 453, loaded the script into brand new game, the script text goes black at line 262, i've added a comment below.. Any ideas?
Code: [Select]
#==============================================================================
#    Equipment Set Bonuses
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: May 24, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:

#    This script allows you to set bonuses to stats if an actor is wearing
#   equipment of the same set, such as in Diablo II or Dragon Age: Origins.
#    With this script, for instance, you could make a sword with ATK 10 and
#   a Shield with DEF 10, but if you have both that sword and shield equipped
#   you would get an additional 5 ATK and DEF, so that you would get 15 ATK and
#   15 DEF. By default, you can make sets that can give bonuses to maxhp, maxmp,
#   atk, def, spi, and agi, as well as apply states.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script in its own slot in the Script Editor (F11), somewhere
#   below Materials but above Main.
#
#    To setup sets and the bonuses they will give, go to line x38 and read the
#   instructions located there.
#
#    To assign an equipment to a set, simply put the following code in its
#   notebox:
#        \SET[set_id]
#          set_id : the ID of the set this equipment belongs to, as per the
#            setup at line 48.
#    Note that you can assign the same piece of equipment to multiple sets by
#   placing a comma and writing the next set_id, like so:
#        \SET[set_id_1, set_id_2, ..., set_id_n]
#==============================================================================
ESB_SET_BONUSES = { # <- Do not touch this line
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#  EDITABLE REGION
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  ESB_SET_BONUSES -
#    This is where you set up the sets, give them a name, and determine what
#   bonuses they give if an actor is wearing a complete set. The format for
#   setting it up is:
#
#     set_id => {
#       :name => "name",
#       :states => [state_ids],
#       :maxhp => maxhp_bonus,
#       :maxmp => maxmp_bonus,
#       :atk => atk_bonus,
#       :def => def_bonus,
#       :spi => spi_bonus,
#       :agi => agi_bonus
#     }
#
#    where:
#      set_id - the ID of the set. This is used to identify which equipment
#        belongs to which set, which you do in the note field of the equipment.
#        See line 27 for details. Note that this must be an integer, but beyond
#        that can be anything. Whatever you do though, this must be unique, so
#        don't make more than one set with this ID.
#      "name" - the name of the set. This is what will show up in the help box
#        when you press the Display button (see line yy to set) on a set item.
#        It can be used for more than one set, if you want to create bonuses
#        for partial sets.
#      [state_ids] - this is an array of states that should be applied if an
#        actor has completed this set. So, if you want an actor who wears a
#        complete set to have a state applied, put the ID of that state in this
#        array, like so: [10] - that would apply state 10 (by default, DEF UP)
#        for as long as the complete set is equipped. [9, 10] would apply both
#        states 9 and 10 (by default, ATK UP and DEF UP).
#      stat_bonus - the rest of them are the value of whatever bonus you want
#        applied to that stat. So, if you want a complete set to give a bonus
#        of 10 to DEF and a bonus of 5 to agi, you would have:
#          :def => 10,
#          :agi => 5
#        If you do not set a stat, it will default to 0, meaning it won't give
#        a bonus to that particular stat.
#  EXAMPLES:
#
#    1 => {
#      :name => "Leopold's Outfit",
#      :atk => 5,
#      :def => 15,
#      :agi => 3
#    },
#
#  That code creates a set with ID 1, meaning that all items that have the code
# \set[1] in their note field must be equipped for these bonuses to be active.
# The name that shows up when hovering over an item of that script and pressing
# the display button is Leopold's Outfit. When all items of that set are
# equipped, the actor gets a bonus of 5 to his/her attack, 15 to his/her
# defence, and 3 to his/her agility.
#
#    3 => {
#      :name => "Heaven's Wrath",
#      :states => [9]
#      :maxhp => 250,
#      :maxmp => -250,
#      :spi => -25
#    },
#
#  That code creates a set with ID 3, meaning that all items that have the code
# \set[3] in their note field must be equipped for these bonuses to be active.
# The name that shows up when hovering over an item of that script and pressing
# the display button is Heaven's Wrath. When all items of that set are equipped,
# the actor has the state with ID 9 applied (ATK UP by default), gets an extra
# 250 MaxHP, loses 250 MaxMP, and loses 25 Spirit
#
#  Note that you can potentially add more stats via ESB_STAT_MODS at line zz,
# but only if you are using some script that gives more stats to actors and it
# follows the same format as the atk, def, spi, and agi methods. Read the
# instructions at line zz for more details.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 => {     
  :name => "",   
  :states => [],
  :maxhp => 0,
  :maxmp => 0,
  :atk => 0,
  :def => 0, 
  :spi => 0, 
  :agi => 0
  },
  2 => { # EXAMPLE
  :name => "Leopold's Haven",
  :def => 10
  }
} # <- do not touch the } on this line
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  # ESB_SET_DISPLAY_BUTTON -
  #  This allows you to set a button, that, when pressed while hovering over a set
  # item in the item or equip scenes, will show the name of the set(s) it belongs
  # to. Note that it requires a button, which doesn't necessarily correspond to
  # that key on the keyboard. Press F1 during testplay to see a list of the
  # buttons and what key they correspond to.
  ESB_SET_DISPLAY_BUTTON = Input::SHIFT
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  # ESB_SET_DISPLAY_VOCAB -
  #  This is the text that will appear directly before the list of names of the
  # sets the item belongs to when pressing ESB_SET_DISPLAY_BUTTON while hovering
  # over a set item.ESB_SET_DISPLAY_VOCAB = "Set Item: "
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  # ESB_STAT_MODS -
  #  You probably shouldn't touch this. It is simply a way to add other
  # possibilities for stat bonuses, where those stats are set up more or less in
  # the same way that the default atk, def, spi, and agi stats are. For example,
  # if you are using YEM New Battler Stats, you could add them to this array as
  #   :res, :dex
  # Then, where you set up the set bonuses at line 38, you could use the codes:
  #    :res => x,
  #    :dex => y
  # and those bonuses would be granted when you complete the set. But you need to
  # add them to the below array if you want to be able to do it, so:
  #  ESB_STAT_MODS = [:maxhp, :maxmp, :atk, :def, :spi, :agi, :res, :dex]
  #
  #  NB: that's only if you have YEM New Battler Stats, and if you do, you will
  # need to put the New Battler Stats script above this one in the editor, and you
  # would need to get the compatibility patch located in the main topic thread
  ESB_STAT_MODS = [:maxhp, :maxmp, :atk, :def, :spi, :agi]
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  #  END EDITABLE REGION
  #//////////////////////////////////////////////////////////////////////////////
  ESB_SET_BONUSES.each_value { |set|
    set[:name] = "" if !set[:name]
    set[:states] = [] if !set[:states]
    set.default = 0
    }
  #==============================================================================
  # ** Data_EquipmentSet
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  This struct holds all relevant data on an Equipment Set
  #==============================================================================
 
  Data_EquipmentSet = Struct.new (:id, :name, :equips, :states, *ESB_STAT_MODS)
  #==============================================================================
  # ** Data_EquipmentSets
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  This class is a wrapper for an array of Data_EquipmentSet objects
  #==============================================================================
 
  class Data_EquipmentSets
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Object Initialization
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def initialize
      @data = []
      @equips = {}
      for i in 1...$data_weapons.size
        $data_weapons[i].set_ids.each { |set_id|
        @equips[set_id] = [] if !@equips[set_id] 
        @equips[set_id].push ([1, i]) 
        }
      end 
      for i in 1...$data_armors.size
        $data_armors[i].set_ids.each { |set_id|
        @equips[set_id] = [] if !@equips[set_id]
        @equips[set_id].push ([2, i])
        } 
      end
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Get Set
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   
    def [] (id) 
      if !@data[id]   
        name = ESB_SET_BONUSES[id][:name].to_s 
        states = ESB_SET_BONUSES[id][:states] 
        stats = [] 
        ESB_STAT_MODS.each { |sym| stats.push (ESB_SET_BONUSES[id][sym]) }
        @data[id] = Data_EquipmentSet.new (id, name, @equips[id], states, *stats)
      end
      return @data[id] 
    end 
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Get Equips
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    def get_equips (id) 
      equips = []
      @equips[id].each { |type, item_id|
      equip = case type 
      when 1 then $data_weapons[item_id]   
        when 2 then $data_armors[item_id]
        end   
        equips.push (equip)
        }
        return equips
      end
    end
    #==============================================================================
    # ** RPG::BaseItem
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  Summary of Changes:
    #    new method - set_ids
    #==============================================================================
    class RPG::BaseItem
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Set IDs
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      def set_ids 
        set_ids = []
        self.note.scan (/\\SET\[[\d,\s]+\]/i).each { |string|
        string.scan (/\d+/).each { |id| set_ids.push (id.to_i) }
        }
        return set_ids
      end
    end
    #==============================================================================
    # ** Game_Actor
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  Summary of Changes:
    #    aliased methods - initialize, change_equip, (+ ESB_STAT_MODS)
    #    new methods - calculate_set_bonuses
    #==============================================================================
   
    class Game_Actor 
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * ESB_STATS aliases
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      (ESB_STAT_MODS).each { |sym|
      attr_accessor "set_#{sym}".to_sym
      next if [:maxhp, :maxmp].include? (sym)
      EQPSET_ALIAS =  <<__END__      #<-----Text after here is black.
      alias malg_eqpsets_#{sym} #{sym}
      def #{sym} (*args)
        @#{sym}_plus = 0 if !@#{sym}_plus
        @#{sym}_plus += @set_#{sym}
        value = malg_eqpsets_#{sym} (*args)
        @#{sym}_plus -= @set_#{sym}
        return value
      end
      __END__
      eval (EQPSET_ALIAS)
      }
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      # * MaxHP, MaxMP 
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      alias modalgb_esbmaxhp_8i3k maxhp
      def maxhp (*args)
        @maxhp_plus += @set_maxhp
        value = modalgb_esbmaxhp_8i3k (*args)
        @maxhp_plus -= @set_maxhp
        @hp = [@hp, value].min
        return value
      end
      alias modrn_esb_mxmp_5sc2 maxmp
      def maxmp (*args)
        @maxmp_plus += @set_maxmp
        value = modrn_esb_mxmp_5sc2 (*args)
        @maxmp_plus -= @set_maxmp
        @mp = [@mp, value].min
        return value
      end
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Object Initialization
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      alias monalb_esb_intze_6yj2 initialize
      def initialize (*args)
        ESB_STAT_MODS.each { |sym| self.send ("set_#{sym}=".to_sym, 0) }
        @set_states = [] 
        monalb_esb_intze_6yj2 (*args) # Run Original Method 
        calculate_set_bonuses
      end 
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Calculate Set Bonuses
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      def calculate_set_bonuses
        ESB_STAT_MODS.each { |sym| self.send ("set_#{sym}=".to_sym, 0) }
        @set_states = []
        sets_to_check = []
        equips.each { |equip|
        next unless equip
        sets_to_check.push (*equip.set_ids)
        }
        sets_to_check.uniq.each { |set_id|
        set_equips = $data_equipmentsets.get_equips (set_id)
        if (set_equips & equips).size == set_equips.size
          eqpset = $data_equipmentsets[set_id]
          ESB_STAT_MODS.each { |sym|
          self.send ( "set_#{sym}=".to_sym, self.send ("set_#{sym}".to_sym) + eqpset.send (sym) )
          }
          @set_states += eqpset.states   
        end
        }
      end
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Change Equipment
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      alias monab_eqsetbon_chngeqp_1ax3 change_equip
      def change_equip (*args)
        monab_eqsetbon_chngeqp_1ax3 (*args) # Run Original Method
        calculate_set_bonuses
      end
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      # * States
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      alias monabra_equps_states_1dc4 states  def states (*args)   
      result = monabra_equps_states_1dc4 (*args) # Run Original Method 
      for state_id in @set_states
        state = $data_states[state_id]
        next if result.include? (state)
        skip = false   
        result.each { |state2| 
        if state2.state_set.include? (state.id) 
          skip = true     
          break   
        end 
        }
        next if skip
        state.state_set.each { |state_id|
        result.delete ($data_states[state_id])
        remove_state (state_id)
        @removed_states.delete (state_id) # Don't report its removal
        } 
        result.push (state)
      end
      return result
    end
  end
  #==============================================================================
  # ** Window_Selectable
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    new method - esb_help_display_check
  #==============================================================================
 
  class Window_Selectable
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * ESB Help Display Check
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def esb_help_display_check 
      if Input.press? (ESB_SET_DISPLAY_BUTTON)
        return true if @esb_item_check == item
        @esb_item_check = item 
        if item && !item.set_ids.empty?
          set_names = [] 
          item.set_ids.each { |id| 
          name = $data_equipmentsets[id].name 
          set_names.push (name) if !set_names.include? (name) && !name.empty? 
          }   
          if !set_names.empty?
            string = ESB_SET_DISPLAY_VOCAB
            set_names.each { |name| string += "#{name}; " }
            string.slice! (-2, 2) 
            @help_window.set_text (string)
            return true
          end   
        end 
      else
        @esb_item_check = nil
      end   
      return false
    end
  end
  #==============================================================================
  # ** Window_Item
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    aliased method - update_help
  #==============================================================================
  class Window_Item 
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Update Help
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    alias mdrnab_esb_updhlp_7ux4 update_help  def update_help (*args)   
    # Run Original Method if not showing set 
    mdrnab_esb_updhlp_7ux4 (*args) unless esb_help_display_check
  end
end
#==============================================================================
# ** Window_Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - update_help
#==============================================================================
class Window_Equip
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Help 
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modlg_esbonus_hlpupte_6yh2 update_help
  def update_help (*args)
    # Run Original Method if not showing set
    modlg_esbonus_hlpupte_6yh2 (*args) unless esb_help_display_check
  end
end
#==============================================================================
# ** Scene_Title
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - load_database; load_bt_database
#==============================================================================

class Scene_Title
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  # * Load Database
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalb_eqpsets_loddata_8ik4 load_database
  def load_database (*args)
    modalb_eqpsets_loddata_8ik4 (*args)
    # Run Original Method 
    $data_equipmentsets = Data_EquipmentSets.new
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  # * Load Battle Test Database
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  alias morn_ests_btdatald_3ez2 load_bt_database
  def load_bt_database (*args) 
    morn_ests_btdatald_3ez2 (*args)
    # Run Original Method   
    $data_equipmentsets = Data_EquipmentSets.new
  end
end



*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Why is the indenting all messed up? Just copy the script from the demo if you're having trouble copying from the post.

Anyway, all you need to do to fix that problem is replace line 272:

Code: [Select]
        __END__

with:

Code: [Select]
__END__

(ie. it needs to be flush to the left and not have any spaces after it)

Just test the demo. Does that work for you?

***
Rep:
Level 68
RMRK Junior
Yes, now it works fine.  The problem with copy and pasting from this forum is that when I put it into script editor it is all on one line and I have to manually line by line fix it... >.<   Thanks for your help, MA. As always!

*
Rep:
Level 81
It would be worth installing a copy of Firefox or Chrome for when you want/need to copy a script from the forum directly (where you can download a demo this isn't necessary - just download the demo and copy the script). Some browsers, like IE, don't like to keep the formatting when you copy/paste.

Even if you aren't a fan of browsing using these other programs, you can do your normal browsing in your usual browser and just copy the address to get to the code you want.

For some scripts in which there are a lot of lines, or the formatting is incredibly important, this would save you a lot of hassle. Some code could also be written in a way which is pretty complex and that'd lead to some pretty rough messing around trying to figure out why it won't work after you formatted it.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

***
Rep:
Level 68
RMRK Junior
Thanks for the advice. :)

MA, I'm having a problem with this script I have:
Code: [Select]
#==============================================================================
#    Equipment Set Bonuses
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: May 24, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:

#    This script allows you to set bonuses to stats if an actor is wearing
#   equipment of the same set, such as in Diablo II or Dragon Age: Origins.
#    With this script, for instance, you could make a sword with ATK 10 and
#   a Shield with DEF 10, but if you have both that sword and shield equipped#   you would get an additional 5 ATK and DEF, so that you would get 15 ATK and
#   15 DEF. By default, you can make sets that can give bonuses to maxhp, maxmp,
#   atk, def, spi, and agi, as well as apply states.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script in its own slot in the Script Editor (F11), somewhere
#   below Materials but above Main.
#
#    To setup sets and the bonuses they will give, go to line x38 and read the
#   instructions located there.
#
#    To assign an equipment to a set, simply put the following code in its
#   notebox:
#        \SET[set_id]
#          set_id : the ID of the set this equipment belongs to, as per the
#            setup at line 48.
#    Note that you can assign the same piece of equipment to multiple sets by
#   placing a comma and writing the next set_id, like so:
#        \SET[set_id_1, set_id_2, ..., set_id_n]
#==============================================================================
ESB_SET_BONUSES = { # <- Do not touch this line
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#  EDITABLE REGION
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  ESB_SET_BONUSES -
#    This is where you set up the sets, give them a name, and determine what
#   bonuses they give if an actor is wearing a complete set. The format for
#   setting it up is:
#
#     set_id => {
#       :name => "name",
#       :states => [state_ids],#       :maxhp => maxhp_bonus,
#       :maxmp => maxmp_bonus,
#       :atk => atk_bonus,
#       :def => def_bonus,
#       :spi => spi_bonus,
#       :agi => agi_bonus
#     }
#
#    where:
#      set_id - the ID of the set. This is used to identify which equipment
#        belongs to which set, which you do in the note field of the equipment.
#        See line 27 for details. Note that this must be an integer, but beyond
#        that can be anything. Whatever you do though, this must be unique, so
#        don't make more than one set with this ID.
#      "name" - the name of the set. This is what will show up in the help box
#        when you press the Display button (see line yy to set) on a set item.
#        It can be used for more than one set, if you want to create bonuses #        for partial sets.
#      [state_ids] - this is an array of states that should be applied if an
#        actor has completed this set. So, if you want an actor who wears a
#        complete set to have a state applied, put the ID of that state in this
#        array, like so: [10] - that would apply state 10 (by default, DEF UP)
#        for as long as the complete set is equipped. [9, 10] would apply both
#        states 9 and 10 (by default, ATK UP and DEF UP).
#      stat_bonus - the rest of them are the value of whatever bonus you want
#        applied to that stat. So, if you want a complete set to give a bonus
#        of 10 to DEF and a bonus of 5 to agi, you would have:
#          :def => 10,
#          :agi => 5
#        If you do not set a stat, it will default to 0, meaning it won't give
#        a bonus to that particular stat.
#  EXAMPLES:
#
#    1 => {
#      :name => "Leopold's Outfit",
#      :atk => 5,
#      :def => 15,
#      :agi => 3
#    },
#
#  That code creates a set with ID 1, meaning that all items that have the code
# \set[1] in their note field must be equipped for these bonuses to be active.
# The name that shows up when hovering over an item of that script and pressing
# the display button is Leopold's Outfit. When all items of that set are
# equipped, the actor gets a bonus of 5 to his/her attack, 15 to his/her
# defence, and 3 to his/her agility.
#
#    3 => {
#      :name => "Heaven's Wrath",
#      :states => [9]
#      :maxhp => 250,
#      :maxmp => -250,
#      :spi => -25
#    },
#
#  That code creates a set with ID 3, meaning that all items that have the code
# \set[3] in their note field must be equipped for these bonuses to be active.
# The name that shows up when hovering over an item of that script and pressing
# the display button is Heaven's Wrath. When all items of that set are equipped,
# the actor has the state with ID 9 applied (ATK UP by default), gets an extra
# 250 MaxHP, loses 250 MaxMP, and loses 25 Spirit
#
#  Note that you can potentially add more stats via ESB_STAT_MODS at line zz,
# but only if you are using some script that gives more stats to actors and it
# follows the same format as the atk, def, spi, and agi methods. Read the
# instructions at line zz for more details.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 => {     
  :name => "Chief Jeh'ran's Garb",   
  :maxhp => 523,
  :maxmp => 345,
  :atk => 90,
  :def => 100, 
  :spi => 200, 
  :agi => 10,
  },
  2 => { # EXAMPLE
  :name => "Leopold's Haven",
  :def => 10
  }
} # <- do not touch the } on this line
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  # ESB_SET_DISPLAY_BUTTON -
  #  This allows you to set a button, that, when pressed while hovering over a set
  # item in the item or equip scenes, will show the name of the set(s) it belongs
  # to. Note that it requires a button, which doesn't necessarily correspond to
  # that key on the keyboard. Press F1 during testplay to see a list of the
  # buttons and what key they correspond to.
  ESB_SET_DISPLAY_BUTTON = Input::SHIFT
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  # ESB_SET_DISPLAY_VOCAB -
  #  This is the text that will appear directly before the list of names of the
  # sets the item belongs to when pressing ESB_SET_DISPLAY_BUTTON while hovering
  # over a set item.ESB_SET_DISPLAY_VOCAB = "Set Item: "
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  # ESB_STAT_MODS -
  #  You probably shouldn't touch this. It is simply a way to add other
  # possibilities for stat bonuses, where those stats are set up more or less in
  # the same way that the default atk, def, spi, and agi stats are. For example,
  # if you are using YEM New Battler Stats, you could add them to this array as
  #   :res, :dex
  # Then, where you set up the set bonuses at line 38, you could use the codes:
  #    :res => x,
  #    :dex => y
  # and those bonuses would be granted when you complete the set. But you need to
  # add them to the below array if you want to be able to do it, so:
  #  ESB_STAT_MODS = [:maxhp, :maxmp, :atk, :def, :spi, :agi, :res, :dex]
  #
  #  NB: that's only if you have YEM New Battler Stats, and if you do, you will
  # need to put the New Battler Stats script above this one in the editor, and you
  # would need to get the compatibility patch located in the main topic thread
  ESB_STAT_MODS = [:maxhp, :maxmp, :atk, :def, :spi, :agi]
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  #  END EDITABLE REGION
  #//////////////////////////////////////////////////////////////////////////////
  ESB_SET_BONUSES.each_value { |set|
    set[:name] = "" if !set[:name]
    set[:states] = [] if !set[:states]
    set.default = 0
    }
  #==============================================================================
  # ** Data_EquipmentSet
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  This struct holds all relevant data on an Equipment Set
  #==============================================================================
 
  Data_EquipmentSet = Struct.new (:id, :name, :equips, :states, *ESB_STAT_MODS)
  #==============================================================================
  # ** Data_EquipmentSets
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  This class is a wrapper for an array of Data_EquipmentSet objects
  #==============================================================================
 
  class Data_EquipmentSets
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Object Initialization
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def initialize
      @data = []
      @equips = {}
      for i in 1...$data_weapons.size
        $data_weapons[i].set_ids.each { |set_id|
        @equips[set_id] = [] if !@equips[set_id] 
        @equips[set_id].push ([1, i]) 
        }
      end 
      for i in 1...$data_armors.size
        $data_armors[i].set_ids.each { |set_id|
        @equips[set_id] = [] if !@equips[set_id]
        @equips[set_id].push ([2, i])
        } 
      end
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Get Set
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   
    def [] (id) 
      if !@data[id]   
        name = ESB_SET_BONUSES[id][:name].to_s 
        states = ESB_SET_BONUSES[id][:states] 
        stats = [] 
        ESB_STAT_MODS.each { |sym| stats.push (ESB_SET_BONUSES[id][sym]) }
        @data[id] = Data_EquipmentSet.new (id, name, @equips[id], states, *stats)
      end
      return @data[id] 
    end 
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Get Equips
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    def get_equips (id) 
      equips = []
      @equips[id].each { |type, item_id|
      equip = case type 
      when 1 then $data_weapons[item_id]   
        when 2 then $data_armors[item_id]
        end   
        equips.push (equip)
        }
        return equips
      end
    end
    #==============================================================================
    # ** RPG::BaseItem
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  Summary of Changes:
    #    new method - set_ids
    #==============================================================================
    class RPG::BaseItem
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Set IDs
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      def set_ids 
        set_ids = []
        self.note.scan (/\\SET\[[\d,\s]+\]/i).each { |string|
        string.scan (/\d+/).each { |id| set_ids.push (id.to_i) }
        }
        return set_ids
      end
    end
    #==============================================================================
    # ** Game_Actor
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  Summary of Changes:
    #    aliased methods - initialize, change_equip, (+ ESB_STAT_MODS)
    #    new methods - calculate_set_bonuses
    #==============================================================================
   
    class Game_Actor 
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * ESB_STATS aliases
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      (ESB_STAT_MODS).each { |sym|
      attr_accessor "set_#{sym}".to_sym
      next if [:maxhp, :maxmp].include? (sym)
      EQPSET_ALIAS =  <<__END__
      alias malg_eqpsets_#{sym} #{sym}
      def #{sym} (*args)
        @#{sym}_plus = 0 if !@#{sym}_plus
        @#{sym}_plus += @set_#{sym}
        value = malg_eqpsets_#{sym} (*args)
        @#{sym}_plus -= @set_#{sym}
        return value
      end
__END__
      eval (EQPSET_ALIAS)
      }
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      # * MaxHP, MaxMP 
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      alias modalgb_esbmaxhp_8i3k maxhp
      def maxhp (*args)
        @maxhp_plus += @set_maxhp
        value = modalgb_esbmaxhp_8i3k (*args)
        @maxhp_plus -= @set_maxhp
        @hp = [@hp, value].min
        return value
      end
      alias modrn_esb_mxmp_5sc2 maxmp
      def maxmp (*args)
        @maxmp_plus += @set_maxmp
        value = modrn_esb_mxmp_5sc2 (*args)
        @maxmp_plus -= @set_maxmp
        @mp = [@mp, value].min
        return value
      end
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Object Initialization
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      alias monalb_esb_intze_6yj2 initialize
      def initialize (*args)
        ESB_STAT_MODS.each { |sym| self.send ("set_#{sym}=".to_sym, 0) }
        @set_states = [] 
        monalb_esb_intze_6yj2 (*args) # Run Original Method 
        calculate_set_bonuses
      end 
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Calculate Set Bonuses
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      def calculate_set_bonuses
        ESB_STAT_MODS.each { |sym| self.send ("set_#{sym}=".to_sym, 0) }
        @set_states = []
        sets_to_check = []
        equips.each { |equip|
        next unless equip
        sets_to_check.push (*equip.set_ids)
        }
        sets_to_check.uniq.each { |set_id|
        set_equips = $data_equipmentsets.get_equips (set_id)
        if (set_equips & equips).size == set_equips.size
          eqpset = $data_equipmentsets[set_id]
          ESB_STAT_MODS.each { |sym|
          self.send ( "set_#{sym}=".to_sym, self.send ("set_#{sym}".to_sym) + eqpset.send (sym) )
          }
          @set_states += eqpset.states   
        end
        }       end
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Change Equipment
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      alias monab_eqsetbon_chngeqp_1ax3 change_equip
      def change_equip (*args)
        monab_eqsetbon_chngeqp_1ax3 (*args) # Run Original Method
        calculate_set_bonuses
      end
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      # * States
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      alias monabra_equps_states_1dc4 states 
      def states (*args)   
      result = monabra_equps_states_1dc4 (*args) # Run Original Method 
      for state_id in @set_states
        state = $data_states[state_id]
        next if result.include? (state)
        skip = false   
        result.each { |state2| 
        if state2.state_set.include? (state.id) 
          skip = true     
          break   
        end 
        }
        next if skip
        state.state_set.each { |state_id|
        result.delete ($data_states[state_id])
        remove_state (state_id)
        @removed_states.delete (state_id) # Don't report its removal
        } 
        result.push (state)
      end
      return result
    end
  end
  #==============================================================================
  # ** Window_Selectable
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    new method - esb_help_display_check
  #==============================================================================
 
  class Window_Selectable
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * ESB Help Display Check
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def esb_help_display_check 
      if Input.press? (ESB_SET_DISPLAY_BUTTON)
        return true if @esb_item_check == item
        @esb_item_check = item 
        if item && !item.set_ids.empty?
          set_names = [] 
          item.set_ids.each { |id| 
          name = $data_equipmentsets[id].name 
          set_names.push (name) if !set_names.include? (name) && !name.empty? 
          }   
          if !set_names.empty?
            string = ESB_SET_DISPLAY_VOCAB
            set_names.each { |name| string += "#{name}; " }
            string.slice! (-2, 2) 
            @help_window.set_text (string)
            return true
          end   
        end 
      else
        @esb_item_check = nil
      end   
      return false
    end
  end
  #==============================================================================
  # ** Window_Item
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    aliased method - update_help
  #==============================================================================
  class Window_Item 
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Update Help
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    alias mdrnab_esb_updhlp_7ux4 update_help 
    def update_help (*args)       # Run Original Method if not showing set 
    mdrnab_esb_updhlp_7ux4 (*args) unless esb_help_display_check
  end
end
#==============================================================================
# ** Window_Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - update_help
#==============================================================================
class Window_Equip
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Help 
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modlg_esbonus_hlpupte_6yh2 update_help
  def update_help (*args)
    # Run Original Method if not showing set
    modlg_esbonus_hlpupte_6yh2 (*args) unless esb_help_display_check
  end
end
#==============================================================================
# ** Scene_Title
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - load_database; load_bt_database#==============================================================================

class Scene_Title
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  # * Load Database
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalb_eqpsets_loddata_8ik4 load_database
  def load_database (*args)
    modalb_eqpsets_loddata_8ik4 (*args)
    # Run Original Method 
    $data_equipmentsets = Data_EquipmentSets.new
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  # * Load Battle Test Database
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  alias morn_ests_btdatald_3ez2 load_bt_database
  def load_bt_database (*args) 
    morn_ests_btdatald_3ez2 (*args)
    # Run Original Method   
    $data_equipmentsets = Data_EquipmentSets.new
  end
end


When I press the shift key it glitches.. have you experienced this problem before?
            

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
No, I've never had that problem. It's occurred because you deleted the following line from your script for some reason:

Code: [Select]
ESB_SET_DISPLAY_VOCAB = "\\C[16]Set Item: \\c[0]"

It should be right after the following comment as it is both on the main page and in the demo:

Code: [Select]
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ESB_SET_DISPLAY_VOCAB -
#  This is the text that will appear directly before the list of names of the
# sets the item belongs to when pressing ESB_SET_DISPLAY_BUTTON while hovering
# over a set item.

If you have another problem, please recopy the script from the demo first and try to recreate the error. If you can't then it was an error with the copying and you've fixed it. Yay!

***
Rep:
Level 68
RMRK Junior
Ok, so I'm guessing the script only works with a new game?  However, now that it is working it's displaying text code while I press shift. and its displaying all in white instead of your nifty colors.. :(


Code: [Select]
#==============================================================================
#    Equipment Set Bonuses
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: May 24, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:

#    This script allows you to set bonuses to stats if an actor is wearing
#   equipment of the same set, such as in Diablo II or Dragon Age: Origins.
#    With this script, for instance, you could make a sword with ATK 10 and
#   a Shield with DEF 10, but if you have both that sword and shield equipped
#   you would get an additional 5 ATK and DEF, so that you would get 15 ATK and
#   15 DEF. By default, you can make sets that can give bonuses to maxhp, maxmp,
#   atk, def, spi, and agi, as well as apply states.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script in its own slot in the Script Editor (F11), somewhere
#   below Materials but above Main.
#
#    To setup sets and the bonuses they will give, go to line x38 and read the
#   instructions located there.
#
#    To assign an equipment to a set, simply put the following code in its
#   notebox:
#        \SET[set_id]
#          set_id : the ID of the set this equipment belongs to, as per the
#            setup at line 48.
#    Note that you can assign the same piece of equipment to multiple sets by
#   placing a comma and writing the next set_id, like so:
#        \SET[set_id_1, set_id_2, ..., set_id_n]
#==============================================================================
ESB_SET_BONUSES = { # <- Do not touch this line
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#  EDITABLE REGION
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  ESB_SET_BONUSES -
#    This is where you set up the sets, give them a name, and determine what
#   bonuses they give if an actor is wearing a complete set. The format for
#   setting it up is:
#
#     set_id => {
#       :name => "name",
#       :states => [state_ids],
#       :maxhp => maxhp_bonus,
#       :maxmp => maxmp_bonus,
#       :atk => atk_bonus,
#       :def => def_bonus,
#       :spi => spi_bonus,
#       :agi => agi_bonus
#     }
#
#    where:
#      set_id - the ID of the set. This is used to identify which equipment
#        belongs to which set, which you do in the note field of the equipment.
#        See line 27 for details. Note that this must be an integer, but beyond
#        that can be anything. Whatever you do though, this must be unique, so
#        don't make more than one set with this ID.
#      "name" - the name of the set. This is what will show up in the help box
#        when you press the Display button (see line yy to set) on a set item.
#        It can be used for more than one set, if you want to create bonuses
#        for partial sets.
#      [state_ids] - this is an array of states that should be applied if an
#        actor has completed this set. So, if you want an actor who wears a
#        complete set to have a state applied, put the ID of that state in this
#        array, like so: [10] - that would apply state 10 (by default, DEF UP)
#        for as long as the complete set is equipped. [9, 10] would apply both
#        states 9 and 10 (by default, ATK UP and DEF UP).
#      stat_bonus - the rest of them are the value of whatever bonus you want
#        applied to that stat. So, if you want a complete set to give a bonus
#        of 10 to DEF and a bonus of 5 to agi, you would have:
#          :def => 10,
#          :agi => 5
#        If you do not set a stat, it will default to 0, meaning it won't give
#        a bonus to that particular stat.
#  EXAMPLES:
#
#    1 => {
#      :name => "Leopold's Outfit",
#      :atk => 5,
#      :def => 15,
#      :agi => 3
#    },
#
#  That code creates a set with ID 1, meaning that all items that have the code
# \set[1] in their note field must be equipped for these bonuses to be active.
# The name that shows up when hovering over an item of that script and pressing
# the display button is Leopold's Outfit. When all items of that set are
# equipped, the actor gets a bonus of 5 to his/her attack, 15 to his/her
# defence, and 3 to his/her agility.
#
#    3 => {
#      :name => "Heaven's Wrath",
#      :states => [9]
#      :maxhp => 250,
#      :maxmp => -250,
#      :spi => -25
#    },
#
#  That code creates a set with ID 3, meaning that all items that have the code
# \set[3] in their note field must be equipped for these bonuses to be active.
# The name that shows up when hovering over an item of that script and pressing
# the display button is Heaven's Wrath. When all items of that set are equipped,
# the actor has the state with ID 9 applied (ATK UP by default), gets an extra
# 250 MaxHP, loses 250 MaxMP, and loses 25 Spirit#
#  Note that you can potentially add more stats via ESB_STAT_MODS at line zz,
# but only if you are using some script that gives more stats to actors and it
# follows the same format as the atk, def, spi, and agi methods. Read the
# instructions at line zz for more details.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 => {     
  :name => "Chief Jeh'ran's Garb",   
  :maxhp => 523,
  :maxmp => 345,
  :atk => 90,
  :def => 100, 
  :spi => 200, 
  :agi => 10,
  },
  2 => { # EXAMPLE
  :name => "Leopold's Haven",  :def => 10
  }
} # <- do not touch the } on this line
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  # ESB_SET_DISPLAY_BUTTON -
  #  This allows you to set a button, that, when pressed while hovering over a set
  # item in the item or equip scenes, will show the name of the set(s) it belongs
  # to. Note that it requires a button, which doesn't necessarily correspond to
  # that key on the keyboard. Press F1 during testplay to see a list of the
  # buttons and what key they correspond to.
  ESB_SET_DISPLAY_BUTTON = Input::SHIFT
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  # ESB_SET_DISPLAY_VOCAB -
  #  This is the text that will appear directly before the list of names of the
  # sets the item belongs to when pressing ESB_SET_DISPLAY_BUTTON while hovering
  # over a set item.ESB_SET_DISPLAY_VOCAB = "Set Item: "
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  # ESB_STAT_MODS -
  ESB_SET_DISPLAY_VOCAB = "\\C[16]Set Item: \\c[0]"
  #  You probably shouldn't touch this. It is simply a way to add other
  # possibilities for stat bonuses, where those stats are set up more or less in
  # the same way that the default atk, def, spi, and agi stats are. For example,
  # if you are using YEM New Battler Stats, you could add them to this array as
  #   :res, :dex
  # Then, where you set up the set bonuses at line 38, you could use the codes:
  #    :res => x,
  #    :dex => y
  # and those bonuses would be granted when you complete the set. But you need to
  # add them to the below array if you want to be able to do it, so:
  #  ESB_STAT_MODS = [:maxhp, :maxmp, :atk, :def, :spi, :agi, :res, :dex]
  #
  #  NB: that's only if you have YEM New Battler Stats, and if you do, you will
  # need to put the New Battler Stats script above this one in the editor, and you
  # would need to get the compatibility patch located in the main topic thread
  ESB_STAT_MODS = [:maxhp, :maxmp, :atk, :def, :spi, :agi]
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  #  END EDITABLE REGION
  #//////////////////////////////////////////////////////////////////////////////
  ESB_SET_BONUSES.each_value { |set|
    set[:name] = "" if !set[:name]
    set[:states] = [] if !set[:states]
    set.default = 0
    }
  #==============================================================================
  # ** Data_EquipmentSet
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  This struct holds all relevant data on an Equipment Set
  #==============================================================================
 
  Data_EquipmentSet = Struct.new (:id, :name, :equips, :states, *ESB_STAT_MODS)
  #==============================================================================
  # ** Data_EquipmentSets
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  This class is a wrapper for an array of Data_EquipmentSet objects
  #==============================================================================
 
  class Data_EquipmentSets
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Object Initialization
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def initialize
      @data = []
      @equips = {}
      for i in 1...$data_weapons.size
        $data_weapons[i].set_ids.each { |set_id|
        @equips[set_id] = [] if !@equips[set_id] 
        @equips[set_id].push ([1, i]) 
        }
      end 
      for i in 1...$data_armors.size         $data_armors[i].set_ids.each { |set_id|
        @equips[set_id] = [] if !@equips[set_id]
        @equips[set_id].push ([2, i])
        } 
      end
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Get Set
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   
    def [] (id) 
      if !@data[id]   
        name = ESB_SET_BONUSES[id][:name].to_s 
        states = ESB_SET_BONUSES[id][:states] 
        stats = [] 
        ESB_STAT_MODS.each { |sym| stats.push (ESB_SET_BONUSES[id][sym]) }
        @data[id] = Data_EquipmentSet.new (id, name, @equips[id], states, *stats)
      end
      return @data[id] 
    end 
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Get Equips
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    def get_equips (id) 
      equips = []
      @equips[id].each { |type, item_id|
      equip = case type 
      when 1 then $data_weapons[item_id]   
        when 2 then $data_armors[item_id]
        end   
        equips.push (equip)
        }
        return equips
      end
    end
    #==============================================================================
    # ** RPG::BaseItem
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  Summary of Changes:
    #    new method - set_ids
    #==============================================================================
    class RPG::BaseItem
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Set IDs
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      def set_ids 
        set_ids = []
        self.note.scan (/\\SET\[[\d,\s]+\]/i).each { |string|
        string.scan (/\d+/).each { |id| set_ids.push (id.to_i) }
        }
        return set_ids
      end
    end
    #==============================================================================
    # ** Game_Actor
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    #  Summary of Changes:
    #    aliased methods - initialize, change_equip, (+ ESB_STAT_MODS)
    #    new methods - calculate_set_bonuses
    #==============================================================================
   
    class Game_Actor 
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * ESB_STATS aliases
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      (ESB_STAT_MODS).each { |sym|
      attr_accessor "set_#{sym}".to_sym
      next if [:maxhp, :maxmp].include? (sym)
      EQPSET_ALIAS =  <<__END__
      alias malg_eqpsets_#{sym} #{sym}
      def #{sym} (*args)
        @#{sym}_plus = 0 if !@#{sym}_plus
        @#{sym}_plus += @set_#{sym}
        value = malg_eqpsets_#{sym} (*args)
        @#{sym}_plus -= @set_#{sym}
        return value
      end
__END__
      eval (EQPSET_ALIAS)
      }
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      # * MaxHP, MaxMP 
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      alias modalgb_esbmaxhp_8i3k maxhp
      def maxhp (*args)
        @maxhp_plus += @set_maxhp
        value = modalgb_esbmaxhp_8i3k (*args)
        @maxhp_plus -= @set_maxhp
        @hp = [@hp, value].min
        return value
      end
      alias modrn_esb_mxmp_5sc2 maxmp
      def maxmp (*args)
        @maxmp_plus += @set_maxmp
        value = modrn_esb_mxmp_5sc2 (*args)
        @maxmp_plus -= @set_maxmp
        @mp = [@mp, value].min
        return value
      end
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Object Initialization
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      alias monalb_esb_intze_6yj2 initialize
      def initialize (*args)
        ESB_STAT_MODS.each { |sym| self.send ("set_#{sym}=".to_sym, 0) }
        @set_states = [] 
        monalb_esb_intze_6yj2 (*args) # Run Original Method 
        calculate_set_bonuses
      end 
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Calculate Set Bonuses
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      def calculate_set_bonuses
        ESB_STAT_MODS.each { |sym| self.send ("set_#{sym}=".to_sym, 0) }
        @set_states = []
        sets_to_check = []
        equips.each { |equip|
        next unless equip
        sets_to_check.push (*equip.set_ids)
        }
        sets_to_check.uniq.each { |set_id|
        set_equips = $data_equipmentsets.get_equips (set_id)
        if (set_equips & equips).size == set_equips.size
          eqpset = $data_equipmentsets[set_id]
          ESB_STAT_MODS.each { |sym|
          self.send ( "set_#{sym}=".to_sym, self.send ("set_#{sym}".to_sym) + eqpset.send (sym) )
          }
          @set_states += eqpset.states   
        end
        }
      end
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      # * Change Equipment
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      alias monab_eqsetbon_chngeqp_1ax3 change_equip
      def change_equip (*args)
        monab_eqsetbon_chngeqp_1ax3 (*args) # Run Original Method
        calculate_set_bonuses
      end
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      # * States
      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      alias monabra_equps_states_1dc4 states 
      def states (*args)   
      result = monabra_equps_states_1dc4 (*args) # Run Original Method 
      for state_id in @set_states
        state = $data_states[state_id]
        next if result.include? (state)
        skip = false   
        result.each { |state2| 
        if state2.state_set.include? (state.id) 
          skip = true     
          break   
        end 
        }
        next if skip
        state.state_set.each { |state_id|
        result.delete ($data_states[state_id])
        remove_state (state_id)
        @removed_states.delete (state_id) # Don't report its removal
        } 
        result.push (state)
      end
      return result
    end
  end
  #==============================================================================
  # ** Window_Selectable
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    new method - esb_help_display_check
  #==============================================================================
 
  class Window_Selectable
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * ESB Help Display Check
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def esb_help_display_check 
      if Input.press? (ESB_SET_DISPLAY_BUTTON)
        return true if @esb_item_check == item
        @esb_item_check = item 
        if item && !item.set_ids.empty?
          set_names = [] 
          item.set_ids.each { |id| 
          name = $data_equipmentsets[id].name 
          set_names.push (name) if !set_names.include? (name) && !name.empty? 
          }   
          if !set_names.empty?
            string = ESB_SET_DISPLAY_VOCAB
            set_names.each { |name| string += "#{name}; " }
            string.slice! (-2, 2) 
            @help_window.set_text (string)
            return true
          end   
        end 
      else
        @esb_item_check = nil
      end   
      return false
    end
  end
  #==============================================================================
  # ** Window_Item
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Changes:
  #    aliased method - update_help
  #==============================================================================
  class Window_Item 
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Update Help
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    alias mdrnab_esb_updhlp_7ux4 update_help 
    def update_help (*args)   
    # Run Original Method if not showing set 
    mdrnab_esb_updhlp_7ux4 (*args) unless esb_help_display_check
  end
end
#==============================================================================
# ** Window_Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - update_help
#==============================================================================
class Window_Equip
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Help 
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modlg_esbonus_hlpupte_6yh2 update_help
  def update_help (*args)
    # Run Original Method if not showing set
    modlg_esbonus_hlpupte_6yh2 (*args) unless esb_help_display_check
  end
end
#==============================================================================
# ** Scene_Title
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - load_database; load_bt_database
#==============================================================================

class Scene_Title
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  # * Load Database
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalb_eqpsets_loddata_8ik4 load_database
  def load_database (*args)
    modalb_eqpsets_loddata_8ik4 (*args)
    # Run Original Method 
    $data_equipmentsets = Data_EquipmentSets.new
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  # * Load Battle Test Database
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  alias morn_ests_btdatald_3ez2 load_bt_database   def load_bt_database (*args) 
    morn_ests_btdatald_3ez2 (*args)
    # Run Original Method   
    $data_equipmentsets = Data_EquipmentSets.new
  end
end



(Sorry for all the questionss :()
      

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
As I mention in the demo, the colours are due to the Global Text Codes script:

Quote from: Demo
Also, note that the added colours are from my Global Text Codes script, which has been included in this script only as eyecandy since it makes Equipment Set Bonuses graphically more appealing. It is not necessary to the script, but if you want the colors, it's recommended.

That is both the reason you are seeing the codes and the reason they aren't working. It's also mentioned in the description of the script at the very start of this thread:
As well, the Global Text Codes script is recommended if you wish to colour code sets.

You can get that script from the demo as well, or from the link to its topic in the above quotation.

And yes, you are correct that old savefiles won't work.

**
Rep: +0/-0Level 65
RMRK Junior
hey MA i was wondering if there was a way to add a skill when a set is equipped?

**
Rep:
Level 66
Eternal Newbie
hey MA i was wondering if there was a way to add a skill when a set is equipped?
You should be able to accomplish this with another script. I believe one of Yanfly's scripts can do it.

http://rmrk.net/index.php/topic,42396.msg484888.html#msg484888

Look for "Weapon Skill" or something like that

**
Rep: +0/-0Level 65
RMRK Junior
I honestly couldn't understand how to use that script....
i'm like an amature when it comes to scripts....
i mean i understand the basics but there is a lot that i still don't understand....

**
Rep: +0/-0Level 63
RMRK Junior
So I tried using this script, but I'm coming up with some rather... strange issues.
If I give an actor the whole set to begin with, he gets the bonuses but KEEP THEM even if I remove the set.
If I DONT give an actor the whole set to begin with, equipping the whole set doesn't give him the bonuses.

I'm confused @_@

Code: [Select]
#==============================================================================
# Equipment Set Bonuses
# Version: 1.0
# Author: modern algebra (rmrk.net)
# Date: May 24, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script allows you to set bonuses to stats if an actor is wearing
# equipment of the same set, such as in Diablo II or Dragon Age: Origins.
# With this script, for instance, you could make a sword with ATK 10 and
# a Shield with DEF 10, but if you have both that sword and shield equipped
# you would get an additional 5 ATK and DEF, so that you would get 15 ATK and
# 15 DEF. By default, you can make sets that can give bonuses to maxhp, maxmp,
# atk, def, spi, and agi, as well as apply states.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Place this script in its own slot in the Script Editor (F11), somewhere
# below Materials but above Main.
#
# To setup sets and the bonuses they will give, go to line x38 and read the
# instructions located there.
#
# To assign an equipment to a set, simply put the following code in its
# notebox:
# \SET[set_id]
# set_id : the ID of the set this equipment belongs to, as per the
# setup at line 48.
# Note that you can assign the same piece of equipment to multiple sets by
# placing a comma and writing the next set_id, like so:
# \SET[set_id_1, set_id_2, ..., set_id_n]
#==============================================================================
ESB_SET_BONUSES = { # <- Do not touch this line
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# EDITABLE REGION
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ESB_SET_BONUSES -
# This is where you set up the sets, give them a name, and determine what
# bonuses they give if an actor is wearing a complete set. The format for
# setting it up is:
#
# set_id => {
# :name => "name",
# :states => [state_ids],
# :maxhp => maxhp_bonus,
# :maxmp => maxmp_bonus,
# :atk => atk_bonus,
# :def => def_bonus,
# :spi => spi_bonus,
# :agi => agi_bonus
# }
#
# where:
# set_id - the ID of the set. This is used to identify which equipment
# belongs to which set, which you do in the note field of the equipment.
# See line 27 for details. Note that this must be an integer, but beyond
# that can be anything. Whatever you do though, this must be unique, so
# don't make more than one set with this ID.
# "name" - the name of the set. This is what will show up in the help box
# when you press the Display button (see line yy to set) on a set item.
# It can be used for more than one set, if you want to create bonuses
# for partial sets.
# [state_ids] - this is an array of states that should be applied if an
# actor has completed this set. So, if you want an actor who wears a
# complete set to have a state applied, put the ID of that state in this
# array, like so: [10] - that would apply state 10 (by default, DEF UP)
# for as long as the complete set is equipped. [9, 10] would apply both
# states 9 and 10 (by default, ATK UP and DEF UP).
# stat_bonus - the rest of them are the value of whatever bonus you want
# applied to that stat. So, if you want a complete set to give a bonus
# of 10 to DEF and a bonus of 5 to agi, you would have:
# :def => 10,
# :agi => 5
# If you do not set a stat, it will default to 0, meaning it won't give
# a bonus to that particular stat.
# EXAMPLES:
#
# 1 => {
# :name => "Leopold's Outfit",
# :atk => 5,
# :def => 15,
# :agi => 3
# },
#
# That code creates a set with ID 1, meaning that all items that have the code
# \set[1] in their note field must be equipped for these bonuses to be active.
# The name that shows up when hovering over an item of that script and pressing
# the display button is Leopold's Outfit. When all items of that set are
# equipped, the actor gets a bonus of 5 to his/her attack, 15 to his/her
# defence, and 3 to his/her agility.
#
# 3 => {
# :name => "Heaven's Wrath",
# :states => [9]
# :maxhp => 250,
# :maxmp => -250,
# :spi => -25
# },
#
# That code creates a set with ID 3, meaning that all items that have the code
# \set[3] in their note field must be equipped for these bonuses to be active.
# The name that shows up when hovering over an item of that script and pressing
# the display button is Heaven's Wrath. When all items of that set are equipped,
# the actor has the state with ID 9 applied (ATK UP by default), gets an extra
# 250 MaxHP, loses 250 MaxMP, and loses 25 Spirit
#
# Note that you can potentially add more stats via ESB_STAT_MODS at line zz,
# but only if you are using some script that gives more stats to actors and it
# follows the same format as the atk, def, spi, and agi methods. Read the
# instructions at line zz for more details.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 => {
:name => "crap titan",
:maxhp => 10,
:atk => 10
},
2 => { # EXAMPLE
:name => "Leopold's Haven",
:def => 10
}
} # <- do not touch the } on this line
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ESB_SET_DISPLAY_BUTTON -
# This allows you to set a button, that, when pressed while hovering over a set
# item in the item or equip scenes, will show the name of the set(s) it belongs
# to. Note that it requires a button, which doesn't necessarily correspond to
# that key on the keyboard. Press F1 during testplay to see a list of the
# buttons and what key they correspond to.
ESB_SET_DISPLAY_BUTTON = Input::SHIFT
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ESB_SET_DISPLAY_VOCAB -
# This is the text that will appear directly before the list of names of the
# sets the item belongs to when pressing ESB_SET_DISPLAY_BUTTON while hovering
# over a set item.
ESB_SET_DISPLAY_VOCAB = "Set Item: "
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ESB_STAT_MODS -
# You probably shouldn't touch this. It is simply a way to add other
# possibilities for stat bonuses, where those stats are set up more or less in
# the same way that the default atk, def, spi, and agi stats are. For example,
# if you are using YEM New Battler Stats, you could add them to this array as
# :res, :dex
# Then, where you set up the set bonuses at line 38, you could use the codes:
# :res => x,
# :dex => y
# and those bonuses would be granted when you complete the set. But you need to
# add them to the below array if you want to be able to do it, so:
# ESB_STAT_MODS = [:maxhp, :maxmp, :atk, :def, :spi, :agi, :res, :dex]
#
# NB: that's only if you have YEM New Battler Stats, and if you do, you will
# need to put the New Battler Stats script above this one in the editor, and you
# would need to get the compatibility patch located in the main topic thread
ESB_STAT_MODS = [:maxhp, :maxmp, :atk, :def, :spi, :agi]
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# END EDITABLE REGION
#//////////////////////////////////////////////////////////////////////////////
ESB_SET_BONUSES.each_value { |set|
set[:name] = "" if !set[:name]
set[:states] = [] if !set[:states]
set.default = 0
}
#==============================================================================
# ** Data_EquipmentSet
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This struct holds all relevant data on an Equipment Set
#==============================================================================

Data_EquipmentSet = Struct.new (:id, :name, :equips, :states, *ESB_STAT_MODS)
#==============================================================================
# ** Data_EquipmentSets
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# This class is a wrapper for an array of Data_EquipmentSet objects
#==============================================================================

class Data_EquipmentSets
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def initialize
@data = []
@equips = {}
for i in 1...$data_weapons.size
$data_weapons[i].set_ids.each { |set_id|
@equips[set_id] = [] if !@equips[set_id]
@equips[set_id].push ([1, i])
}
end
for i in 1...$data_armors.size
$data_armors[i].set_ids.each { |set_id|
@equips[set_id] = [] if !@equips[set_id]
@equips[set_id].push ([2, i])
}
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Set
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def [] (id)
if !@data[id]
name = ESB_SET_BONUSES[id][:name].to_s
states = ESB_SET_BONUSES[id][:states]
stats = []
ESB_STAT_MODS.each { |sym| stats.push (ESB_SET_BONUSES[id][sym]) }
@data[id] = Data_EquipmentSet.new (id, name, @equips[id], states, *stats)
end
return @data[id]
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Get Equips
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def get_equips (id)
equips = []
@equips[id].each { |type, item_id|
equip = case type
when 1 then $data_weapons[item_id]
when 2 then $data_armors[item_id]
end
equips.push (equip)
}
return equips
end
end

#==============================================================================
# ** RPG::BaseItem
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - set_ids
#==============================================================================

class RPG::BaseItem
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Set IDs
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def set_ids
set_ids = []
self.note.scan (/\\SET\[[\d,\s]+\]/i).each { |string|
string.scan (/\d+/).each { |id| set_ids.push (id.to_i) }
}
return set_ids
end
end

#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - initialize, change_equip, (+ ESB_STAT_MODS)
# new methods - calculate_set_bonuses
#==============================================================================

class Game_Actor
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * ESB_STATS aliases
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(ESB_STAT_MODS).each { |sym|
attr_accessor "set_#{sym}".to_sym
next if [:maxhp, :maxmp].include? (sym)
EQPSET_ALIAS = <<__END__
alias malg_eqpsets_#{sym} #{sym}
def #{sym} (*args)
@#{sym}_plus = 0 if !@#{sym}_plus
@#{sym}_plus += @set_#{sym}
value = malg_eqpsets_#{sym} (*args)
@#{sym}_plus -= @set_#{sym}
return value
end
__END__
eval (EQPSET_ALIAS)
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * MaxHP, MaxMP
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalgb_esbmaxhp_8i3k maxhp
def maxhp (*args)
@maxhp_plus += @set_maxhp
value = modalgb_esbmaxhp_8i3k (*args)
@maxhp_plus -= @set_maxhp
@hp = [@hp, value].min
return value
end
alias modrn_esb_mxmp_5sc2 maxmp
def maxmp (*args)
@maxmp_plus += @set_maxmp
value = modrn_esb_mxmp_5sc2 (*args)
@maxmp_plus -= @set_maxmp
@mp = [@mp, value].min
return value
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias monalb_esb_intze_6yj2 initialize
def initialize (*args)
ESB_STAT_MODS.each { |sym| self.send ("set_#{sym}=".to_sym, 0) }
@set_states = []
monalb_esb_intze_6yj2 (*args) # Run Original Method
calculate_set_bonuses
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Calculate Set Bonuses
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def calculate_set_bonuses
ESB_STAT_MODS.each { |sym| self.send ("set_#{sym}=".to_sym, 0) }
@set_states = []
sets_to_check = []
equips.each { |equip|
next unless equip
sets_to_check.push (*equip.set_ids)
}
sets_to_check.uniq.each { |set_id|
set_equips = $data_equipmentsets.get_equips (set_id)
if (set_equips & equips).size == set_equips.size
eqpset = $data_equipmentsets[set_id]
ESB_STAT_MODS.each { |sym|
self.send ( "set_#{sym}=".to_sym, self.send ("set_#{sym}".to_sym) + eqpset.send (sym) )
}
@set_states += eqpset.states
end
}
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Change Equipment
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias monab_eqsetbon_chngeqp_1ax3 change_equip
def change_equip (*args)
monab_eqsetbon_chngeqp_1ax3 (*args) # Run Original Method
calculate_set_bonuses
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * States
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias monabra_equps_states_1dc4 states
def states (*args)
result = monabra_equps_states_1dc4 (*args) # Run Original Method
for state_id in @set_states
state = $data_states[state_id]
next if result.include? (state)
skip = false
result.each { |state2|
if state2.state_set.include? (state.id)
skip = true
break
end
}
next if skip
state.state_set.each { |state_id|
result.delete ($data_states[state_id])
remove_state (state_id)
@removed_states.delete (state_id) # Don't report its removal
}
result.push (state)
end
return result
end
end

#==============================================================================
# ** Window_Selectable
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new method - esb_help_display_check
#==============================================================================

class Window_Selectable
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * ESB Help Display Check
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def esb_help_display_check
if Input.press? (ESB_SET_DISPLAY_BUTTON)
return true if @esb_item_check == item
@esb_item_check = item
if item && !item.set_ids.empty?
set_names = []
item.set_ids.each { |id|
name = $data_equipmentsets[id].name
set_names.push (name) if !set_names.include? (name) && !name.empty?
}
if !set_names.empty?
string = ESB_SET_DISPLAY_VOCAB
set_names.each { |name| string += "#{name}; " }
string.slice! (-2, 2)
@help_window.set_text (string)
return true
end
end
else
@esb_item_check = nil
end
return false
end
end

#==============================================================================
# ** Window_Item
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - update_help
#==============================================================================

class Window_Item
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Help
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mdrnab_esb_updhlp_7ux4 update_help
def update_help (*args)
# Run Original Method if not showing set
mdrnab_esb_updhlp_7ux4 (*args) unless esb_help_display_check
end
end

#==============================================================================
# ** Window_Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - update_help
#==============================================================================

class Window_Equip
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Help
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modlg_esbonus_hlpupte_6yh2 update_help
def update_help (*args)
# Run Original Method if not showing set
modlg_esbonus_hlpupte_6yh2 (*args) unless esb_help_display_check
end
end

#==============================================================================
# ** Scene_Title
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased methods - load_database; load_bt_database
#==============================================================================

class Scene_Title
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Load Database
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalb_eqpsets_loddata_8ik4 load_database
def load_database (*args)
modalb_eqpsets_loddata_8ik4 (*args) # Run Original Method
$data_equipmentsets = Data_EquipmentSets.new
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Load Battle Test Database
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias morn_ests_btdatald_3ez2 load_bt_database
def load_bt_database (*args)
morn_ests_btdatald_3ez2 (*args) # Run Original Method
$data_equipmentsets = Data_EquipmentSets.new
end
end



*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
It's probably an incompatibility with another script. Try placing this script below any other custom scripts you have but above Main.

If that doesn't work, try it in a brand new project and test it there. Then add each of your other scripts in one by one. When the demo stops working, then the last script you added will be the incompatible one. Tell me what it is and I'll look into it.

**
Rep: +0/-0Level 63
RMRK Junior
moving it to the very bottom (well, not quite, I have your item instance script) seems to have worked. Maybe Mr G W's int-weapon script was messing with it. I use a lot of custom scripts, so it could be one of the others, but it's the only other item script I had below it...
Unless the Unleash script counts... Anyways, thanks a lot!~

**
Rep: +0/-0Level 66
RPGVX Advanced (I Do Not Script Tough)
Does Not Work With Extend Equip Script D:

But Whatever,It Work Fine With Equip Extension,The Extend Equip Just Make The Game
Look A Little More PRO.By The Way...

ANOTHER MASTERPIECE MA  ;8

**
Rep: +0/-0Level 82
i dont know if i should do this as it might be a necropost but i really need some help al... here is my modified enelvon resistance system(i added TONS of new stats for myself.)

is there a way to incorporate this more stats code into yours? also im suing KGC expanded equipment and i dont know if they can work together


*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
MA, your work is going in my new project. Fantastic as always, sir.
:tinysmile:

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
Mr. Algebra, I cannot seem to find the compatibility patch mentioned in the section regarding YEM New Battle Stats. It said to see the main post, which I assumed was here, and the YEM script hasn't it;s own thread. Would you lend me a hand, sir?

EDIT: Never mind, I found it. I'm slightly impaired.
« Last Edit: February 15, 2014, 09:41:12 PM by EvilM00s »
:tinysmile:

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
Hi, MA. I encountered another problem as well. If I reset the game (using f12 or the menu shortcut that a YERD script enables) the title screen shows up- but as soon as I press COntinue OR New Game, I get a stack level too deep error at line 283...

Code: [Select]
@maxhp_plus += @set_maxhp

I have tried the script with my own configs and the default script as it is. I'm using YEM and a few other Yanfly scripts, all above your script.

EDIT: AHA! It has something to do with an aliased method... I believe Zeriab wrote a script to fix this. Lemme try it and see what happens.
« Last Edit: February 15, 2014, 09:29:59 PM by EvilM00s »
:tinysmile:

*
Rep: +0/-0Level 34
RMRK Junior
I have problems with the script. i get a sintax error at line 185 and then 221
Code: [Select]
#==============================================================================
#    Equipment Set Bonuses
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: May 24, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:

#    This script allows you to set bonuses to stats if an actor is wearing
#   equipment of the same set, such as in Diablo II or Dragon Age: Origins.
#    With this script, for instance, you could make a sword with ATK 10 and
#   a Shield with DEF 10, but if you have both that sword and shield equipped
#   you would get an additional 5 ATK and DEF, so that you would get 15 ATK and
#   15 DEF. By default, you can make sets that can give bonuses to maxhp, maxmp,
#   atk, def, spi, and agi, as well as apply states.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Place this script in its own slot in the Script Editor (F11), somewhere
#   below Materials but above Main.
#
#    To setup sets and the bonuses they will give, go to line x38 and read the
#   instructions located there.
#
#    To assign an equipment to a set, simply put the following code in its
#   notebox:
#        \SET[set_id]
#          set_id : the ID of the set this equipment belongs to, as per the
#            setup at line 48.
#    Note that you can assign the same piece of equipment to multiple sets by
#   placing a comma and writing the next set_id, like so:
#        \SET[set_id_1, set_id_2, ..., set_id_n]
#==============================================================================
ESB_SET_BONUSES = { # <- Do not touch this line
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#  EDITABLE REGION
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  ESB_SET_BONUSES -
#    This is where you set up the sets, give them a name, and determine what
#   bonuses they give if an actor is wearing a complete set. The format for
#   setting it up is:
#
#     1 => {
#       :name => "Volfking Set",
#       :states => [state_ids],
#       :maxhp => 150,
#       :maxmp => 50,
#       :atk => 20,
#       :def => 20,
#       :spi => 20,
#       :agi => 20
#     }
#     set_id => {
#       :name => "name",
#       :states => [state_ids],
#       :maxhp => maxhp_bonus,
#       :maxmp => maxmp_bonus,
#       :atk => atk_bonus,
#       :def => def_bonus,
#       :spi => spi_bonus,
#       :agi => agi_bonus
#     }
#
#
#    where:
#      set_id - the ID of the set. This is used to identify which equipment
#        belongs to which set, which you do in the note field of the equipment.
#        See line 27 for details. Note that this must be an integer, but beyond
#        that can be anything. Whatever you do though, this must be unique, so
#        don't make more than one set with this ID.
#      "name" - the name of the set. This is what will show up in the help box
#        when you press the Display button (see line yy to set) on a set item.
#        It can be used for more than one set, if you want to create bonuses
#        for partial sets.
#      [state_ids] - this is an array of states that should be applied if an
#        actor has completed this set. So, if you want an actor who wears a
#        complete set to have a state applied, put the ID of that state in this
#        array, like so: [10] - that would apply state 10 (by default, DEF UP)
#        for as long as the complete set is equipped. [9, 10] would apply both
#        states 9 and 10 (by default, ATK UP and DEF UP).
#      stat_bonus - the rest of them are the value of whatever bonus you want
#        applied to that stat. So, if you want a complete set to give a bonus
#        of 10 to DEF and a bonus of 5 to agi, you would have:
#          :def => 10,
#          :agi => 5
#        If you do not set a stat, it will default to 0, meaning it won't give
#        a bonus to that particular stat.
#  EXAMPLES:
#
#    1 => {
#      :name => "Leopold's Outfit",
#      :atk => 5,
#      :def => 15,
#      :agi => 3
#    },
#
#  That code creates a set with ID 1, meaning that all items that have the code
# \set[1] in their note field must be equipped for these bonuses to be active.
# The name that shows up when hovering over an item of that script and pressing
# the display button is Leopold's Outfit. When all items of that set are
# equipped, the actor gets a bonus of 5 to his/her attack, 15 to his/her
# defence, and 3 to his/her agility.
#
#    3 => {
#      :name => "Heaven's Wrath",
#      :states => [9]
#      :maxhp => 250,
#      :maxmp => -250,
#      :spi => -25
#    },
#
#  That code creates a set with ID 3, meaning that all items that have the code
# \set[3] in their note field must be equipped for these bonuses to be active.
# The name that shows up when hovering over an item of that script and pressing
# the display button is Heaven's Wrath. When all items of that set are equipped,
# the actor has the state with ID 9 applied (ATK UP by default), gets an extra
# 250 MaxHP, loses 250 MaxMP, and loses 25 Spirit
#
#  Note that you can potentially add more stats via ESB_STAT_MODS at line zz,
# but only if you are using some script that gives more stats to actors and it
# follows the same format as the atk, def, spi, and agi methods. Read the
# instructions at line zz for more details.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  1 => {
    :name => "",
    :states => [],
    :maxhp => 0,
    :maxmp => 0,
    :atk => 0,
    :def => 0,
    :spi => 0,
    :agi => 0
  },
  2 => { # EXAMPLE
    :name => "Leopold's Haven",
    :def => 10
  }
} # <- do not touch the } on this line
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ESB_SET_DISPLAY_BUTTON -
#  This allows you to set a button, that, when pressed while hovering over a set
# item in the item or equip scenes, will show the name of the set(s) it belongs
# to. Note that it requires a button, which doesn't necessarily correspond to
# that key on the keyboard. Press F1 during testplay to see a list of the
# buttons and what key they correspond to.
ESB_SET_DISPLAY_BUTTON = Input::SHIFT
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ESB_SET_DISPLAY_VOCAB -
#  This is the text that will appear directly before the list of names of the
# sets the item belongs to when pressing ESB_SET_DISPLAY_BUTTON while hovering
# over a set item.
ESB_SET_DISPLAY_VOCAB = "Set Item: "
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ESB_STAT_MODS -
#  You probably shouldn't touch this. It is simply a way to add other
# possibilities for stat bonuses, where those stats are set up more or less in
# the same way that the default atk, def, spi, and agi stats are. For example,
# if you are using YEM New Battler Stats, you could add them to this array as
#   :res, :dex
# Then, where you set up the set bonuses at line 38, you could use the codes:
#    :res => x,
#    :dex => y
# and those bonuses would be granted when you complete the set. But you need to
# add them to the below array if you want to be able to do it, so:
#  ESB_STAT_MODS = [:maxhp, :maxmp, :atk, :def, :spi, :agi, :res, :dex]
#
#  NB: that's only if you have YEM New Battler Stats, and if you do, you will
# need to put the New Battler Stats script above this one in the editor, and you
# would need to get the compatibility patch located in the main topic thread
ESB_STAT_MODS = [:maxhp, :maxmp, :atk, :def, :spi, :agi]
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#  END EDITABLE REGION
#//////////////////////////////////////////////////////////////////////////////
ESB_SET_BONUSES.each_value { |set|
  set[:name] = "" if !set[:name]
  set[:states] = [] if !set[:states]
  set.default = 0
}
#==============================================================================
# ** Data_EquipmentSet
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This struct holds all relevant data on an Equipment Set
#==============================================================================

Data_EquipmentSet = Struct.new (:id, :name, :equips, :states, *ESB_STAT_MODS)
#==============================================================================
# ** Data_EquipmentSets
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This class is a wrapper for an array of Data_EquipmentSet objects
#==============================================================================

class Data_EquipmentSets
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize
    @data = []
    @equips = {}
    for i in 1...$data_weapons.size
      $data_weapons[i].set_ids.each { |set_id|
        @equips[set_id] = [] if !@equips[set_id]
        @equips[set_id].push ([1, i])
      }
    end
    for i in 1...$data_armors.size
      $data_armors[i].set_ids.each { |set_id|
        @equips[set_id] = [] if !@equips[set_id]
        @equips[set_id].push ([2, i])
      }
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Set
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def [] (id)
    if !@data[id]
      name = ESB_SET_BONUSES[id][:name].to_s
      states = ESB_SET_BONUSES[id][:states]
      stats = []
      ESB_STAT_MODS.each { |sym| stats.push (ESB_SET_BONUSES[id][sym]) }
      @data[id] = Data_EquipmentSet.new (id, name, @equips[id], states, *stats)
    end
    return @data[id]
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Equips
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def get_equips (id)
    equips = []
    @equips[id].each { |type, item_id|
      equip = case type
      when 1 then $data_weapons[item_id]
      when 2 then $data_armors[item_id]
      end
      equips.push (equip)
    }
    return equips
  end
end

#==============================================================================
# ** RPG::BaseItem
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - set_ids
#==============================================================================

class RPG::BaseItem
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set IDs
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def set_ids
    set_ids = []
    self.note.scan (/\\SET\[[\d,\s]+\]/i).each { |string|
      string.scan (/\d+/).each { |id| set_ids.push (id.to_i) }
    }
    return set_ids
  end
end

#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - initialize, change_equip, (+ ESB_STAT_MODS)
#    new methods - calculate_set_bonuses
#==============================================================================

class Game_Actor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * ESB_STATS aliases
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  (ESB_STAT_MODS).each { |sym|
    attr_accessor "set_#{sym}".to_sym
    next if [:maxhp, :maxmp].include? (sym)
EQPSET_ALIAS = <<__END__
    alias malg_eqpsets_#{sym} #{sym}
    def #{sym} (*args)
      @#{sym}_plus = 0 if !@#{sym}_plus
      @#{sym}_plus += @set_#{sym}
      value = malg_eqpsets_#{sym} (*args)
      @#{sym}_plus -= @set_#{sym}
      return value
    end
__END__
    eval (EQPSET_ALIAS)
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * MaxHP, MaxMP
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalgb_esbmaxhp_8i3k maxhp
  def maxhp (*args)
    @maxhp_plus += @set_maxhp
    value = modalgb_esbmaxhp_8i3k (*args)
    @maxhp_plus -= @set_maxhp
    @hp = [@hp, value].min
    return value
  end
  alias modrn_esb_mxmp_5sc2 maxmp
  def maxmp (*args)
    @maxmp_plus += @set_maxmp
    value = modrn_esb_mxmp_5sc2 (*args)
    @maxmp_plus -= @set_maxmp
    @mp = [@mp, value].min
    return value
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias monalb_esb_intze_6yj2 initialize
  def initialize (*args)
    ESB_STAT_MODS.each { |sym| self.send ("set_#{sym}=".to_sym, 0) }
    @set_states = []
    monalb_esb_intze_6yj2 (*args) # Run Original Method
    calculate_set_bonuses
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Calculate Set Bonuses
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def calculate_set_bonuses
    ESB_STAT_MODS.each { |sym| self.send ("set_#{sym}=".to_sym, 0) }
    @set_states = []
    sets_to_check = []
    equips.each { |equip|
      next unless equip
      sets_to_check.push (*equip.set_ids)
    }
    sets_to_check.uniq.each { |set_id|
      set_equips = $data_equipmentsets.get_equips (set_id)
      if (set_equips & equips).size == set_equips.size
        eqpset = $data_equipmentsets[set_id]
        ESB_STAT_MODS.each { |sym|
          self.send ( "set_#{sym}=".to_sym, self.send ("set_#{sym}".to_sym) + eqpset.send (sym) )
        }
        @set_states += eqpset.states
      end
    }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Change Equipment
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias monab_eqsetbon_chngeqp_1ax3 change_equip
  def change_equip (*args)
    monab_eqsetbon_chngeqp_1ax3 (*args) # Run Original Method
    calculate_set_bonuses
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * States
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias monabra_equps_states_1dc4 states
  def states (*args)
    result = monabra_equps_states_1dc4 (*args) # Run Original Method
    for state_id in @set_states
      state = $data_states[state_id]
      next if result.include? (state)
      skip = false
      result.each { |state2|
        if state2.state_set.include? (state.id)
          skip = true
          break
        end
      }
      next if skip
      state.state_set.each { |state_id|
        result.delete ($data_states[state_id])
        remove_state (state_id)
        @removed_states.delete (state_id) # Don't report its removal
      }
      result.push (state)
    end
    return result
  end
end

#==============================================================================
# ** Window_Selectable
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - esb_help_display_check
#==============================================================================

class Window_Selectable
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * ESB Help Display Check
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def esb_help_display_check
    if Input.press? (ESB_SET_DISPLAY_BUTTON)
      return true if @esb_item_check == item
      @esb_item_check = item
      if item && !item.set_ids.empty?
        set_names = []
        item.set_ids.each { |id|
          name = $data_equipmentsets[id].name
          set_names.push (name) if !set_names.include? (name) && !name.empty?
        }
        if !set_names.empty?
          string = ESB_SET_DISPLAY_VOCAB
          set_names.each { |name| string += "#{name}; " }
          string.slice! (-2, 2)
          @help_window.set_text (string)
          return true
        end
      end
    else
      @esb_item_check = nil
    end
    return false
  end
end

#==============================================================================
# ** Window_Item
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - update_help
#==============================================================================

class Window_Item
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Help
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mdrnab_esb_updhlp_7ux4 update_help
  def update_help (*args)
    # Run Original Method if not showing set
    mdrnab_esb_updhlp_7ux4 (*args) unless esb_help_display_check
  end
end

#==============================================================================
# ** Window_Equip
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - update_help
#==============================================================================

class Window_Equip
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Update Help
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modlg_esbonus_hlpupte_6yh2 update_help
  def update_help (*args)
    # Run Original Method if not showing set
    modlg_esbonus_hlpupte_6yh2 (*args) unless esb_help_display_check
  end
end

#==============================================================================
# ** Scene_Title
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - load_database; load_bt_database
#==============================================================================

class Scene_Title
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Load Database
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalb_eqpsets_loddata_8ik4 load_database
  def load_database (*args)
    modalb_eqpsets_loddata_8ik4 (*args) # Run Original Method
    $data_equipmentsets = Data_EquipmentSets.new
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Load Battle Test Database
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias morn_ests_btdatald_3ez2 load_bt_database
  def load_bt_database (*args)
    morn_ests_btdatald_3ez2 (*args) # Run Original Method
    $data_equipmentsets = Data_EquipmentSets.new
  end
end
Script "sets" (thats how i named it)  line 185: SyntaxError ocurred.
unexpected "," expecting ")"