MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
185
First Language
Meowish
Primarily Uses
Made for a request here.

This script allows equip slots to be add/remove automatically simply by adding/removing armour type in the database editor.

Since it's using armour type instead of equip type for slots, you can add as many slot types as you like to your game simply by creating more armour types in database=>terms. The slots will automatically be available to the actor as long as he/she can use that weapon/armour type. So actors with their own slots, job change with their own slots, states that effect slots, weapon/armour that add/delete slots, cursed armour/weapon etc etc can be done easily right inside the database editor without any scripting knowledge.

[IMG]http://s9.postimg.org/fbd4a1btb/equipslotexample.png[/IMG]

Features:

[1] Automatic add/remove equip slots based on database editor's setting (actor/class/weapon/armour/state)

[2] Able to add as many equip slot types as you like

[3] Automatic name the slots to be the same as weapon/armour types in database=>terms

[4] Automatic name the weapon slot type and stack when more than one weapon is allowed (separated by /)

[5] Able to seal/fix weapons/armours using note tags

[6] Able to seal off dual wield when using two handed weapon

[7] Able to set starting gears using note tags

[8] Sealed weapon/armour slots are automatically removed from the equip slot list

How to Use:

[1] The script itself is pretty much plug & play. Simply paste this script below Material and above Main in your script editor

[2] To add an equipment slot to the actor, all you need is to add weapon & armour types to either Actor/Class/Weapons/Armors/States under Features in the Database editor. As long as the weapon/armour type is available to the actor, the slot will automatically show up in the equip list.

(as shown in picture below)

This is all you need to add the equip slots to the class/actor/weapon/armour/state

[IMG]http://s23.postimg.org/7z0xtsri3/RPGMaker_VX_Ace_Character.png[/IMG]

NOTE: You can create as many armour types as you like in Database=>Terms=>Armour type, they can then later be added to actor/class/weapon/armor/state in their features(as shown in picture above).

 

[3] To have more than 1 same type equipment slots(armour only), just add another of the same armour type in features in the database editor. eg, if you want 3 accessories slot, just add accessories armour type 3 times in features.

 

[IMG]http://s1.postimg.org/7pxhx2wy7/multipleslots.png[/IMG]

 

NOTE: When using more than 1 types of weapon, the type name will stack, separated by /

eg. Sword/Claw/Whip

To disable showing weapon types, go to settings area in the script and change true to false

 

[4] To Seal/Fixed an equip slot type, add the following to the Actor/Class/Weapon/Armor/State note box

   <seal: 1, 3, 4> or <SEAL: 1, 3, 4>

   <fix: 2, 5, 6> or <FIX: 2, 5, 6>

    0 = weapon, 1~=armor type id (same as those under Database=>Terms tab=>Armour types)

 

NOTE: Sealed gear slots are automatically hidden from equip scene

 

[5] To seal off dual wield when using a 2 handed weapon, add below to weapon's note box

    <twohand>

 

[6] To add starting gears(armours only), add below to actor's note box

    <gear: 21, 15, 61> or <GEAR: 21, 15, 61>

    please use armour's id here (refer to Database=>Armors tab)

 

 [!!_IMPORTANT NOTE_!!]

  * Equip types no longer work and are replaced by Armour types

  * Only use the note tag to do seal/fix, the editor's default seal/fix no longer works correctly because they are meant for the old

     equip type not the new armour type this script is using.

  * Add starting gears using the note tag is for armours only, you are still require to add starting weapons using the default

     database editor's way.

Compatibility:

This script modifies the way equip slots works, but is kept at the minimum to avoid conflicts.

If you find it conflicting with another script. Try move this script above/below that other script.

Terms of Use:

Free for both commercial and non-commercial.

Script:

Code:
#==============================================================================# ■ Meow Face (Auto) Equip Slots#------------------------------------------------------------------------------# Automatically Add/Remove equip slots based on database editor weapon/armor types# Automatically name slots to be the same as weapon/armor types#==============================================================================## [How to Use]## [1] Place this script below Material and above Main## [2] Add weapon & armor types to actor/class/weapon/armor/state under features## [3] To have more than 1 same equip slots(armor only), just add more in features.## NOTE: When using more than 1 types of weapon, the type name will stack, separated by /# eg. Sword/Claw/Whip#  To disable showing weapon types, goto settings area below and change true to false## [4] To Seal/Fixed a gear slot, add the following to the actor/class/weapon/armor/state notebox#    <seal: 1, 3, 4> or <SEAL: 1, 3, 4>#    <fix: 2, 5, 6> or <FIX: 2, 5, 6>#     0 = weapon, 1~=armor type id (same as those under terms tab)## NOTE: Sealed gear slots are automatically removed from equip scene## [5] To seal off dual wield when using a 2 handed weapon, add below to weapon's notebox#    <twohand>## [6] To add starting gears(armors only, use editor for weapon), add below to actor's notebox#    <gear: 21, 15, 61> or <GEAR: 21, 15, 61>#    use armor's id here## [!!_IMPORTANT NOTE_!!]#  * Equip types no longer work and are replaced by Armor types#  * Only use the script's seal/fix, the editor's default seal/fix no longer works#  * Add starting gears using the script's method for armor only, weapons still require editor#==============================================================================module MEOWFACE_EQUIP_SLOTS #DO NOT REMOVE!!#==============================================================================# Settings Area#==============================================================================  SHOW_WEAPON_TYPE = true #Show weapon's individual type(true)/default(false)#==============================================================================# End of Settings Area# Edit anything past this line at your own risk!#==============================================================================endmodule Vocab  def self.mfwtype(wtype_id)    $data_system.weapon_types[wtype_id]  end  def self.mfatype(atype_id)    $data_system.armor_types[atype_id]  endendclass RPG::BaseItem  def meow_start_gear    return @meowgear if @meowgear != nil    @meowgear = []    stmemo = @note.scan(/<(?:GEAR|gear):[ ](\d+(?:\s*,\s*\d+)*)>/i).flatten    stmemo.each do |m|      m.to_s.split(/\s*,\s*/).each {|d| @meowgear.push(d.to_i)} if stmemo != nil && !stmemo.empty?    end    @meowgear  end  def meow_fix_gear    return @meowfixeq if @meowfixeq != nil    @meowfixeq = []    fmemo = @note.scan(/<(?:FIX|fix):[ ](\d+(?:\s*,\s*\d+)*)>/i).flatten    fmemo.each do |m|      m.to_s.split(/\s*,\s*/).each {|d| @meowfixeq.push(d.to_i)} if fmemo != nil && !fmemo.empty?    end    @meowfixeq  end  def meow_seal_gear    return @meowsealeq if @meowsealeq != nil    @meowsealeq = []    smemo = @note.scan(/<(?:SEAL|seal):[ ](\d+(?:\s*,\s*\d+)*)>/i).flatten    smemo.each do |m|     m.to_s.split(/\s*,\s*/).each {|d| @meowsealeq.push(d.to_i)} if smemo != nil && !smemo.empty?    end    @meowsealeq  endendclass RPG::Armor < RPG::EquipItem  def etype_id #overwrite method    return self.atype_id  endendclass RPG::Weapon < RPG::EquipItem  def two_hand?    @note.include?("<twohand>")  endendclass Game_BattlerBase  def equip_type_fixed?(etype_id) #overwrite method    meow_fixed_sum.include?(etype_id)  end  def equip_type_sealed?(etype_id) #overwrite method    meow_sealed_sum.include?(etype_id)  end  def equip_features(code)    features(code).inject([]) {|r, ft| r += [ft.data_id] }  end  def eq_wtype    return [] if meow_sealed_sum.include?(0)    features_set(FEATURE_EQUIP_WTYPE)  end  def eq_atype    equip_features(FEATURE_EQUIP_ATYPE) - meow_sealed_sum  endendclass Game_Actor < Game_Battler  alias meow_init_equips init_equips  def init_equips(equips)    meow_init_equips(equips)    meow_start_equip  end  def meow_start_equip    for id in actor.meow_start_gear      meowarmor = $data_armors[id]      next if meowarmor.nil?      etype_id = meowarmor.etype_id      next unless equip_slots.include?(etype_id)      slot_id = empty_slot(etype_id)      @equips[slot_id].set_equip(etype_id == 0, meowarmor.id)    end    optimize_equipments    refresh  end  def meow_fixed_sum    @meow_fixed_math = []    @meow_fixed_math += self.class.meow_fix_gear    @meow_fixed_math += actor.meow_fix_gear    for equip in equips      next if equip.nil?      @meow_fixed_math += equip.meow_fix_gear    end    for state in states      next if state.nil?      @meow_fixed_math += state.meow_fix_gear    end    @meow_fixed_math  end  def meow_sealed_sum    @meow_sealed_math = []    @meow_sealed_math += self.class.meow_seal_gear    @meow_sealed_math += actor.meow_seal_gear    for equip in equips      next if equip.nil?      @meow_sealed_math += equip.meow_seal_gear    end    for state in states      next if state.nil?      @meow_sealed_math += state.meow_seal_gear    end    @meow_sealed_math  end  def two_handed?    weapons.any? do |weapon|       return weapon.two_hand? if weapon != nil    end  end  def equip_slots #overwrite method    if eq_wtype == []      return eq_atype    else      return [0]+eq_atype if two_handed?      return [0,0]+eq_atype if dual_wield?      return [0]+eq_atype    end  endendclass Window_EquipSlot < Window_Selectable  def slot_name(index) #overwrite method    if @actor.equip_slots[index] == 0      if !MEOWFACE_EQUIP_SLOTS::SHOW_WEAPON_TYPE        return @actor ? Vocab::etype(@actor.equip_slots[index]) : ""      end      mfwtype_name = ""      last_id = @actor.eq_wtype[-1]      @actor.eq_wtype.each do |id|        mfwtype_name += Vocab::mfwtype(id)        if id != last_id          mfwtype_name += "/"        end      end      @actor ? mfwtype_name : ""    else      @actor ? Vocab::mfatype(@actor.equip_slots[index]) : ""    end  endendclass Scene_Equip < Scene_MenuBase  alias meow_csw create_slot_window  def create_slot_window    meow_csw    @slot_window.create_contents    @slot_window.draw_all_items  end  alias meow_oac on_actor_change  def on_actor_change    meow_oac    @slot_window.create_contents    @slot_window.draw_all_items  endend
 
Last edited by a moderator:

MeowFace

Meow
Veteran
Joined
Feb 22, 2015
Messages
1,034
Reaction score
185
First Language
Meowish
Primarily Uses
The script in the top post is being messed up due to the recent V3 to V4 forum migration.


Please use this alternative version until the web staff is able to find a way to fix the top post.

Code:
#==============================================================================
# ■ Meow Face (Auto) Equip Slots
#------------------------------------------------------------------------------
# Automatically Add/Remove equip slots based on database editor weapon/armor types
# Automatically name slots to be the same as weapon/armor types
#==============================================================================
#
# [How to Use]
#
# [1] Place this script below Material and above Main
#
# [2] Add weapon & armor types to actor/class/weapon/armor under features
#
# [3] To have more than 1 same equip slots(armor only), just add more in features.
#
# NOTE: When using more than 1 types of weapon, the type name will stack, separated by /
# eg. Sword/Claw/Whip
#  To disable showing weapon types, goto settings area below and change true to false
#
# [4] To Seal/Fixed a gear slot, add the following to the actor/class/weapon/armor/state notebox
#    <seal: 1, 3, 4> or <SEAL: 1, 3, 4>
#    <fix: 2, 5, 6> or <FIX: 2, 5, 6>
#     0 = weapon, 1~=armor type id (same as those under terms tab)
#
# NOTE: Sealed gear slots are automatically removed from equip scene
#
# [5] To seal off dual wield when using a 2 handed weapon, add below to weapon's notebox
#    <twohand>
#
# [6] To add starting gears(armors only, use editor for weapon), add below to actor's notebox
#    <gear: 21, 15, 61> or <GEAR: 21, 15, 61>
#    use armor's id here
#
# [!!_IMPORTANT NOTE_!!]
#  * Equip types no longer work and are replaced by Armor types
#  * Only use the script's seal/fix, the editor's default seal/fix no longer works
#  * Add starting gears using the script's method for armor only, weapons still require editor
#==============================================================================
module MEOWFACE_EQUIP_SLOTS #DO NOT REMOVE!!
#==============================================================================
# Settings Area
#==============================================================================
  SHOW_WEAPON_TYPE = true #Show weapon's individual type(true)/default(false)
#==============================================================================
# End of Settings Area
# Edit anything past this line at your own risk!
#==============================================================================
end
module Vocab
  def self.mfwtype(wtype_id)
    $data_system.weapon_types[wtype_id]
  end
  def self.mfatype(atype_id)
    $data_system.armor_types[atype_id]
  end
end
class RPG::BaseItem
  def meow_start_gear
    return @meowgear if @meowgear != nil
    @meowgear = []
    stmemo = @note.scan(/<(?:GEAR|gear):[ ](\d+(?:\s*,\s*\d+)*)>/i).flatten
    stmemo.each do |m|
      m.to_s.split(/\s*,\s*/).each {|d| @meowgear.push(d.to_i)} if stmemo != nil && !stmemo.empty?
    end
    @meowgear
  end
  def meow_fix_gear
    return @meowfixeq if @meowfixeq != nil
    @meowfixeq = []
    fmemo = @note.scan(/<(?:FIX|fix):[ ](\d+(?:\s*,\s*\d+)*)>/i).flatten
    fmemo.each do |m|
      m.to_s.split(/\s*,\s*/).each {|d| @meowfixeq.push(d.to_i)} if fmemo != nil && !fmemo.empty?
    end
    @meowfixeq
  end
  def meow_seal_gear
    return @meowsealeq if @meowsealeq != nil
    @meowsealeq = []
    smemo = @note.scan(/<(?:SEAL|seal):[ ](\d+(?:\s*,\s*\d+)*)>/i).flatten
    smemo.each do |m|
     m.to_s.split(/\s*,\s*/).each {|d| @meowsealeq.push(d.to_i)} if smemo != nil && !smemo.empty?
    end
    @meowsealeq
  end
end
class RPG::Armor < RPG::EquipItem
  def etype_id #overwrite method
    return self.atype_id
  end
end
class RPG::Weapon < RPG::EquipItem
  def two_hand?
    @note.include?("<twohand>")
  end
end
class Game_BattlerBase
  def equip_type_fixed?(etype_id) #overwrite method
    meow_fixed_sum.include?(etype_id)
  end
  def equip_type_sealed?(etype_id) #overwrite method
    meow_sealed_sum.include?(etype_id)
  end
  def equip_features(code)
    features(code).inject([]) {|r, ft| r += [ft.data_id] }
  end
  def eq_wtype
    return [] if meow_sealed_sum.include?(0)
    features_set(FEATURE_EQUIP_WTYPE)
  end
  def eq_atype
    equip_features(FEATURE_EQUIP_ATYPE) - meow_sealed_sum
  end
end
class Game_Actor < Game_Battler
  alias meow_init_equips init_equips
  def init_equips(equips)
    meow_init_equips(equips)
    meow_start_equip
  end
  def meow_start_equip
    for id in actor.meow_start_gear
      meowarmor = $data_armors[id]
      next if meowarmor.nil?
      etype_id = meowarmor.etype_id
      next unless equip_slots.include?(etype_id)
      slot_id = empty_slot(etype_id)
      @equips[slot_id].set_equip(etype_id == 0, meowarmor.id)
    end
    optimize_equipments
    refresh
  end
  def meow_fixed_sum
    @meow_fixed_math = []
    @meow_fixed_math += self.class.meow_fix_gear
    @meow_fixed_math += actor.meow_fix_gear
    for equip in equips
      next if equip.nil?
      @meow_fixed_math += equip.meow_fix_gear
    end
    for state in states
      next if state.nil?
      @meow_fixed_math += state.meow_fix_gear
    end
    @meow_fixed_math
  end
  def meow_sealed_sum
    @meow_sealed_math = []
    @meow_sealed_math += self.class.meow_seal_gear
    @meow_sealed_math += actor.meow_seal_gear
    for equip in equips
      next if equip.nil?
      @meow_sealed_math += equip.meow_seal_gear
    end
    for state in states
      next if state.nil?
      @meow_sealed_math += state.meow_seal_gear
    end
    @meow_sealed_math
  end
  def two_handed?
    weapons.any? do |weapon| 
      return weapon.two_hand? if weapon != nil
    end
  end
  def equip_slots #overwrite method
    if eq_wtype == []
      return eq_atype
    else
      return [0]+eq_atype if two_handed?
      return [0,0]+eq_atype if dual_wield?
      return [0]+eq_atype
    end
  end
end
class Window_EquipSlot < Window_Selectable
  def slot_name(index) #overwrite method
    if @actor.equip_slots[index] == 0
      if !MEOWFACE_EQUIP_SLOTS::SHOW_WEAPON_TYPE
        return @actor ? Vocab::etype(@actor.equip_slots[index]) : ""
      end
      mfwtype_name = ""
      last_id = @actor.eq_wtype[-1]
      @actor.eq_wtype.each do |id|
        mfwtype_name += Vocab::mfwtype(id)
        if id != last_id
          mfwtype_name += "/"
        end
      end
      @actor ? mfwtype_name : ""
    else
      @actor ? Vocab::mfatype(@actor.equip_slots[index]) : ""
    end
  end
end
class Scene_Equip < Scene_MenuBase
  alias meow_csw create_slot_window
  def create_slot_window
    meow_csw
    @slot_window.create_contents
    @slot_window.draw_all_items
  end
  alias meow_oac on_actor_change
  def on_actor_change
    meow_oac
    @slot_window.create_contents
    @slot_window.draw_all_items
  end
end
 

FlyImagi

Creative Crafting
Member
Joined
Jul 11, 2016
Messages
17
Reaction score
0
First Language
English
Primarily Uses
Hi Meowface, love the simplicity that your script provided, however i think i found 1 issue,


i notice when i add another slot equipment to character, it stacked between default weapon and default armor


well it just an equipment order.. but i really want the stacked appear below the default armor.. how can i do that ?


Thanks so much Meowface :)
 

FlyImagi

Creative Crafting
Member
Joined
Jul 11, 2016
Messages
17
Reaction score
0
First Language
English
Primarily Uses
Here is the picture that will explained the whole thing :

Add slot.png

After.png

Before.png
 

Latest Threads

Latest Profile Posts

After gathering, sorting out & reconsidering hundreds of enemy battlers over the last two das, finally my favorite part begins: Inventing names and lore for them all :D
I'm running a sale for Learn RPG Maker MV on Itch.io, can I compete with NSFW games earning goals?
Another Friday and another Zoom call that could have been an email. Working from home is awesome.
Finished with the semester; finally have some time to play around with MV :kaopride:
Started work on the fishing Mini-Game

Forum statistics

Threads
111,371
Messages
1,060,535
Members
144,698
Latest member
punisama
Top