Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX] Equipment Sets

Equipment Sets
Version: 1.1/size]
By: Dargor


Introduction

This script works like Diablo 2 "Gears Set" system. Lets say you have a set of "Mithril" items:
Mithril Blade, Mithril Shield, Mithril Armor, etc.
If you have all the "Mithril" set equipped, you gain stats bonuses.

Please tell me if you have any ideas for new features! :)

Features

• Can specify the required Weapons and Armors for every sets
• Can specify the HP, MP, ATK, DEF, SPI and AGI bonuses

Script

Code:
#==============================================================================

# ** Equipment Sets

#------------------------------------------------------------------------------

#  © Dargor, 2009

#  24/02/09

#  Version 1.1

#  Requested by teth

#------------------------------------------------------------------------------

#  VERSION HISTORY:

#   - 1.0   (18/02/09), Initial release

#   - 1.1   (24/02/09), Fix a method aliasing bug

#------------------------------------------------------------------------------

#  INTRODUCTION:

#     This script works like Diablo 2 "Gears Set" system.

#     Lets say you have a set of "Mithril" items:

#         Mithril Blade, Mithril Shield, Mithril Armor, etc.

#     If you have all the "Mithril" set equipped, you gain stats bonuses.

#------------------------------------------------------------------------------

#  INSTRUCTIONS:

#       1) Place this script ABOVE Main

#       2) Edit the constants in the Equip_Sets module

#------------------------------------------------------------------------------

#  NOTES:

#       - When defining required items in Set_Weapon, Set_Armor1, etc.,

#         you are not required to specify an item for each item kind.

#        

#         Example: If you specify an item for Armor1,2,3 & 4 but not for Weapon

#                  then this set doesn't require a weapon to give bonuses.

#==============================================================================

 

#==============================================================================

# ** Equipment Set Configuration module

#==============================================================================

 

module Equip_Sets

  # ID of sets available in the game

  Sets = [1]

  # Required Weapons

  # SYNTAX: { Set ID => required weapon ID }

  Set_Weapon = { 1 => 1}

  # Required Shields

  # SYNTAX: { Set ID => required shield ID }

  Set_Armor1 = { 1 => 1}

  # Required Helmets

  # SYNTAX: { Set ID => required helmet ID }

  Set_Armor2 = { 1 => 7}

  # Required Body Armors

  # SYNTAX: { Set ID => required body armor ID }

  Set_Armor3 = { 1 => 13}

  # Required Accessories

  # SYNTAX: { Set ID => required accessory ID }

  Set_Armor4 = { 1 => 23}

  # Set Stats Bonus

  # SYNTAX: { Set ID => [HP, MP, ATK, DEF, SPI, AGI] }

  Set_Bonus = { 1 => [100, 25, 10, 5, 10, 5] }

  # Full Set Equipped SE

  Full_Set_SE = 'Chime2'

end

 

#==============================================================================

# ** Sound

#------------------------------------------------------------------------------

#  This module plays sound effects. It obtains sound effects specified in the

# database from $data_system, and plays them.

#==============================================================================

 

module Sound

  # Limit

  def self.play_full_set

    se = RPG::SE.new(Equip_Sets::Full_Set_SE)

    se.play

  end

end

 

#==============================================================================

# ** Game_Battler

#------------------------------------------------------------------------------

#  This class deals with battlers. It's used as a superclass of the Game_Actor

# and Game_Enemy classes.

#==============================================================================

 

class Game_Battler

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_equip_set_battler_clear_extra_values clear_extra_values

  alias dargor_vx_equip_set_battler_maxhp maxhp

  alias dargor_vx_equip_set_battler_maxmp maxmp

  alias dargor_vx_equip_set_battler_atk atk

  alias dargor_vx_equip_set_battler_def def

  alias dargor_vx_equip_set_battler_spi spi

  alias dargor_vx_equip_set_battler_agi agi

  #--------------------------------------------------------------------------

  # * Clear Values Added to Parameter

  #--------------------------------------------------------------------------

  def clear_extra_values

    dargor_vx_equip_set_battler_clear_extra_values

    clear_set_extra_values

  end

  #--------------------------------------------------------------------------

  # * Clear Values Added to Parameter

  #--------------------------------------------------------------------------

  def clear_set_extra_values

    @set_maxhp_plus = 0

    @set_maxmp_plus = 0

    @set_atk_plus = 0

    @set_def_plus = 0

    @set_spi_plus = 0

    @set_agi_plus = 0

  end

  #--------------------------------------------------------------------------

  # * Get Maximum HP

  #--------------------------------------------------------------------------

  def maxhp

    bonus = dargor_vx_equip_set_battler_maxhp + @set_maxhp_plus

    n = [[bonus, 1].max, maxhp_limit].min

    return n

  end

  #--------------------------------------------------------------------------

  # * Get Maximum MP

  #--------------------------------------------------------------------------

  def maxmp

    bonus = dargor_vx_equip_set_battler_maxmp + @set_maxmp_plus

    n = [[bonus, 0].max, 9999].min

    return n

  end

  #--------------------------------------------------------------------------

  # * Get Attack

  #--------------------------------------------------------------------------

  def atk

    bonus = dargor_vx_equip_set_battler_atk + @set_atk_plus

    n = [[bonus, 1].max, 999].min

    return n

  end

  #--------------------------------------------------------------------------

  # * Get Defense

  #--------------------------------------------------------------------------

  def def

    bonus = dargor_vx_equip_set_battler_def + @set_def_plus

    n = [[bonus, 1].max, 999].min

    return n

  end

  #--------------------------------------------------------------------------

  # * Get Spirit

  #--------------------------------------------------------------------------

  def spi

    bonus = dargor_vx_equip_set_battler_spi + @set_spi_plus

    n = [[bonus, 1].max, 999].min

    return n

  end

  #--------------------------------------------------------------------------

  # * Get Agility

  #--------------------------------------------------------------------------

  def agi

    bonus = dargor_vx_equip_set_battler_agi + @set_agi_plus

    n = [[bonus, 1].max, 999].min

    return n

  end

  #--------------------------------------------------------------------------

  # * Apply Bonus of Full Equipment Set

  #--------------------------------------------------------------------------

  def apply_equipment_set_bonus(set_id)

    if set_id != 0

      @set_maxhp_plus = Equip_Sets::Set_Bonus[set_id][0]

      @set_maxmp_plus = Equip_Sets::Set_Bonus[set_id][1]

      @set_atk_plus = Equip_Sets::Set_Bonus[set_id][2]

      @set_def_plus = Equip_Sets::Set_Bonus[set_id][3]

      @set_spi_plus = Equip_Sets::Set_Bonus[set_id][4]

      @set_agi_plus = Equip_Sets::Set_Bonus[set_id][5]

    else

      clear_set_extra_values

    end

  end

end

 

#==============================================================================

# ** Game_Actor

#------------------------------------------------------------------------------

#  This class handles actors. It's used within the Game_Actors class

# ($game_actors) and referenced by the Game_Party class ($game_party).

#==============================================================================

 

class Game_Actor < Game_Battler

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_reader :equipped_set_id

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias dargor_vx_equip_set_actor_setup setup

  alias dargor_vx_equip_set_actor_change_equip change_equip

  #--------------------------------------------------------------------------

  # * Setup

  #   actor_id  : actor ID

  #--------------------------------------------------------------------------

  def setup(actor_id)

    dargor_vx_equip_set_actor_setup(actor_id)

    @equipped_set_id = 0

  end

  #--------------------------------------------------------------------------

  # * Check if a full set is equipped

  #--------------------------------------------------------------------------

  def full_set_equipped?

    for set_id in Equip_Sets::Sets

      if set_weapon_equipped?(set_id) && set_armor_equipped?(set_id, 1) &&

          set_armor_equipped?(set_id, 2) && set_armor_equipped?(set_id, 3) &&

          set_armor_equipped?(set_id, 4)

        @equipped_set_id = set_id

        return true

      end

    end

    @equipped_set_id = 0

    apply_equipment_set_bonus(0)

    return false

  end

  #--------------------------------------------------------------------------

  # * Check if a full set is equipped (weapon)

  #--------------------------------------------------------------------------

  def set_weapon_equipped?(set_id)

    if Equip_Sets::Set_Weapon.has_key?(set_id)

      result = @weapon_id == Equip_Sets::Set_Weapon[set_id]

    else

      result = true

    end

    return result

  end

  #--------------------------------------------------------------------------

  # * Check if a full set is equipped (armor)

  #--------------------------------------------------------------------------

  def set_armor_equipped?(set_id, armor_id)

    result = false

    case armor_id

    when 1

      if Equip_Sets::Set_Armor1.has_key?(set_id)

        result = @armor1_id == Equip_Sets::Set_Armor1[set_id]

      else

        result = true

      end

    when 2

      if Equip_Sets::Set_Armor2.has_key?(set_id)

        result = @armor2_id == Equip_Sets::Set_Armor2[set_id]

      else

        result = true

      end

    when 3

      if Equip_Sets::Set_Armor3.has_key?(set_id)

        result = @armor3_id == Equip_Sets::Set_Armor3[set_id]

      else

        result = true

      end

    when 4

      if Equip_Sets::Set_Armor4.has_key?(set_id)

        result = @armor4_id == Equip_Sets::Set_Armor4[set_id]

      else

        result = true

      end

    end

    return result

  end

  #--------------------------------------------------------------------------

  # * Change Equipment (designate object)

  #     equip_type : Equip region (0..4)

  #     item       : Weapon or armor (nil is used to unequip)

  #     test       : Test flag (for battle test or temporary equipment)

  #--------------------------------------------------------------------------

  def change_equip(equip_type, item, test = false)

    dargor_vx_equip_set_actor_change_equip(equip_type, item, test)

    unless test

      if full_set_equipped? and

        apply_equipment_set_bonus(@equipped_set_id)

        Sound.play_full_set

      end

    end

  end

end

Instructions

Place this script above Main.
Refer to the script header and comments for more informations.

Compatibility

Should be compatible with everything.

Credits and Thanks

Thanks to teth for requesting this script!
 

Daikon

Member

I have a suggestion...how about you gain a skill when you have the set equipped, and when its not equipped you don't have the skill anymore.
 

teth

Member

Dargor you rox :D
Thanks for doing this script i'm sure i will use this.
And thanks for credits :)
Be healthy and thanks again xD
Teth

@edit
I don't know why but when i not added accesory and when i was worn all items from set i haven't got any bonus :( So what could happened? :<
module Equip_Sets
# ID of sets available in the game
Sets = [1]
# Required Weapons
# SYNTAX: { Set ID => required weapon ID }
Set_Weapon = { 1 => 1}
# Required Shields
# SYNTAX: { Set ID => required shield ID }
Set_Armor1 = { 1 => 42}
# Required Helmets
# SYNTAX: { Set ID => required helmet ID }
Set_Armor2 = { 1 => 41}
# Required Body Armors
# SYNTAX: { Set ID => required body armor ID }
Set_Armor3 = { 1 => 34}
# Required Accessories
# SYNTAX: { Set ID => required accessory ID }
Set_Armor4 =
# Set Stats Bonus
# SYNTAX: { Set ID => [HP, MP, ATK, DEF, SPI, AGI] }
Set_Bonus = { 1 => [100, 25, 10, 5, 10, 5] }
# Full Set Equipped SE
Full_Set_SE = 'Chime2'
end
Teth

@down
Doesn't work :<
 
If your set doesn't require a weapon/armor, simply omit them.
The reason why it doesn't work is because of this:

Set_Armor4 = { 1 => 0 }

You are asking the script to watch if Armor ID 0 is equipped but Armor ID 0 doesn't exist. Simply put nothing there and it will work!

Take care
-Dargor
 
Please tell me if you have any ideas for new features! :)
i got a few ideas for nice features :p:
1)having the name of the set that the item belongs to written near it.
2)different types of sets will have different colors[the item's name color]
like in diablo 2/sacred and all these types of games....
3)special sets that need 2 different weapons to be complete[dunno maybe you already did it :p, but if not then you should :p]
4)when a special set is equiped it will add a glowing effect to the character's battler sprite? [like if it's a fire set it'll add a glowing fire effect behind the battler or something][for tankentai sbs :P][just an idea :P].

it'll be awesome if you could make those :)
 
1) It will be added in the next version
2) It's already possible with my Custom COmmands script (version 3.6+) but I'll probably add that as a feature in this script too.
3) I often forget about the dual weilding feature >< I'll add support for that
4) Maybe

I'm also adding a skill learning feature and a window will popup to display which set you have equipped and probably show the bonus and changes.

Take care!
-Dargor
 

Devlin

Member

During the game, I spotted a bug. Think you can find it in this code?:

Code:
86  alias dargor_vx_equip_set_battler_maxhp maxhp

87  alias dargor_vx_equip_set_battler_maxhp maxmp 

EDIT: I took another look, and saw another same mistake later in the script.


VV-- No problem
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top