Quantcast
Channel: RGSS3 Scripts (RMVX Ace) Latest Topics
Viewing all articles
Browse latest Browse all 416

(Auto) Equip Slots (Beginner friendly)

$
0
0

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.

 

equipslotexample.png

 

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

RPGMaker_VX_Ace_Character.png

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.
 
multipleslots.png
 
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:

#==============================================================================# ■ 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


Viewing all articles
Browse latest Browse all 416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>