RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VXA] Equipment Set Bonuses 1.0.0

0 Members and 1 Guest are viewing this topic.

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

Version History


  • <Version 1.0.0> 2014.01.12 - Original Release

Description


This script allows you to group together pieces of equipments and apply bonuses if all of them are equipped on the same actor.

It has no graphical component, so you will need to describe items that are part of a set through other means. If you want to change the colour of item names to indicate they belong to a set, I recommend using my Global Text Codes script.

Features

  • Gives bonuses when equipping items of the same set
  • Easy to configure - set the bonuses directly in the database as an armor

Instructions

Paste the script into its own slot in the Script Editor (F11), above Main but below Materials.

Script


Code: [Select]
#==============================================================================
#    Equipment Set Bonuses
#    Version: 1.0.0
#    Author: modern algebra (rmrk.net)
#    Date: 10 January 2014
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to group together pieces of equipments and apply
#   bonuses if all of them are equipped on the same actor.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    To create an equipment set, simply create an armor (not a weapon) with all
#   of the stat changes and features you want added when the entire set is
#   equipped. Then, in the notebox, use the following codes to determine which
#   items belong to the set:
#
#      \set[x1, x2, ..., xn]
#
#   Where each element is the ID of the piece of equipment, preceded by either
#   A or W to indicate whether it is a weapon or armor.
#
#    For example, a54 would mean the armor with ID 54, while w2 would be the
#   weapon with ID 2.
#
#    As well, you can write more than one of these codes in the notebox, and
#   then the bonuses will be applied if any of the sets are equipped.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Examples:
#
#      \set[w50, a67, a71]
#    If an actor has equipped the weapon with ID 50 and the armors with IDs 67
#    and 71, then the bonuses of this equipment set will be applied.
#
#      \set[a32, a33]\set[a32, a34]\set[a33, a34]
#    If an actor has equipped any two pieces of the armors with IDs 32, 33, and
#    34, then the bonuses of this equipment set will be applied.
#==============================================================================

$imported = {} unless $imported
$imported[:MA_EquipmentSetBonuses] = true

#==============================================================================
# ** MAESB EquipmentSet
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  A class to hold data of each set
#==============================================================================

class MAESB_EquipmentSet
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #    set_string : a string with each armor and weapon as "[AW]\d+"
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def initialize(set_string = "")
    # Initialize arrays to track IDs of equips in set
    @weapons, @armors = [], []
    # Populate Set
    set_string.scan(/([AW]?)\s*?(\d+)/mi) { |type, id|
      (type.upcase == 'W' ? @weapons : @armors).push(id.to_i) }
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Items
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def items
    (@weapons.collect {|id| $data_weapons[id] }) + # RPG::Weapons +
      (@armors.collect {|id| $data_armors[id] })   # RPG::Armors
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Set Complete?
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def set_complete?(eqps = [])
    itms = items
    !itms.empty? && ((itms & eqps).size == itms.size)
  end
end

module RPG
  #============================================================================
  # ** RPG::EquipItem
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Items:
  #    new methods - maesb_generate_equip_set
  #============================================================================
 
  class EquipItem
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Public Instance Variables
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    attr_accessor :maesb_belongs_to_sets
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Generate Equip Set
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def maesb_generate_equip_set
      @maesb_belongs_to_sets = []
    end
  end
 
  #============================================================================
  # ** RPG::Armor
  #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  #  Summary of Items:
  #    new methods - maesb_generate_equip_set
  #============================================================================
 
  class Armor
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Public Instance Variables
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    attr_reader   :maesb_sets
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Generate Equip Set
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def maesb_generate_equip_set
      super
      @maesb_sets = note.scan(/\\SET\s*\[(.+?)\]/i).collect { |set_s|
        MAESB_EquipmentSet.new(set_s[0]) }
    end
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # * Set Complete?
    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    def maesb_set_complete?(maesb_equips)
      maesb_sets.each { |set| return true if set && set.set_complete?(maesb_equips) }
      return false
    end
  end
end

#==============================================================================
# *** DataManager
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - load_database
#    new method - maesb_generate_equipment_sets
#==============================================================================

class <<  DataManager
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Load Database
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maesb_loadata_9fg4 load_database
  def load_database(*args, &block)
    maesb_loadata_9fg4(*args, &block) # Call Original Method
    maesb_generate_equipment_sets
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Generate Equipment Sets
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maesb_generate_equipment_sets
    # Generate Equipment Sets
    ($data_weapons + $data_armors).compact.each { |equip| equip.maesb_generate_equip_set }
    # Update items to refer to the set to which they belong
    set_items = $data_armors.compact.select {|armor| !armor.maesb_sets.empty? }
    set_items.each { |set_item|
      set_item.maesb_sets.collect {|set| set.items }.flatten.uniq.each { |equip|
        equip.maesb_belongs_to_sets.push(set_item.id)
      }
    }
  end
end

#==============================================================================
# *** MAESB_GameActr_CreateSets
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  This module is intended to be mixed in to Game_Actor
#==============================================================================

module MAESB_GameActr_CreateSets
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Sets
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def maesb_sets
    eqps = equips.compact
    if @maesb_set_last_equips != eqps # update if equipment has changed
      @maesb_set_last_equips = eqps
      # Get array of all set items currently equipped
      sets = eqps.inject([]) { |r, eqp| r |= eqp.maesb_belongs_to_sets }
      # Select from them any sets that are complete
      @maesb_sets = (sets.collect {|id| $data_armors[id] }).select {|set|
        set.maesb_set_complete?(eqps) }
    end
    @maesb_sets  # return array of set items
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Array of All Objects Retaining Features
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def feature_objects(*args, &block)
    maesb_sets.compact + (super(*args, &block))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Added Value of Parameter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def param_plus(param_id, *args, &block)
    val = super(param_id, *args, &block)
    maesb_sets.compact.inject(val) {|r, item| r += item.params[param_id] }
  end
end

#==============================================================================
# ** Game_Actor
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    included modules - MAESB_GameActr_CreateSets
#==============================================================================

class Game_Actor
  include MAESB_GameActr_CreateSets
end

If you are having problems copying from that, you could try changing your browser, or you can also retrieve the script from Pastebin.

Credit


  • modern algebra

Support


Please post in this thread on rmrk.net if you have any questions or errors to report.

Known Compatibility Issues

I do not know of any right now, but let me know if any of your scripts conflict and I will help if I can.

Terms of Use


I adopt the Terms of Use for RMVXA Scripts Database.
« Last Edit: January 12, 2014, 08:41:38 PM by modern algebra »

*
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Rep:
Level 96
&&&&&&&&&&&&&&&&&&&&&&&&&&&
GIAW 14: 2nd Place (Hard Mode)2013 Zero to Hero2013 Biggest Drama WhoreParticipant - GIAW 11Secret Santa 2013 ParticipantFor taking arms in the name of your breakfast.
Awesome!
Ego meum corpus, bono animo scriptor intueri!
&&&&&&&&&&&&&&&&

*
Rep:
Level 52
RMRK Junior
Nice work MA. Great Script.
Spoiler for "More About Vindaca":

Spoiler for "General Prices":
You can also build packages containing multiple resources. (Package prices are not included.)


Music

Basic Songs = $20 - $50 USD
Advanced Songs = $100+


Graphics
32 x 32, 4 Directional Sprite = $7 USD each / $50 USD per sheet
64 x 32, 4 Directional Sprite = $10 USD each / $60 USD per sheet
Backgrounds = $10 - $40 USD
Tilesets = $5 each / $20 - $50 USD per group
(depending on types of tilesets)
Iconset = $5 each / $35 - $80 if buying more then 10
(depending on quantity)
Windowskins = $7 each


Animations
Titles = $20+ USD (Depending on complexity)
Backgrounds= $20+ USD (Depending on complexity)
Regular Evented Scenes = $40+ USD each (Depending on complexity)
Parallax Scenes = $60+ USD each (Depending on complexity)
CG  = $300+ USD (Depending on complexity)
Maps

Basic Map Design = $7 USD each
Advanced Map Design = $10+ USD (Depending on complexity)
Scripts

Basic Custom Menu Script = $60 - $100 USD
More Advanced Menu Script = $120 - $300 USD (Animated, ext.)
Mini-games = $100 - $300 USD (Depending on complexity)
I am willing to build a custom card game if specifications are given Commissioned out E.T.A. 3 - 6 months
Battle Systems = $100 - $300 USD (Depending on complexity) Commissioned out E.T.A. 3 - 6 months
Others Scripts = $80 - $300 USD (Depending on complexity)

We are also willing to build games for you with as little or as much direction as you want. (Prices vary depending on complexity of game)
If you want to use your resources in multiple titles there is an additional charge of half the cost of the resource. (Prices vary depending on packages)
I require half of the total cost of any projects up front and the other half before completion.
If a project is finished and not picked up within 1 month of notification,
your resources will be resold and no money will be refunded.