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.

I have an error with my equipment screen (Casues game to crash randomly)

Okay so I am using this equipment screen...
PHP:
#==============================================================================
# Multi-slot equipment script
#------------------------------------------------------------------------------
# Guillaume777
# 5.0
# 2006/01/14
#==============================================================================
#To change slots of character
# $game_actors[1].weapon_slots = [0,0]
# $game_actors[1].armor_slots = [2,3,4,5,6,7]
#To make armor equipable in new slot Add (5) in its name, where 5 is its slot number
#To make 2handed weapons Add an element called 2handed to a weapon or, adds its id in TWO_HANDED_WEAPONS = []
#To make a weapon double attack Add an element called attackx2 to a weapon or, adds its id in DOUBLE_ATTACK_WEAPONS = []
module G7_MS_MOD #you set the default names,slots, etc here
#========Set weapon/armor properties ==========================================
CURSED_WEAPONS = [36,37] #ids of weapons to be cursed
CURSED_ARMORS = [39,40] #ids of armors to be cursed

TWO_HANDED_WEAPONS = [19] #ids of 2handed weapons
DOUBLE_ATTACK_WEAPONS = [4] #ids of double attack weapons

SWITCH_EQUIP_WEAPONS = [[38,37]]
SWITCH_EQUIP_ARMORS = [[41,40], [42,39]]
# use 1 array, first value of array = false item, second value = true item

HANDS_ELEMENT = 'handed'
#name of element for 2handed weapon
#put the number of hands in front of HANDS_ELEMENT in the database

MULTI_ATTACK_ELEMENT = 'attackx'
#name of element for multiple attack, when
#element tagging add the number of attacks after the name

#=====Set character slots properties ==========================================
WEAPON_KINDS = [0,0] #number of weapons, 0 = weapon
WEAPON_KIND_NAMES = ['R-Hand', 'L-Hand'] #custom name of extra weapon slots,
#leave empty or put nil inside if you want default name
ARMOR_KINDS = [1,2,3,4,5,6,7]
# 1 = shield
# 2 = helmet
# 3 = armor
# 4 = acc
# 5 = and more : extra slot
EXTRA_SLOT_NAMES = ['Gloves','Feet','Neck']
#Name of the extra slots in equip window
#You need as many words as there are '5' or more in armor_kinds
#The first order of the slots names reflect the order of the 5 in armor_kinds
#Put (5) or more to in the armor name to have it assigned to the extra slot

#=============Set multi-weapon behavior=======================================
SHIELD_HAND_SLOT = 1 #slot number to be used for shield hand
WEAPON_SHIELD_SHARE = true #if true, dont use shield and second weap at same time
SHIELD_HAND_WIELD = true#true = allow to use shield hand for two handed weapon
WEAPON_HAND_WIELD = true #true = allow to use weapon hand for two handed weapon

#============Set appearance properties ========================================
FONT_NAME = 'Tahoma' #font to use
CURSED_COLOR = Color.new(255, 50, 50) #color of cursed equiped items

WINDOWS_STRETCH = true #true : equip_right stretch to adjust to nb of slots
MAX_SHOW_SLOTS = 6 #maximum number of slots in 1 screen in equip right window
#Useless if windows_stretch = false
HELP_AT_BOTTOM = false #if true : will leave place for help window at bottom
#useless if you didn't mofidy the help window y coordinate

STATUS_WINDOW_ARRANGE = true #if true : you get a new status window.
EVADE = false # if draw_actor_parameter is configured to receive parameter 7
#( evade ), then it will show in new status window
# EVADE = true has no effect if STATUS_WINDOW_ARRANGE is false

#================ end of settings =============================================
def initialize
#This fix armor in $data_armors to correct kind and name
for armor in $data_armors #for each armor
unless armor == nil #if armor
armor.set_adv_type #set new type
end
end
super
end # end init
end #end module

module RPG
class Armor
def set_adv_type
if @name.sub!(/\((\d+)\)/, '') != nil
@kind = $1.to_i - 1 #set kind to number in name of armor
end
end
end #end armor

class Weapon
def number_hands

if G7_MS_MOD::TWO_HANDED_WEAPONS.include?(self.id) then
nb_hands = 2
else
nb_hands = 1
end
for elementnb in self.element_set #search element
elementname = $data_system.elements[elementnb].downcase
if elementname[-1* G7_MS_MOD::HANDS_ELEMENT.size, G7_MS_MOD::HANDS_ELEMENT.size] == G7_MS_MOD::HANDS_ELEMENT.downcase #if weapons has element for another attack
elementname = elementname.delete('a-z') #get the nb of attacks
if elementname != '' then
nb_hands = elementname.to_i
end
end
end
if nb_hands.is_a?(Integer) == false or nb_hands <= 0
nb_hands = 1
end
return nb_hands
end #end number_hands
def number_attacks
if G7_MS_MOD::DOUBLE_ATTACK_WEAPONS.include?(self.id) then
nb_attacks = 2
else
nb_attacks = 1
end
for elementnb in self.element_set #search element that could
#add more attacks
elementname = $data_system.elements[elementnb].downcase
if elementname[0,G7_MS_MOD::MULTI_ATTACK_ELEMENT.size] == G7_MS_MOD::MULTI_ATTACK_ELEMENT.downcase #if weapons has element for another attack
elementname = elementname.delete('a-z') #get the nb of attacks
if elementname != '' then
nb_attacks = elementname.to_i
end
end
end
if nb_attacks.is_a?(Integer) == false or nb_attacks <= 0
nb_attacks = 1
end
return nb_attacks
end
end #end weapon
end #end module
class Scene_Load < Scene_File
alias g7_ms_scene_title_read_save_data read_save_data
def read_save_data(file)
g7_ms_scene_title_read_save_data(file)

for armor in $data_armors #for each armor
unless armor == nil #if armor
armor.set_adv_type #set new type
end
end
for actor in 0...$data_actors.size
if $game_actors[actor] != nil and $game_actors[actor] != 0 then
$game_actors[actor].order_armor_ids #order armors
end
end
end
end
class Game_Actor < Game_Battler
include G7_MS_MOD
attr_accessor :equip_mode #used to restore equipment after false equip
attr_accessor :equip_type_force #used to bypass equip_type
attr_accessor :equip_from_menu #used to prevent the user to unequip cursed items
attr_accessor :translucent_texts #used to store translucents slots
alias g7_ms_game_actor_setup setup
def setup(actor_id)
g7_ms_game_actor_setup(actor_id) #setup normaly
self.order_armor_ids
end
alias g7_ms_game_actor_equip equip
def equip(equip_type, id)
if @equip_type_force != nil then equip_type = @equip_type_force end
#equip_type_force is used to bypass the
#equip_type argument
if self.equip_mode == 'STORE' then
#store equipment for it to be restored after checking what the stats would
self.equip_mode = nil
@stored_armors = self.armor_ids.dup
@stored_weapons = self.weapon_ids.dup
saved_mode = 'STORE'
elsif self.equip_mode == 'RESTORE'
#restore equipment after preview of new equipment on stats
self.equip_mode = nil
self.restore(equip_type)
return
else #if equipping for real
id = self.switch_items(equip_type,id) #switch item to be equiped to
#fool players
end
if self.enough_hands?(equip_type,id) == false then #if not enough hands
id = 0 #then don't equip
elsif self.equip_from_menu and self.cursed?(equip_type) then
id = 0 #if cursed and player tried to remove it, do nothing
elsif equip_type <= 4 #if the slot is one of the 5 basic one
g7_ms_game_actor_equip(equip_type, id) #equip the good old way
else
equip_extra(equip_type,id) #equip in the new way
end
#fix in case there are no enough empty hands for all the equipped weapons
if id != 0 then self.fix_handed_weapons(equip_type) end

#this ensure that the next equiping will restore the original equipment
if saved_mode == 'STORE' then self.equip_mode = 'RESTORE' end
end

def restore(equip_type)
#restore equipment once the stats got checked
#and adds translucent
if self.translucent_texts == nil then self.translucent_texts = Array.new end
self.equip_from_menu = false

if equip_type != 0 and @stored_weapons[0] != self.weapon_ids[0]
self.translucent_texts[0] = true
end
for i in 1...@stored_weapons.size
if i+self.armor_slots.size != equip_type and
@stored_weapons[i] != self.weapon_ids[i] then
self.translucent_texts[i] = true
end
end
for i in 0...@stored_armors.size
if i+1 != equip_type and
@stored_armors[i] != self.armor_ids[i] then

self.translucent_texts[self.weapon_slots.size + i] = true
end
end
@equip_type_force = nil
copy = self.translucent_texts.dup

self.weapon_ids = nil
self.armor_ids = nil
self.weapon_ids = @stored_weapons
self.armor_ids = @stored_armors

self.translucent_texts = copy
end

def switch_items(equip_type,id)
if self.cursed?(equip_type) == false then
if equip_type == 0 or equip_type > self.armor_slots.size
for i in 0...SWITCH_EQUIP_WEAPONS.size
if SWITCH_EQUIP_WEAPONS[i][0] == id then
$game_party.lose_weapon(SWITCH_EQUIP_WEAPONS[i][0], 1)
$game_party.gain_weapon(SWITCH_EQUIP_WEAPONS[i][1], 1)
id = SWITCH_EQUIP_WEAPONS[i][1]
end
end
else
for i in 0...SWITCH_EQUIP_ARMORS.size
if SWITCH_EQUIP_ARMORS[i][0] == id then
$game_party.lose_armor(SWITCH_EQUIP_ARMORS[i][0], 1)
$game_party.gain_armor(SWITCH_EQUIP_ARMORS[i][1], 1)
id = SWITCH_EQUIP_ARMORS[i][1]
end
end
end
end
return id
end
def enough_hands?(equip_type, id)
if equip_type == 0 or equip_type > [self.armor_slots.size ,4].max #if weapon
if id !=0
nb = $data_weapons[id].number_hands

if self.shield_hand_wield then
for i in 0...self.armor_slots.size
if self.armor_slots[i] == self.shield_hand_slot
if self.weapon_shield_share == true then nb += 1 end
if self.cursed?(i+1) then nb += 1 end
end
end
end
if self.weapon_hand_wield
if self.cursed?(0) then #penalities if can't remove shield
nb = nb + $data_weapons[self.weapon_ids[0]].number_hands
end

for i in 1...self.weapon_slots.size #penalities if cant remove weapon
if self.cursed?(self.armor_slots.size + i)
nb = nb + $data_weapons[self.weapon_ids[i]].number_hands
end
end
end
else
return true
end
else
return true #of course there are enough hands if its not a weapon !
end
nb_s =0
for narmor in 0...self.armor_slots.size
if self.armor_slots[narmor] == self.shield_hand_slot then nb_s += 1 end
end
if nb == 1 then #if it only takes 1 hand to hold
return true
elsif nb > self.weapon_slots.size and self.shield_hand_wield == false and self.weapon_hand_wield
return false
elsif nb > nb_s+1 and self.weapon_hand_wield == false and self.shield_hand_wield
return false
elsif nb > self.weapon_slots.size+ nb_s and self.weapon_hand_wield and self.shield_hand_wield
return false
elsif self.shield_hand_wield == false and self.weapon_hand_wield == false
return false
else
return true
end
end
def equip_extra(equip_type,id)
if equip_type <= self.armor_slots.size # if its extra armor slot
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[self.armor_ids[equip_type-1]], $data_armors[id])
$game_party.gain_armor(self.armor_ids[equip_type-1], 1)
self.armor_ids[equip_type-1] = id
$game_party.lose_armor(id, 1)
end
else #if its weapon slot
if id == 0 or $game_party.weapon_number(id) > 0
equip_type = equip_type - [self.armor_slots.size, 4].max
$game_party.gain_weapon(self.weapon_ids[equip_type], 1)
self.weapon_ids[equip_type] = id
$game_party.lose_weapon(id, 1)
end
end
end
def fix_handed_weapons(equip_keep=nil) #parameter for weapon to keep
array_wield_hands = Array.new #stores slot of weapon that need empty hands
nb_emp_w_hands = 0 #stores nb of empty weapon hands
nb_emp_s_hands = 0 #stores nb of empty shield hands
nb_emp_hands = 0
penalities = 0

save_force = @equip_type_force
save_menu = @equip_from_menu
@equip_from_menu = false
@equip_type_force = nil

if self.shield_hand_wield
for narmor in 0...self.armor_slots.size
if self.armor_slots[narmor] == self.shield_hand_slot
if self.weapon_shield_share == true then
penalities += 1
end

if self.armor_ids[narmor] == 0 then
nb_emp_hands += 1 #stores empty shield hand
end
end
end
end
for nweapon in 0...self.weapon_slots.size
if self.weapon_ids[nweapon] == 0
if self.weapon_hand_wield then
nb_emp_hands += 1
end
else
array_wield_hands.push(nweapon) #stores the hand to wield weapon
end
end
for nweapon in 0...array_wield_hands.size
if self.weapon_ids[array_wield_hands[nweapon]] != 0 then
nb_hands = $data_weapons[self.weapon_ids[array_wield_hands[nweapon]]].number_hands
nb_hands += penalities
penalities = 0
save_hands = nb_hands
end
while nb_emp_hands != 0 and nb_hands > 1
#if it finds empty hand
nb_hands += -1 #decrease counter
nb_emp_hands += -1
end

#if shield needs to be removed for empty hand
if self.shield_hand_wield then
for namor in 0...self.armor_slots.size
if nb_hands > 1 and self.armor_ids[namor] != 0 and
self.armor_slots[namor] == self.shield_hand_slot and
namor+1 != equip_keep and self.cursed?(namor+1) == false then
nb_hands += -1
self.equip(namor+1,0)
end
end
end
#if it must remove weapons to make room for empty hands
if self.weapon_hand_wield == true then
for nhand in 0...self.weapon_slots.size
if nb_hands > 1 and self.weapon_ids[nhand] != 0
if nhand == 0 then
if equip_keep != 0 and self.cursed?(0) == false then
n = nb_emp_hands
nb_emp_hands += $data_weapons[self.weapon_ids[nhand]].number_hands
n = nb_emp_hands - n
self.equip(0,0)
end
else
if nhand+[self.armor_slots.size,4].max != equip_keep and
self.cursed?(nhand+[self.armor_slots.size,4].max) == false
then
if nhand > array_wield_hands[nweapon] then
nb_emp_hands += 1
else
nb_emp_hands += $data_weapons[self.weapon_ids[nhand]].number_hands
end
self.equip(nhand+[self.armor_slots.size,4].max, 0)
end
end #end if nhnad ==0
end #end if nb_hands != 1
while nb_emp_hands != 0 and nb_hands > 1
#if it finds empty hand
nb_hands += -1 #decrease counter
nb_emp_hands += -1
end
end #end for nahand
end #end if self.weapon
if nb_hands > 1 #if still can't find a slot, remove the weapon

if array_wield_hands[nweapon] == 0 and self.cursed?(0) == false then
nb_emp_hands = 1 + nb_emp_hands + save_hands - nb_hands
self.equip(0, 0)
elsif self.cursed?(array_wield_hands[nweapon]+[self.armor_slots.size,4].max) == false and
array_wield_hands[nweapon] != 0 then
nb_emp_hands = 1 + nb_emp_hands + save_hands - nb_hands
self.equip(array_wield_hands[nweapon]+[self.armor_slots.size,4].max,0)
end
end
while nb_emp_hands != 0 and nb_hands > 1
#if it finds empty hand
nb_hands += -1 #decrease counter
nb_emp_hands += -1
end
if nb_hands > 1 then #if STILL not enough hands
self.equip(equip_keep,0) # remove the item the user tried to equip
end
end
@equip_type_force = save_force #returns old equip_type_force
@equip_from_menu = save_menu #return old equip_from_menu
end
def cursed?(equip_type)
if equip_type == 0
if G7_MS_MOD::CURSED_WEAPONS.include?(self.weapon_ids[0]) then return true end
elsif equip_type <= self.armor_slots.size #if armor
if G7_MS_MOD::CURSED_ARMORS.include?(self.armor_ids[equip_type - 1]) then return true end
else
if G7_MS_MOD::CURSED_WEAPONS.include?(self.weapon_ids[equip_type - [self.armor_slots.size, 4].max]) then return true end
end
return false
end

def remove_curse
self.equip_type_force = nil
if G7_MS_MOD::CURSED_WEAPONS.include?(self.weapon_ids[0]) then
self.equip(0, 0)
end

for i in 1...self.weapon_slots.size
if G7_MS_MOD::CURSED_WEAPONS.include?(self.weapon_ids[i]) then
self.equip(self.armor_slots.size + i, 0)
end
end
for i in 0...self.armor_slots.size
if G7_MS_MOD::CURSED_ARMORS.include?(self.armor_ids[i]) then
self.equip(i+1, 0)
end
end
end
def order_armor_ids
equipment_array = Array.new

for i in 0...self.armor_ids.size
if self.armor_ids[i] != nil and self.armor_ids[i] != 0
kind = $data_armors[self.armor_ids[i]].kind
if equipment_array[kind] == nil then
equipment_array[kind] = Array.new
end
equipment_array[kind].push(self.armor_ids[i])
#array in which 0 = array for shield, 1 = array for helmet,
#2 = array for armor and 3 = array for accessory, etc
end
end

self.armor_ids = nil #remove all armors
armors = Array.new
for i in 0...self.armor_slots.size
aitem = nil
if equipment_array[(self.armor_slots[i])-1] == nil then
equipment_array[(self.armor_slots[i])-1] = Array.new
end
while aitem == nil and equipment_array[(self.armor_slots[i])-1].size != 0
aitem = equipment_array[(self.armor_slots[i])-1].delete_at(0)
if aitem == 0 then aitem = nil end
end
if aitem != nil then
armors.push(aitem) #adds armor
else
armors.push(0) #adds empty
end #end if iaitem != nil
end #end for i in

self.armor_ids = armors
end
def reset_all_slots
self.armor_slots = nil
self.weapon_slots = nil
self.armor_slot_names = nil
self.weapon_slot_names = nil
self.extra_slot_names = nil
self.shield_hand_wield = nil
self.shield_hand_slot = nil
self.weapon_hand_wield = nil
end
def weapon_slots=(array) #change slots of weapons
if array == nil then array = WEAPON_KINDS end #use default slots
weapon_array = Array.new(self.weapon_ids) #save weapons
self.weapon_ids = nil
@weapon_slots = Array.new(array) #new slots
self.weapon_ids = weapon_array #reequip items
end
def armor_slots=(array) # change slots of armor
if array == nil then array = ARMOR_KINDS end #returns to default if nothing
armor_array = Array.new(self.armor_ids)
self.armor_ids = nil #remove items
@armor_slots = Array.new(array) #new array
self.armor_ids = armor_array
end #end def
def weapon_ids=(array) #be careful @item_type_force needs to be nil !
if array == nil then
self.equip(0, 0) #remove first weapon
for i in 1...self.weapon_ids.size
self.equip(i + [self.armor_slots.size,4].max, 0 ) #remove all weapons
end
return
end
for i in 0...self.weapon_slots.size
if array[i] == nil then array[i] = 0 end #ensure no nil are equiped
if i == 0 then #if first weapon
self.equip(0, array[i]) #equip weapon
else #if extra weapons
self.equip(i + [self.armor_slots.size, 4].max, array[i])
end
end
end
def armor_ids=(array)
if array == nil then
for i in 0...self.armor_slots.size
self.equip(i + 1, 0) #remove all armors
end
return
end
equipment_array = Array.new
for i in 0...array.size
if array[i] != nil and array[i] != 0
kind = $data_armors[array[i]].kind
if equipment_array[kind] == nil then
equipment_array[kind] = Array.new
end
equipment_array[kind].push(array[i])
#array in which 0 = array for shield, 1 = array for helmet,
#2 = array for armor and 3 = array for accessory, etc
end
end
self.armor_ids = nil #remove all armors
for i in 0...self.armor_slots.size
aitem = nil
if equipment_array[(self.armor_slots[i])-1] == nil then
equipment_array[(self.armor_slots[i])-1] = Array.new
end
while aitem == nil and equipment_array[(self.armor_slots[i])-1].size != 0
aitem = equipment_array[(self.armor_slots[i])-1].delete_at(0)
if aitem == 0 then aitem = nil end
end
if aitem != nil then
self.equip(i+ 1,aitem) #adds armor
end #end if iaitem != nil
end #end for i in
end
def armor_ids
#returns ids with all armor, also store 4 armor
unless self.is_a?(Game_Actor)
return []
end
if @armor_ids == nil then @armor_ids = Array.new(self.armor_slots.size) end

ids = @armor_ids
ids[0] = @armor1_id
ids[1] = @armor2_id
ids[2] = @armor3_id
ids[3] = @armor4_id
for i in 0...self.armor_slots.size #ensure no nil values are returned
if ids[i] == nil then ids[i] = 0 end
end
return ids
end
def weapon_ids
#returns ids with all weapon, also store first weapon
unless self.is_a?(Game_Actor)
return []
end
if @weapon_ids == nil then @weapon_ids = Array.new(self.weapon_slots.size) end
ids = @weapon_ids
ids[0] = @weapon_id
for i in 0...self.weapon_slots.size
if ids[i] == nil then ids[i] = 0 end
end
return ids
end
def weapon_shield_share
if @weapon_shield_share == nil then @weapon_shield_share = WEAPON_SHIELD_SHARE end
return @weapon_shield_share
end
def weapon_slots #return set slots or default slots
return @weapon_slots != nil ? @weapon_slots : WEAPON_KINDS
end
def armor_slots
return @armor_slots != nil ? @armor_slots : ARMOR_KINDS
end
def shield_hand_wield
return @shield_hand_wield != nil ? @shield_hand_wield : SHIELD_HAND_WIELD
end
def weapon_hand_wield
return @weapon_hand_wield != nil ? @weapon_hand_wield : WEAPON_HAND_WIELD
end
def shield_hand_slot
return @shield_hand_slot != nil ? @shield_hand_slot : SHIELD_HAND_SLOT
end
def armor_slot_names #return custom words for slots, or default ones
if @armor_slot_names == nil then @armor_slot_names = Array.new end
temp_array = Array.new(@armor_slot_names)
default_names = [$data_system.words.armor1,$data_system.words.armor2,$data_system.words.armor3,$data_system.words.armor4, self.extra_slot_names].flatten #default names of slots
for i in 0...default_names.size
if temp_array[i] == nil then temp_array[i] = default_names[i] end #if not
#custom then set as default
if temp_array[i] == nil then temp_array[i] = $data_system.words.armor4 end
end
return temp_array
end
def weapon_slot_names #return custom words for weapon slots, of default ones
if @weapon_slot_names != nil then
temp_array = Array.new(@weapon_slot_names) #use the custom values
else
temp_array = Array.new(self.weapon_slots.size) #use default values
end
default_names = WEAPON_KIND_NAMES #default names of slots
for i in 0...self.weapon_slots.size
if temp_array[i] == nil then temp_array[i] = default_names[i] end #set as constant
if temp_array[i] == nil then temp_array[i] = $data_system.words.weapon end
#if constant array is empty then use default one
end
return temp_array
end
def extra_slot_names
return @extra_slot_names != nil ? @extra_slot_names : EXTRA_SLOT_NAMES
end
def weapon_shield_share=(bool)
@weapon_shield_share = bool
end
def shield_hand_slot=(int)
@shield_hand_slot = int
end
def shield_hand_wield=(bool)
@shield_hand_wield = bool
end
def weapon_hand_wield=(bool)
@weapon_hand_wield = bool
end
def shield_name=(text) #set shield slot name with $game_actors[numberofactor].shield_name = 'Yourname'
@armor_slot_names[0] = text
end
def helmet_name=(text)
@armor_slot_names[1] = text
end
def armor_name=(text)
@armor_slot_names[2] = text
end
def accessory_name=(text)
@armor_slot_names[3] = text
end
def extra_slot_names=(array)
@extra_slot_names = array
end
def armor_slot_names=(array) #set a new array of names.
@armor_slot_names = array
end
def weapon_slot_names=(array) #set a new array of weapon names.
@weapon_slot_names = array
end
def guard_element_set
#return array with guard_element_set of all equipped armor
set = []
for id in self.armor_ids #seach all armor equipped
next if id.nil?
armor = $data_armors[id]
set += (armor != nil ? armor.guard_element_set : []) #add the element to set
end
return set
end
def equipments
#return array with all equipment
equipments = []
self.weapon_ids.each {|id| equipments.push($data_weapons[id])}
self.armor_ids.each {|id| equipments.push($data_armors[id])}
return equipments
end
def equiped?(item)
#return if item is equipped, works with both armor and weapon
case item
when RPG::Weapon
return self.weapon_ids.include?(item.id)
when RPG::Armor
return self.armor_ids.include?(item.id)
else
return false
end
end
def attack_count #returns number of attacks already made
@attack_count = 0 if @attack_count == nil
return @attack_count
end
def attack_count=(value) #set number of attacks already made
@attack_count = value
end
def attacks #this return an array with the list of all attacks of a character
#this takes in consideration extra weapon + number of attacks of
#each weapon
attacks = Array.new
for i in 0...self.weapon_ids.size

weapon = $data_weapons[self.weapon_ids[i]]
if weapon != nil and weapon.atk != 0 then #if weapon is valid
for counter in 0...weapon.number_attacks
attacks.push(i) #add attacks
end
end
end
if attacks.size == 0 then attacks[0] = 0 end #give 1 unarmed attack if no weapons on
return Array.new(attacks)
end #end number_attacks
def get_weapon_data
#this returns the weapon to use for the attack.
weaponid = self.weapon_ids[self.attacks[self.attack_count]]
weapon = $data_weapons[weaponid]
return weapon
end
def animation1_id #set animation for current weapon
weapon = self.get_weapon_data
return weapon != nil ? weapon.animation1_id : 0
end
def animation2_id #set animation for current weapon
weapon = self.get_weapon_data
return weapon != nil ? weapon.animation2_id : 0
end
def base_atk
if $game_temp.in_battle #if in battle, only use one weapon's attack power
weapon = self.get_weapon_data
return weapon != nil ? weapon.atk : 0
else #if in status screen, show cumulative attack power of all weapons
n = 0
for i in 0...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.atk : 0
end
return n
end
end
def element_set #return elemental set of the current weapon
weapon = self.get_weapon_data
return weapon != nil ? weapon.element_set : []
end
def plus_state_set #status the weapon can give
weapon = self.get_weapon_data
return weapon != nil ? weapon.plus_state_set : []
end
def minus_state_set #status the weapon can remove
weapon = self.get_weapon_data
return weapon != nil ? weapon.minus_state_set : []
end
def state_guard?(state_id)
for i in self.armor_ids
armor = $data_armors[i]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
end
return false
end
#--------------------------------------------------------------------------
# Remove element MULTI_ATTACK_ELEMENT from calculations
#--------------------------------------------------------------------------
alias g7_ms_game_actor_elements_correct elements_correct
def elements_correct(element_set)
#method remove element property that gives many attacks from weakness calculation
 elements = element_set.clone
for elementnb in elements #search element that could add more attacks
elementname = $data_system.elements[elementnb].downcase
if elementname[0,MULTI_ATTACK_ELEMENT.size] == MULTI_ATTACK_ELEMENT.downcase #if weapons has element for another attack
elements.delete(elementnb) #dont consider it in the formula for damage
end
if elementname[-1* MULTI_ATTACK_ELEMENT.size, MULTI_ATTACK_ELEMENT.size] == MULTI_ATTACK_ELEMENT.downcase #if weapons has element for another attack
elements.delete(elementnb) #dont consider it in the formula for damage
end
end
return g7_ms_game_actor_elements_correct(elements) #return result from formula
end #end def elements_correct
#==============================================================================
# Methods calculate bonus of extra weapon and armor
#==============================================================================
alias g7_ms_game_actor_element_rate element_rate
def element_rate(element_id)
result = g7_ms_game_actor_element_rate(element_id)
if self.armor_slots.size > 4
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
end
return result
end

alias g7_ms_game_actor_base_str base_str
def base_str
n = g7_ms_game_actor_base_str
for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.str_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.str_plus : 0
end
return n
end

alias g7_ms_game_actor_base_dex base_dex
def base_dex
n = g7_ms_game_actor_base_dex
for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.dex_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.dex_plus : 0
end
return n
end

alias g7_ms_game_actor_base_agi base_agi
def base_agi
n = g7_ms_game_actor_base_agi
for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.agi_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.agi_plus : 0
end
return n
end

alias g7_ms_game_actor_base_int base_int
def base_int
n = g7_ms_game_actor_base_int
for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.int_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.int_plus : 0
end
return n
end

alias g7_ms_game_actor_base_pdef base_pdef
def base_pdef
n = g7_ms_game_actor_base_pdef
for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.pdef : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.pdef : 0
end
return n
end

alias g7_ms_game_actor_base_mdef base_mdef
def base_mdef
n = g7_ms_game_actor_base_mdef
for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.mdef : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.mdef : 0
end
return n
end

alias g7_ms_game_actor_base_eva base_eva
def base_eva
n = g7_ms_game_actor_base_eva
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.eva : 0
end
return n
end

end #end class game actor

class Scene_Equip
#==============================================================================
# Closes extra windows
#==============================================================================
alias g7_ms_scene_equip_main main
def main
@additional_initialize_done = false
g7_ms_scene_equip_main
for i in 5...@item_windows.size
@item_windows[i].dispose unless @item_windows[i].nil?
end
end
#==============================================================================
# Initialize the extra right windows
#==============================================================================
def g7_ms_scene_equip_additional_initialize
unless @additional_initialize_done
@item_windows = []
@item_windows[0] = @item_window1 #weapon
@item_windows[1] = @item_window2 #shield
@item_windows[2] = @item_window3 #helmet
@item_windows[3] = @item_window4 #armor
@item_windows[4] = @item_window5 #acc
nb_old_windows = @item_windows.size
for i in [email=nb_old_windows...@actor.armor]nb_old_windows...@actor.armor[/email]_slots.max+1
@item_windows.push(Window_EquipItem.new(@actor, i) ) #add the remaining
#windows for extra slots
@item_windows[i].help_window = @help_window
end

if G7_MS_MOD::WINDOWS_STRETCH #if windows_stretch is true, stretch window
h = (@actor.weapon_slots.size + @actor.armor_slots.size + 1) * 32
h2 = (G7_MS_MOD::MAX_SHOW_SLOTS+1) * 32
h = [h, h2].min
@right_window.height = h
if @right_window.index > @actor.weapon_slots.size + @actor.armor_slots.size - 1
@right_window.index = @actor.weapon_slots.size + @actor.armor_slots.size - 1
end

if @left_window.y + @left_window.height == 256

@left_window.height = @right_window.height
elsif G7_MS_MOD::HELP_AT_BOTTOM == true and @left_window.height == 416 then
@left_window.height -= 64 #make left window shorter
end
y_pos = (@right_window.y + @right_window.height)
y_space = 480 - y_pos

#if help at bottom, reduce bottom item window size
if G7_MS_MOD::HELP_AT_BOTTOM == true then y_space -= 64 end

for item_window in @item_windows
next if item_window.nil?
item_window.y = y_pos
item_window.height = y_space
end
end

@additional_initialize_done = true
end
end
alias g7_ms_scene_equip_refresh refresh
#==============================================================================
# Refresh and make visible the correct right window
#==============================================================================
def refresh
#this part is used to refresh the equipped item at the right window
g7_ms_scene_equip_additional_initialize
@actor.translucent_texts.fill(false)

@actor.equip_type_force = index_to_equip_part(@right_window.index)
@right_window.item_fix_on
@right_window.scroll_fix_on
save = @right_window.index

@right_window.index = index_to_equip_kind(@right_window.index)
for i in 1...@item_windows.size
@item_windows[i].visible = i == @right_window.index
end
@item_window = @item_windows[@right_window.index]
@actor.equip_mode = 'STORE' #ensure current equipment will get properly stored
# and reequiped

@actor.equip_from_menu = true
g7_ms_scene_equip_refresh

@actor.equip_from_menu = false
@actor.equip_mode = nil
@actor.equip_type_force = nil

@right_window.index = save

@right_window.scroll_fix_off
@right_window.item_fix_off

if @item_window.index != @old_index
@right_window.refresh
end
@old_index = @item_window.index
end
#==============================================================================
# Convert the right_window.index to equip_type
#==============================================================================
alias g7_ms_scene_equip_update_item update_item
def update_item #this changes the @right_window.index to the correct value
#to take account of extra slots

@actor.equip_type_force = index_to_equip_part(@right_window.index)

@right_window.item_fix_on
@right_window.scroll_fix_on
save = @right_window.index
@right_window.index = index_to_equip_kind(@right_window.index)

#equip item
@actor.equip_from_menu = true
g7_ms_scene_equip_update_item
@actor.equip_from_menu = false

@actor.equip_type_force = nil

#if shield-weapon can modify each other, and if not in item_window screen
if @actor.shield_hand_wield == true and @item_window.index == -1
if @right_window.index == @actor.shield_hand_slot then
@item_windows[0].refresh #refresh weapons
elsif @right_window.index == 0
@item_windows[@actor.shield_hand_slot].refresh #refresh shield slot
end
end
@right_window.index = save
@right_window.scroll_fix_off
@right_window.item_fix_off
@actor.equip_type_force = nil
end
#==============================================================================
# Convert index to equip part
#==============================================================================
def index_to_equip_part(index)
#return index of slot in the array [0, @actor.armor_slots, actor.weapon_slots]
if index >= @actor.weapon_slots.size #if armor
return index - (@actor.weapon_slots.size - 1)

elsif index >= 1 #if extra weapon
return index + [@actor.armor_slots.size, 4].max #make it last
else
return 0
end
end
#==============================================================================
# Convert index to equip kind
#==============================================================================
def index_to_equip_kind(index)
#return index of slot in either actor.weapon_slots or actor.armor_slots
i = index_to_equip_part(index)

if index >= @actor.weapon_slots.size #if armor
set = @actor.armor_slots[i-1]
else #if weapon
i = i == 0 ? 0 : i - [@actor.armor_slots.size, 4].max
set = @actor.weapon_slots[i]
end
return set != nil ? set : 0
end
end #end scene_equip

class Window_Selectable < Window_Base
def scroll_fix_on
@scroll_fixed = true
end

def scroll_fix_off
@scroll_fixed = false
update_cursor_rect
end
#==============================================================================
# Prevents unwanted scrolling
#==============================================================================
alias g7_ms_update_cursor_rect update_cursor_rect
def update_cursor_rect
#This prevents the windows from scrolling if scroll is fixed
#This was added to ensure that if there are few slots, the right equip
#screen doesn't scroll needlessly
return if @scroll_fixed
g7_ms_update_cursor_rect
end
end
#==============================================================================
# Window_EquipRight
#==============================================================================
class Window_EquipRight < Window_Selectable
def item_fix_on
#fix window
@fixed_item = @data[self.index]
@fixed = true
end

def item_fix_off
#stop fixing window
@fixed_item = nil
@fixed = false
end
#==============================================================================
# Dont scroll right window if you press L or R
#==============================================================================
def update
if Input.repeat?(Input::R) or Input.repeat?(Input::L) then return else super end
end
#==============================================================================
# Draws equipped items with support of translucent and cursed items
#==============================================================================
def draw_item_name(item, x, y, translucent = false)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
if translucent
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 128)
self.contents.font.color = disabled_color
elsif item.is_a?(RPG::Weapon) && G7_MS_MOD::CURSED_WEAPONS.include?(item.id)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = G7_MS_MOD::CURSED_COLOR
elsif item.is_a?(RPG::Armor) && G7_MS_MOD::CURSED_ARMORS.include?(item.id)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = G7_MS_MOD::CURSED_COLOR
else
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
end

self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
alias g7_ms_window_equipright_item item
#==============================================================================
# Prevent needless update of item quantities in item window
#==============================================================================
def item
#this ensures that the number of items doesn't get updated if you move
#cursor in item window
return @fixed_item if @fixed
return g7_ms_window_equipright_item
end

#==============================================================================
# Change the height of right windows to fit the slots
#==============================================================================
alias g7_ms_window_equipright_initialize initialize
def initialize(actor) #init with a different height

g7_ms_window_equipright_initialize(actor)
h = (actor.weapon_slots.size + actor.armor_slots.size) * 32 #total height
#of right window
self.contents = Bitmap.new(width - 32, h) #change the height

refresh
end

#==============================================================================
# Shows the slot names and the name of the items you have equipped
#==============================================================================
def refresh #remplaced method to show caption of all items and slot
self.contents.clear
@data = []
#------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
self.contents.font.name = G7_MS_MOD::FONT_NAME
for i in [email=0...@actor.weapon]0...@actor.weapon[/email]_slots.size
@data.push($data_weapons[@actor.weapon_ids[i]]) #push name of weapon
end
for i in [email=0...@actor.armor]0...@actor.armor[/email]_slots.size
@data.push($data_armors[@actor.armor_ids[i]]) #push name of armor
end
@caption = []
for i in [email=0...@actor.weapon]0...@actor.weapon[/email]_slots.size
@caption.push(@actor.weapon_slot_names[i]) #push name of weapon slots

end
for i in [email=0...@actor.armor]0...@actor.armor[/email]_slots.size
@caption.push(@actor.armor_slot_names[@actor.armor_slots[i]-1]) #push name of armor slot
end
@item_max = @data.size
if @actor.translucent_texts == nil then @actor.translucent_texts = Array.new end

for i in [email=0...@data.size]0...@data.size[/email]
if @caption[i] != nil
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * i, 92, 32, @caption[i]) #draw name of slots
end
draw_item_name(@data[i], 92, 32 * i, @actor.translucent_texts[i]) #draw name of equipment
end
#support for other script
if defined? xrxs_additional_refresh
xrxs_additional_refresh
end
#------------------------------------------------------------------------------
# End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
end
end

class Scene_Battle
#==============================================================================
# Go to phase4 step2 for attack if attack_count < attacks.size
#==============================================================================

alias g7_ms_scene_battle_phase4_step6 update_phase4_step6
def update_phase4_step6(battler=nil)
#This methods make the battler return to phase4 step2 if there
#an extra attack to be made

if battler== nil then #if no parameters
g7_ms_scene_battle_phase4_step6 #first do the appropriate action
parameters = false
if @active_battler.is_a?(Game_Enemy) then return end
else #if it requires the battler as a parameters
g7_ms_scene_battle_phase4_step6(battler)
parameters = true
if battler.is_a?(Game_Enemy) then return end
end

if parameters == true #check which value to use for battler
battler.attack_count += 1 #increase the number of attack made
if battler.attack_count == battler.attacks.size or battler.current_action.kind != 0 or battler.current_action.basic != 0 or judge == true#if all attacks are made
battler.attack_count = 0 #end of turn and return attack count to 0
else
if @action_battlers.include?(@active_battler) == false then @action_battlers.push(battler) end #add the battler again to the action
battler.phase = 2 #returns for extra attack
end
else
@active_battler.attack_count += 1 #increase the number of attack made
if @active_battler.attack_count == @active_battler.attacks.size or @active_battler.current_action.kind != 0 or @active_battler.current_action.basic != 0 or judge == true#if all attacks are made
@active_battler.attack_count = 0
else
@phase4_step = 2
end
end
end #end def
end #end class

class Interpreter
#==============================================================================
# *Conditional Branch to make it work when comparing extra itemps
#==============================================================================
alias g7_ms_interpreter_command_111 command_111
def command_111
result = false
broken = false
case @parameters[0]
when 4 # when Actor
actor = $game_actors[@parameters[1]]
if actor != nil
case @parameters[2]
when 3 # if weapon
for i in 0...actor.weapon_ids.size
result |= (actor.weapon_ids[i] == @parameters[3]) #compare
end
broken = true
when 4 # if armor
for i in 0...actor.armor_ids.size
result |= (actor.armor_ids[i] == @parameters[3]) #compare
end
broken = true
end
end
end

unless broken # if other conditional branch
g7_ms_interpreter_command_111 #do the normal condition
return
end
@branch[@list[@index].indent] = result
if @branch[@list[@index].indent] == true
@branch.delete(@list[@index].indent)
return true
end
return command_skip
end
end
#==============================================================================
# Shows a new status window if Status_window_arrange is true
#==============================================================================
if G7_MS_MOD::STATUS_WINDOW_ARRANGE
class Window_Status < Window_Base
def refresh
#------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
self.contents.font.name = G7_MS_MOD::FONT_NAME
#------------------------------------------------------------------------------
# End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
self.contents.clear
draw_actor_graphic(@actor, 40, 112)
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 4 + 144, 0)
draw_actor_level(@actor, 96, 32)
draw_actor_state(@actor, 96, 64)
draw_actor_hp(@actor, 96, 112, 172)
draw_actor_sp(@actor, 96, 144, 172)
draw_actor_parameter(@actor, 96, 192, 0)
draw_actor_parameter(@actor, 96, 224, 1)
draw_actor_parameter(@actor, 96, 256, 2)
draw_actor_parameter(@actor, 96, 304, 3)
draw_actor_parameter(@actor, 96, 336, 4)
draw_actor_parameter(@actor, 96, 368, 5)
draw_actor_parameter(@actor, 96, 400, 6)
#------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
if G7_MS_MOD::EVADE
draw_actor_parameter(@actor, 96, 432, 7) # activate if you have a draw_actor_paramter method that draw evade
end
self.contents.font.color = system_color
self.contents.draw_text(320, 16, 80, 32, 'EXP')
self.contents.draw_text(320, 48, 80, 32, 'NEXT')
self.contents.font.color = normal_color
self.contents.draw_text(320 + 80, 16, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(320 + 80, 48, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 80, 96, 32, 'Equipment')
for i in [email=0...@actor.weapon]0...@actor.weapon[/email]_slots.size
draw_item_name($data_weapons[@actor.weapon_ids[i]], 320 + 16, 80 + 24 * (i+1))
end
for i in [email=0...@actor.armor]0...@actor.armor[/email]_slots.size
draw_item_name($data_armors[@actor.armor_ids[i]], 320 + 16, 200 + 24 * (i - 4 + @actor.weapon_slots.size))
end
#------------------------------------------------------------------------------
# End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
end
end
end #end of script

It crashes at completely random times. Not any any specific time. The error is stack level too deep... Does anybody know what is wrong with it?
 
G777 released a later version that fixed most of that. It was on RMXP.net, but since that's gone, I'll try reposting it here:

Code:
#==============================================================================
# Multi-slot equipment script
#------------------------------------------------------------------------------
# Guillaume777
# 6.0
# 2006/01/27
#==============================================================================
#To change slots of character
#     $game_actors[1].weapon_slots = [0,0] 
#     $game_actors[1].armor_slots = [2,3,4,5,6,7]
#
#To make armor equipable in new slot :
#     Add (5) in its name, where 5 is its slot number
#To make 2handed weapons :
#     Add an element called 2handed to a weapon 
#     or, adds its id in TWO_HANDED_WEAPONS = []
#     or, adds (2handed) in its name
#To make a weapon double attack
#     Add an element called 2attacks to a weapon
#     or, adds its id in DOUBLE_ATTACK_WEAPONS = []
#     or, adds (2atks) in its name
#To make a weapon/armor cursed
#     Adds its id in CURSED_WEAPONS or CURSED_ARMORS, or
#     put (cursed) in its name
#To make a weapon require an offhand instead of any weapon
#     Adds its id in NEEDS_OFFHAND or
#     Adds (needs_offhand) in its name
module G7_MS_MOD #you set the default names,slots, etc here
  
 #========Set weapon/armor properties ==========================================
 CURSED_WEAPONS = [] #ids of weapons to be cursed
 CURSED_ARMORS = []  #ids of armors to be cursed
 
 TWO_HANDED_WEAPONS = [] #ids of 2handed weapons
 DOUBLE_ATTACK_WEAPONS = [] #ids of double attack weapons
 NEEDS_OFFHAND = []
 
 SWITCH_EQUIP_WEAPONS = [[], []] 
 SWITCH_EQUIP_ARMORS = [[], []]
 # use 1 array, first value of array = false item, second value = true item
 
 #=========Set weapon/armor properties with element tagging and name edit=======
 CURSED_STRING = 'cursed' # put (cursed) in item name for it to be cursed
 HANDS_ELEMENT = 'handed'  #nb of hands in front of HANDS_ELEMENT in the database
 HANDS_STRING = 'handed' # name of string in item name like (2handed)
 
 MULTI_ATTACK_ELEMENT = 'attacks' #name of element to tag to multi attacks like
                                  #  (2attacks)
 MULTI_ATTACK_STRING = 'atks' #string in item name, like (3atks)

 NEEDS_OFFHAND_STRING = 'needs_offhand' #string in item name if the weapon
                                        #needs an offhand like (needs_offhand)
 #=====Set character slots properties ==========================================
 WEAPON_KINDS = [0] #number of weapons,  0 = weapon
 WEAPON_KIND_NAMES = ['Weapon'] #custom name of extra weapon slots, 
 WEAPON_KIND_POWERS = [100] # 100 = normal power, 90 = 90% power, etc
 #leave empty or put nil inside if you want default name
ARMOR_KINDS = [1,3,2,4]
# 1 = shield
# 2 = helmet
# 3 = armor
# 4 = acc
# 5 = and more : extra slot
EXTRA_SLOT_NAMES = ['Accessory']
#Name of the extra slots in equip window
#You need as many words as there are '5' or more in armor_kinds
#The first order of the slots names reflect the order of the 5 in armor_kinds
#Put (5) or more to in the armor name to have it assigned to the extra slot 

 #=============Set multi-weapon behavior=======================================
 IGNORE_OFFHAND = false #ignore off_hand support 
 TWOHANDED_IN_OFFHAND = true #if false don't show two handed weapon in offhand
                                 #window
 ALL_WEAPONS_FOR_SKILLS = true #true = combined power of all weapons for skills 
                               #false = only power of first weapon
 SHIELD_HAND_SLOT = 1 #slot number to be used for shield hand
 WEAPON_SHIELD_SHARE = false #if true, dont use shield and second weap at same time
 SHIELD_HAND_WIELD = true#true = allow to use shield hand for two handed weapon
 WEAPON_HAND_WIELD = true #true = allow to use weapon hand for two handed weapon
 MULTI_WEAPONS_PENALITY = 0 #percent of atk
                            #that will be substracted if you use two weap
 #============Set appearance properties ======================================== 
 FONT_NAME = 'Verdana' #font to use
 CURSED_COLOR = Color.new(255, 50, 50) #color of cursed equiped items
 SHOW_REMOVE = false #show empty in offhand window
 
 WINDOWS_STRETCH = true #true : equip_right stretch to adjust to nb of slots
 MAX_SHOW_SLOTS = 6 #maximum number of slots in 1 screen in equip right window
 #Useless if windows_stretch = false
 HELP_AT_BOTTOM = false #if true : will leave place for help window at bottom
                       #useless if you didn't mofidy the help window y coordinate

 STATUS_WINDOW_ARRANGE = false #if true : you get a new status window.
 EVADE = false # if draw_actor_parameter is configured to receive parameter 7 
 #( evade ), then it will show in new status window
 # EVADE = true has no effect if STATUS_WINDOW_ARRANGE is false
 #================ end of settings =============================================
 def initialize
super
RPG.set_new_item_types #fix armor and weapon properties at start of game
end
end #end module

module RPG
def RPG.set_new_item_types
if @initialized_item_types then return end
for armor in $data_armors #for each armor
unless armor == nil #if armor
armor.set_adv_type #set new type
armor.set_cursed #set if item is cursed or not
end
end
for weapon in $data_weapons #for each armor
unless weapon == nil #if armor
weapon.set_needs_offhand #set if it needs an offhand or not
weapon.set_nb_hands #set the number of hands to wield it
weapon.set_nb_attacks #set the number of attacks it can do
weapon.set_cursed #set if item is cursed or not
end
end
@initialized_item_types = true
end
def RPG.initialized_item_types=(bool)
@initialized_item_types = bool
end
#--------------------------------------------------------------------------
# New armor type = number in name of armor
#--------------------------------------------------------------------------
class Armor
attr_accessor :cursed
def set_adv_type
pattern = /\((\d+)\)/
if @name.sub!(pattern, '') != nil
@kind = $1.to_i - 1 #set kind to number in name of armor
end
end
def set_cursed
pattern = '('+G7_MS_MOD::CURSED_STRING+')'
if @name.sub!(pattern, '') != nil then cursed = true end
if G7_MS_MOD::CURSED_ARMORS.include?(@id) then cursed = true end
@cursed = cursed
end
end #end armor

class Weapon
attr_accessor :needs_offhand #does it need an offhand weapon
attr_accessor :nb_hands #numbers of hands it requires
attr_accessor :nb_attacks #number of attacks it can do
attr_accessor :cursed #true if item is cursed
def set_cursed
pattern = '('+G7_MS_MOD::CURSED_STRING+')'
if @name.sub!(pattern, '') != nil then cursed = true end
if G7_MS_MOD::CURSED_WEAPONS.include?(@id) then cursed = true end
@cursed = cursed
end
def set_needs_offhand
pattern = '('+G7_MS_MOD::NEEDS_OFFHAND_STRING+')'
if @name.sub!(pattern, '') != nil then
@needs_offhand = true
elsif G7_MS_MOD::NEEDS_OFFHAND.include?(self.id) then
@needs_offhand = true
elsif @needs_offhand== nil then
@needs_offhand = false
end
end
#--------------------------------------------------------------------------
# Returns number of hands needed for weapons
#--------------------------------------------------------------------------
def set_nb_hands
if G7_MS_MOD::TWO_HANDED_WEAPONS.include?(self.id) then
nb_hands = 2
end
pattern = /\((\d+)#{G7_MS_MOD::HANDS_STRING}\)/
if @name.sub!(pattern, '') != nil
nb_hands = $1.downcase.delete('a-z')
nb_hands = $1.to_i
end
for elementnb in self.element_set #search element
elementname = $data_system.elements[elementnb].downcase
if elementname.delete('0-9') == G7_MS_MOD::HANDS_ELEMENT.downcase #if weapons has element for another attack
elementname = elementname.delete('a-z') #get the nb of attacks
if elementname != '' then
nb_hands = elementname.to_i
end
end
end
if nb_hands.is_a?(Integer) == false or nb_hands <= 0 then nb_hands = 1 end
@nb_hands = nb_hands
end #end nb_hands

#--------------------------------------------------------------------------
# Returns the number of attack the weapon can do
#--------------------------------------------------------------------------
def set_nb_attacks
if G7_MS_MOD::DOUBLE_ATTACK_WEAPONS.include?(self.id) then
nb_attacks = 2
else
nb_attacks = 1
end

pattern = /\((\d+)#{G7_MS_MOD::MULTI_ATTACK_STRING}\)/
if @name.sub!(pattern, '') != nil
nb_attacks = $1.downcase.delete('a-z')
nb_attacks = $1.to_i
end

for elementnb in self.element_set #search element that could
#add more attacks
elementname = $data_system.elements[elementnb].downcase
if elementname.delete('0-9') == G7_MS_MOD::MULTI_ATTACK_ELEMENT.downcase #if weapons has element for another attack
elementname = elementname.delete('a-z') #get the nb of attacks
if elementname != '' then
nb_attacks = elementname.to_i
end
end
end
if nb_attacks.is_a?(Integer) == false or nb_attacks <= 0 then nb_attacks = 1 end
@nb_attacks = nb_attacks
end #end nb_attack
end #end weapon
end #end module

Code:
class Game_Actor < Game_Battler
include G7_MS_MOD
attr_accessor :equip_mode #used to restore equipment after false equip
attr_accessor :equip_type_force #used to bypass equip_type
attr_accessor :equip_from_menu #used to prevent the user to unequip cursed items
attr_accessor :translucent_texts #used to store translucents slots
#--------------------------------------------------------------------------
# Init the new slots
#--------------------------------------------------------------------------
alias g7_ms_game_actor_setup setup
def setup(actor_id)
g7_ms_game_actor_setup(actor_id) #setup normaly
self.order_armor_ids
end

def nb_offhand_required(ignore=nil)
nb_offhand = 0
nb_need_offhand = 0
for i in 0...self.weapon_slots.size
if i != ignore then
weapon = self.weapon_ids[i]
if weapon == 0 then
nb_offhand += 1
elsif $data_weapons[weapon].needs_offhand then
nb_need_offhand += 1
else
nb_offhand += 1
end
end
end
return (nb_need_offhand - nb_offhand)
end
#==============================================================================
# Modify how equipment is equiped so that extra items can be equipped
#==============================================================================
alias g7_ms_game_actor_equip equip
def equip(equip_type, id)

if @equip_type_force != nil then equip_type = @equip_type_force end
#equip_type_force is used to bypass the
#equip_type argument

if self.equip_mode == 'STORE' then
#store equipment for it to be restored after checking what the stats would
self.equip_mode = nil
@stored_armors = self.armor_ids.dup
@stored_weapons = self.weapon_ids.dup
saved_mode = 'STORE'
elsif self.equip_mode == 'RESTORE'
#restore equipment after preview of new equipment on stats
self.equip_mode = nil
self.restore(equip_type)
return
else #if equipping for real
if self.enough_hands?(equip_type,id) != false then
id = self.switch_items(equip_type,id) #switch item to be equiped to
#fool players
end
end


if self.enough_hands?(equip_type,id) == false then #if not enough hands
id = 0 #then don't equip
elsif self.equip_from_menu and self.cursed?(equip_type) then
id = 0 #if cursed and player tried to remove it, do nothing
elsif equip_type <= 4 #if the slot is one of the 5 basic one
g7_ms_game_actor_equip(equip_type, id) #equip the good old way
else
equip_extra(equip_type,id) #equip in the new way
end

#fix in case there are no enough empty hands for all the equipped weapons
if id != 0 then self.fix_handed_weapons(equip_type) end

#this ensure that the next equiping will restore the original equipment
if saved_mode == 'STORE' then self.equip_mode = 'RESTORE' end

end

#==============================================================================
# Restore equipment once the stats got checked and adds translucent
#==============================================================================
def restore(equip_type)
if self.translucent_texts == nil then self.translucent_texts = Array.new end
self.equip_from_menu = false

if equip_type != 0 and @stored_weapons[0] != self.weapon_ids[0]
self.translucent_texts[0] = true
end
for i in 1...@stored_weapons.size
if i+[self.armor_slots.size,4].max != equip_type and
@stored_weapons[i] != self.weapon_ids[i] then
self.translucent_texts[i] = true
end
end
for i in 0...@stored_armors.size
if i+1 != equip_type and
@stored_armors[i] != self.armor_ids[i] then

self.translucent_texts[self.weapon_slots.size + i] = true
end
end
@equip_type_force = nil
copy = self.translucent_texts.dup

self.weapon_ids = @stored_weapons

self.armor_ids = @stored_armors

self.translucent_texts = copy
end

#==============================================================================
# Switch the id of an item to be equiped with another id to trick player
#==============================================================================
def switch_items(equip_type,id)

if self.cursed?(equip_type) == false then

if equip_type == 0 or equip_type > [self.armor_slots.size,4].max
for i in 0...SWITCH_EQUIP_WEAPONS.size
if SWITCH_EQUIP_WEAPONS[i][0] == id then
$game_party.lose_weapon(SWITCH_EQUIP_WEAPONS[i][0], 1)
$game_party.gain_weapon(SWITCH_EQUIP_WEAPONS[i][1], 1)
id = SWITCH_EQUIP_WEAPONS[i][1]
end
end

else
for i in 0...SWITCH_EQUIP_ARMORS.size
if SWITCH_EQUIP_ARMORS[i][0] == id then
$game_party.lose_armor(SWITCH_EQUIP_ARMORS[i][0], 1)
$game_party.gain_armor(SWITCH_EQUIP_ARMORS[i][1], 1)
id = SWITCH_EQUIP_ARMORS[i][1]
end
end

end
end
return id
end

#==============================================================================
# Returns if there are enough hands to hold weapon
#==============================================================================
def enough_hands?(equip_type, id)
if id == 0 then return true end # enough hand = true if you remove something

if equip_type == 0 or equip_type > [self.armor_slots.size ,4].max #if weapon
nb = $data_weapons[id].nb_hands
elsif self.weapon_shield_share and self.armor_slots[equip_type-1] == self.shield_hand_slot
nb = 1
else
return true #return true if not shield or weapon
end

nb_s = 0 #nb shield slots

if self.shield_hand_wield then
for i in 0...self.armor_slots.size
if self.armor_slots[i] == self.shield_hand_slot
if self.weapon_shield_share == false then nb_s += 1 end
if self.cursed?(i+1) then nb += 1 end
end
end
end

if self.weapon_hand_wield
if self.cursed?(0) then #penalities if can't remove first weapon
nb = nb + $data_weapons[self.weapon_ids[0]].nb_hands
end

for i in 1...self.weapon_slots.size #penalities if cant remove weapon
if self.cursed?(self.armor_slots.size + i)
nb = nb + $data_weapons[self.weapon_ids[i]].nb_hands
end
end
end

if nb == 1 then #if it only takes 1 hand to hold
return true
elsif nb > nb_s+1 and self.weapon_hand_wield == false
return false
elsif nb > self.weapon_slots.size+ nb_s and self.weapon_hand_wield
return false
elsif self.shield_hand_wield == false and self.weapon_hand_wield == false
return false
else
return true
end
end

def equip_weapon(index,id)
if index == 0 then
self.equip(0, id)
else
self.equip([self.armor_slots.size, 4].max + index, id)
end
end

def equip_armor(index, id)
self.equip(index+1, id)
end
#==============================================================================
# Equip extra items
#==============================================================================
def equip_extra(equip_type,id)
if equip_type <= [self.armor_slots.size,4].max # if its extra armor slot
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[self.armor_ids[equip_type-1]], $data_armors[id])
$game_party.gain_armor(self.armor_ids[equip_type-1], 1)
self.armor_ids[equip_type-1] = id
$game_party.lose_armor(id, 1)
end
else #if its weapon slot
if id == 0 or $game_party.weapon_number(id) > 0
equip_type = equip_type - [self.armor_slots.size, 4].max

weapon = self.weapon_ids[equip_type]
if weapon != nil then
$game_party.gain_weapon(weapon, 1)
end
self.weapon_ids[equip_type] = id
$game_party.lose_weapon(id, 1)
end
end
end


#==============================================================================
# This fix multi handed weapons
#==============================================================================
def fix_handed_weapons(equip_keep=nil) #parameter for weapon to keep

array_wield_hands = Array.new #stores slot of weapon that need empty hands
nb_emp_hands = 0 #store nb of empty hands
penalities = 0 #stores extra hand required

save_force = @equip_type_force
save_menu = @equip_from_menu
@equip_from_menu = false
@equip_type_force = nil

if self.shield_hand_wield
for narmor in 0...self.armor_slots.size
if self.armor_slots[narmor] == self.shield_hand_slot
if self.weapon_shield_share == true then
penalities += 1
end
if self.armor_ids[narmor] == 0 then
nb_emp_hands += 1 #stores empty shield hand
end
end
end
end
for nweapon in 0...self.weapon_slots.size
if self.weapon_ids[nweapon] == 0
if self.weapon_hand_wield then
nb_emp_hands += 1
end
else
array_wield_hands.push(nweapon) #stores the hand to wield weapon
end
end

for nweapon in Rg(array_wield_hands.size-1, 0, -1)
if self.weapon_ids[array_wield_hands[nweapon]] != 0 then
nb_hands = $data_weapons[self.weapon_ids[array_wield_hands[nweapon]]].nb_hands
nb_hands += penalities
penalities = 0
save_hands = nb_hands
end

while nb_emp_hands != 0 and nb_hands > 1
#if it finds empty hand
nb_hands += -1 #decrease counter
nb_emp_hands += -1
end

#if shield needs to be removed for empty hand
if self.shield_hand_wield then
for namor in 0...self.armor_slots.size
if nb_hands > 1 and self.armor_ids[namor] != 0 and
self.armor_slots[namor] == self.shield_hand_slot and
namor+1 != equip_keep and self.cursed?(namor+1) == false then
nb_hands += -1
self.equip(namor+1,0)
end
end
end

#if it must remove weapons to make room for empty hands
if self.weapon_hand_wield == true then
for nhand in Rg(self.weapon_slots.size-1, 0, -1)
if nb_hands > 1 and self.weapon_ids[nhand] != 0
if nhand == 0 then
if equip_keep != 0 and self.cursed?(0) == false then
n = nb_emp_hands
nb_emp_hands += $data_weapons[self.weapon_ids[nhand]].nb_hands
n = nb_emp_hands - n

self.equip(0,0)
end
else
if nhand+[self.armor_slots.size,4].max != equip_keep and
self.cursed?(nhand+[self.armor_slots.size,4].max) == false
then

if nhand < array_wield_hands[nweapon] then
nb_emp_hands += 1
else
nb_emp_hands += $data_weapons[self.weapon_ids[nhand]].nb_hands
end
self.equip([self.armor_slots.size,4].max+nhand, 0)
end
end #end if nhnad ==0
end #end if nb_hands != 1
while nb_emp_hands != 0 and nb_hands > 1
#if it finds empty hand
nb_hands += -1 #decrease counter
nb_emp_hands += -1
end
end #end for nahand
end #end if self.weapon


if nb_hands > 1 #if still can't find a slot, remove the weapon

if array_wield_hands[nweapon] == 0 and self.cursed?(0) == false then
nb_emp_hands = 1 + nb_emp_hands + save_hands - nb_hands
self.equip(0, 0)
elsif self.cursed?(array_wield_hands[nweapon]+[self.armor_slots.size,4].max) == false and
array_wield_hands[nweapon] != 0 then

nb_emp_hands = 1 + nb_emp_hands + save_hands - nb_hands
self.equip(array_wield_hands[nweapon]+[self.armor_slots.size,4].max,0)
end
end
while nb_emp_hands != 0 and nb_hands > 1
#if it finds empty hand
nb_hands += -1 #decrease counter
nb_emp_hands += -1
end
if nb_hands > 1 then #if STILL not enough hands
self.equip(equip_keep,0) # remove the item the user tried to equip
end
end #loop


@equip_type_force = save_force #returns old equip_type_force
@equip_from_menu = save_menu #return old equip_from_menu
end

#==============================================================================
# Return true if there is a cursed item at that position
#==============================================================================
def cursed?(equip_type)
if equip_type == 0
weapon_id = self.weapon_ids[0]
if weapon_id != 0 and $data_weapons[weapon_id].cursed then return true end
elsif equip_type <= self.armor_slots.size #if armor
armor_id = self.armor_ids[equip_type - 1]
if armor_id != 0 and $data_armors[armor_id].cursed then return true end
else
weapon_id = self.weapon_ids[equip_type - [self.armor_slots.size, 4].max]
if weapon_id != nil and weapon_id != 0 and $data_weapons[weapon_id].cursed then return true end
end
return false
end

#==============================================================================
# Remove all cursed items
#==============================================================================
def remove_curse
self.equip_type_force = nil
for i in 0...(self.weapon_slots.size + self.armor_slots.size)
if self.cursed?(i) then self.equip(i,0) end
end
end

#--------------------------------------------------------------------------
# It orders armor_ids to fit slots
#--------------------------------------------------------------------------
def order_armor_ids
equipment_array = Array.new

for i in 0...self.armor_ids.size
if self.armor_ids[i] != nil and self.armor_ids[i] != 0
kind = $data_armors[self.armor_ids[i]].kind
if equipment_array[kind] == nil then
equipment_array[kind] = Array.new
end
equipment_array[kind].push(self.armor_ids[i])
#array in which 0 = array for shield, 1 = array for helmet,
#2 = array for armor and 3 = array for accessory, etc
end
end

self.armor_ids = nil #remove all armors
armors = Array.new
for i in 0...self.armor_slots.size
aitem = nil
if equipment_array[(self.armor_slots[i])-1] == nil then
equipment_array[(self.armor_slots[i])-1] = Array.new
end
while aitem == nil and equipment_array[(self.armor_slots[i])-1].size != 0
aitem = equipment_array[(self.armor_slots[i])-1].delete_at(0)
if aitem == 0 then aitem = nil end
end
if aitem != nil then
armors.push(aitem) #adds armor
else
armors.push(0) #adds empty
end #end if iaitem != nil
end #end for i in

self.armor_ids = armors
end

#==============================================================================
# Change weapon slots
#==============================================================================
def weapon_slots=(array) #change slots of weapons
if array == nil then array = WEAPON_KINDS end #use default slots
weapon_array = Array.new(self.weapon_ids) #save weapons
self.weapon_ids = nil
@weapon_slots = Array.new(array) #new slots
self.weapon_ids = weapon_array #reequip items

i = self.weapon_ids.size
while self.nb_offhand_required > 1
if self.weapon_ids[i] != nil and self.weapon_ids[i] != 0 then
self.equip_weapon(i,0)
end
i = i-1
end
end

#==============================================================================
# Change armor slots
#==============================================================================
def armor_slots=(array) # change slots of armor
if array == nil then array = ARMOR_KINDS end #returns to default if nothing
equipment_array = Array.new
for i in 0...[array.max, self.armor_slots.max].max+1
if equipment_array[i] == nil then
equipment_array[i] = Array.new
end
end

for i in 0...self.armor_ids.size
if self.armor_ids[i] != nil and self.armor_ids[i] != 0 then
kind = $data_armors[self.armor_ids[i]].kind + 1
equipment_array[kind].push(self.armor_ids[i])
#array in which 0 = array for shield, 1 = array for helmet,
#2 = array for armor and 3 = array for accessory, etc
end
end

for kind in 0...[array.max, self.armor_slots.max].max+1
if array.include?(kind) and self.armor_slots.include?(kind) then
nb_i_new = 0
nb_i_old = 0
for i in 0...self.armor_slots.size
if self.armor_slots[i] == kind then nb_i_old += 1 end
end
for i in 0...array.size
if array[i] == kind then nb_i_new += 1 end
end

for i in nb_i_new...nb_i_old
for k in 0...equipment_array[kind].size
index = equipment_array[kind].index(0)
if index != nil then
equipment_array[kind].delete_at(index)
end
end
end
end
end
self.armor_ids = nil #remove items
@armor_slots = array #new array
for i in 0...self.armor_slots.size
aitem = nil
kind = self.armor_slots[i]
if equipment_array[kind].size != 0
aitem = equipment_array[kind].delete_at(0)
self.equip(i+ 1,aitem) #adds armor
else
self.equip(i+ 1,0)
end
end
end #end def
#--------------------------------------------------------------------------
# Set new array of weapons, if nil then it removes all weapon
#--------------------------------------------------------------------------
def weapon_ids=(array) #be careful @item_type_force needs to be nil !
if array == nil then
self.equip(0, 0) #remove first weapon
for i in 1...self.weapon_ids.size
self.equip(i + [self.armor_slots.size,4].max, 0 ) #remove all weapons
end
return
end

self.weapon_ids = nil

for i in 0...self.weapon_slots.size
if array[i] == nil then array[i] = 0 end #ensure no nil are equiped
if i == 0 then #if first weapon
self.equip(0, array[i]) #equip weapon
else #if extra weapons
self.equip(i + [self.armor_slots.size, 4].max, array[i])
end
end
end
#--------------------------------------------------------------------------
# Set new array of armors in ordered fashion
#--------------------------------------------------------------------------
def armor_ids=(array)
if array == nil then
for i in 0...self.armor_slots.size
self.equip(i + 1, 0) #remove all armors
end
return
end
self.armor_ids = nil #remove all armors
for i in 0...self.armor_slots.size
self.equip(i+ 1, array[i]) #adds armor
end
end
#--------------------------------------------------------------------------
# Return @armor_ids
#--------------------------------------------------------------------------
def armor_ids
#returns ids with all armor, also store 4 armor
unless self.is_a?(Game_Actor)
return []
end
if @armor_ids == nil then @armor_ids = Array.new(self.armor_slots.size) end

ids = @armor_ids
ids[0] = @armor1_id
ids[1] = @armor2_id
ids[2] = @armor3_id
ids[3] = @armor4_id
for i in 0...self.armor_slots.size #ensure no nil values are returned
if ids[i] == nil then ids[i] = 0 end
end

return ids
end

def weapon_ids
#returns ids with all weapon, also store first weapon
unless self.is_a?(Game_Actor)
return []
end
if @weapon_ids == nil then @weapon_ids = Array.new(self.weapon_slots.size) end
ids = @weapon_ids
ids[0] = @weapon_id

for i in 0...self.weapon_slots.size
if ids[i] == nil then ids[i] = 0 end
end
return ids
end


#--------------------------------------------------------------------------
# Returns names of armor
#--------------------------------------------------------------------------
def armor_slot_names #return custom words for slots, or default ones
if @armor_slot_names == nil then @armor_slot_names = Array.new end
temp_array = Array.new(@armor_slot_names)
default_names = [$data_system.words.armor1,$data_system.words.armor2,$data_system.words.armor3,$data_system.words.armor4, self.extra_slot_names].flatten #default names of slots
for i in 0...default_names.size
if temp_array[i] == nil then temp_array[i] = default_names[i] end #if not
#custom then set as default
if temp_array[i] == nil then temp_array[i] = $data_system.words.armor4 end
end
return temp_array
end

#--------------------------------------------------------------------------
# Returns names of weapons
#--------------------------------------------------------------------------
def weapon_slot_names #return custom words for weapon slots, of default ones
if @weapon_slot_names != nil then
temp_array = Array.new(@weapon_slot_names) #use the custom values
else
temp_array = Array.new(self.weapon_slots.size) #use default values
end
default_names = WEAPON_KIND_NAMES #default names of slots
for i in 0...self.weapon_slots.size
if temp_array[i] == nil then temp_array[i] = default_names[i] end #set as constant
if temp_array[i] == nil then temp_array[i] = $data_system.words.weapon end
#if constant array is empty then use default one
end
return temp_array
end

#--------------------------------------------------------------------------
# Return all element of all equipped armor
#--------------------------------------------------------------------------
def guard_element_set
#return array with guard_element_set of all equipped armor
set = []
for id in self.armor_ids #seach all armor equipped
next if id.nil?
armor = $data_armors[id]
set += (armor != nil ? armor.guard_element_set : []) #add the element to set
end
return set
end

#--------------------------------------------------------------------------
# Return all equipment
#--------------------------------------------------------------------------
def equipments
#return array with all equipment
equipments = []
self.weapon_ids.each {|id| equipments.push($data_weapons[id])}
self.armor_ids.each {|id| equipments.push($data_armors[id])}
return equipments
end

#--------------------------------------------------------------------------
# Return if item is equiped
#--------------------------------------------------------------------------
def equiped?(item)
#return if item is equipped, works with both armor and weapon
case item
when RPG::Weapon
return self.weapon_ids.include?(item.id)
when RPG::Armor
return self.armor_ids.include?(item.id)
else
return false
end
end

#==============================================================================
# Return list of weapons to use for attacks
#==============================================================================
def attacks #this return an array with the list of all attacks of a character
#this takes in consideration extra weapon + number of attacks of
#each weapon
attacks = Array.new
for i in 0...self.weapon_ids.size
weapon = $data_weapons[self.weapon_ids[i]]
if weapon != nil and weapon.atk != 0 then #if weapon is valid
for counter in 0...weapon.nb_attacks
attacks.push(i) #add attacks
end
end

end

if attacks.size == 0 then attacks[0] = 0 end #give 1 unarmed attack if no weapons on
return Array.new(attacks)

end #end nb_attacks

#--------------------------------------------------------------------------
# Get the weapon to be used in attack
#--------------------------------------------------------------------------
def get_weapon_data
#this returns the weapon to use for the attack.
weaponid = self.weapon_ids[self.attacks[self.attack_count]]
weapon = $data_weapons[weaponid]
return weapon
end
def animation1_id #set animation for current weapon
weapon = self.get_weapon_data
return weapon != nil ? weapon.animation1_id : 0
end
def animation2_id #set animation for current weapon
weapon = self.get_weapon_data
return weapon != nil ? weapon.animation2_id : 0
end

#--------------------------------------------------------------------------
# Get the atk to be used in attack ( or shown in menu screen )
#--------------------------------------------------------------------------
def base_atk
multiplier = nil
if $game_temp.in_battle and (self.current_action.kind == 0 or self.all_weapons_for_skills? == false)
#if in battle and doing a normal attack only use one weapon's attack power
weapon = self.get_weapon_data
n = weapon != nil ? weapon.atk : 0
#multiplier of hand as definied in self.weapon_slot_powers
if weapon != nil and weapon.nb_hands == 1 then
multiplier = self.weapon_slot_powers[self.attacks[self.attack_count]]
end
if multiplier == nil then multiplier = 100 end
n = n * (multiplier/100.0)
else #use cumulative attack power of all weapons if in status screen or
#if using skill and all_weapons_for_skills == true
n = 0
for i in 0...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
atk = weapon != nil ? weapon.atk : 0
if weapon != nil and weapon.nb_hands == 1 then
multiplier = self.weapon_slot_powers[i]
else
multiplier = nil
end
if multiplier == nil then multiplier = 100 end

atk = atk * (multiplier/100.0)
n += atk
end
end
nb_weap = 0
for i in 0...self.weapon_slots.size
if self.weapon_ids[i] != nil and self.weapon_ids[i] != 0
nb_weap = nb_weap + 1
end
end #penality if more than 1 weapon
penality = self.multi_weapons_penality != nil ? self.multi_weapons_penality : 0
penality = penality /100.0
if nb_weap > 1 then n = n * ( 1 - penality ) end
return n
end

def element_set #return elemental set of the current weapon
weapon = self.get_weapon_data
return weapon != nil ? weapon.element_set : []
end
def plus_state_set #status the weapon can give
weapon = self.get_weapon_data
return weapon != nil ? weapon.plus_state_set : []
end
def minus_state_set #status the weapon can remove
weapon = self.get_weapon_data
return weapon != nil ? weapon.minus_state_set : []
end
#--------------------------------------------------------------------------
# Return state defense of all armor
#--------------------------------------------------------------------------
def state_guard?(state_id)
#------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
for i in self.armor_ids
#------------------------------------------------------------------------------
#End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
armor = $data_armors[i]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
end
return false
end

#--------------------------------------------------------------------------
# Remove element MULTI_ATTACK_ELEMENT from calculations
#--------------------------------------------------------------------------
alias g7_ms_game_actor_elements_correct elements_correct
def elements_correct(element_set)
#method remove element property that gives many attacks from weakness calculation
elements = element_set.clone
for elementnb in elements #search element that could add more attacks
elementname = $data_system.elements[elementnb].downcase
if elementname[0,MULTI_ATTACK_ELEMENT.size] == MULTI_ATTACK_ELEMENT.downcase #if weapons has element for another attack
elements.delete(elementnb) #dont consider it in the formula for damage
end
if elementname[-1* MULTI_ATTACK_ELEMENT.size, MULTI_ATTACK_ELEMENT.size] == MULTI_ATTACK_ELEMENT.downcase #if weapons has element for another attack
elements.delete(elementnb) #dont consider it in the formula for damage
end
end
return g7_ms_game_actor_elements_correct(elements) #return result from formula
end #end def elements_correct

#==============================================================================
# Methods calculate bonus of extra weapon and armor
#==============================================================================
alias g7_ms_game_actor_element_rate element_rate
def element_rate(element_id)
result = g7_ms_game_actor_element_rate(element_id)
if self.armor_slots.size > 4
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
end
return result
end

alias g7_ms_game_actor_base_str base_str
def base_str
n = g7_ms_game_actor_base_str

for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.str_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.str_plus : 0
end
return n
end

alias g7_ms_game_actor_base_dex base_dex
def base_dex
n = g7_ms_game_actor_base_dex

for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.dex_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.dex_plus : 0
end
return n
end

alias g7_ms_game_actor_base_agi base_agi
def base_agi
n = g7_ms_game_actor_base_agi

for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.agi_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.agi_plus : 0
end
return n
end

alias g7_ms_game_actor_base_int base_int
def base_int
n = g7_ms_game_actor_base_int

for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.int_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.int_plus : 0
end
return n
end

alias g7_ms_game_actor_base_pdef base_pdef
def base_pdef
n = g7_ms_game_actor_base_pdef

for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.pdef : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.pdef : 0
end
return n
end

alias g7_ms_game_actor_base_mdef base_mdef
def base_mdef
n = g7_ms_game_actor_base_mdef

for i in 1...self.weapon_slots.size
weapon = $data_weapons[self.weapon_ids[i]]
n += weapon != nil ? weapon.mdef : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.mdef : 0
end
return n
end

alias g7_ms_game_actor_base_eva base_eva
def base_eva
n = g7_ms_game_actor_base_eva

for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids[i]]
n += armor != nil ? armor.eva : 0
end
return n
end
#--------------------------------------------------------------------------
# Reset all slot data to default one
#--------------------------------------------------------------------------
def reset_all_slots
self.armor_slots = nil
self.weapon_slots = nil

self.armor_slot_names = nil
self.weapon_slot_names = nil
self.extra_slot_names = nil

self.weapon_slot_powers = nil
self.shield_hand_wield = nil
self.weapon_hand_wield = nil
self.shield_hand_slot = nil
self.weapon_shield_share = nil
self.multi_weapons_penality = nil
self.ignore_offhand = nil
self.all_weapons_for_skills = nil
end
#--------------------------------------------------------------------------
# Returns behavior of items on character
#--------------------------------------------------------------------------
def weapon_shield_share
return @weapon_shield_share != nil ? @weapon_shield_share : WEAPON_SHIELD_SHARE
end
def weapon_slots
return @weapon_slots != nil ? @weapon_slots : WEAPON_KINDS
end
def armor_slots
return @armor_slots != nil ? @armor_slots : ARMOR_KINDS
end
def shield_hand_wield
return @shield_hand_wield != nil ? @shield_hand_wield : SHIELD_HAND_WIELD
end
def multi_weapons_penality
return @multi_weapons_penality != nil ? @multi_weapons_penality : MULTI_WEAPONS_PENALITY
end
def weapon_slot_powers
return @weapon_slot_powers != nil ? @weapon_slot_powers : WEAPON_KIND_POWERS
end
def weapon_hand_wield
return @weapon_hand_wield != nil ? @weapon_hand_wield : WEAPON_HAND_WIELD
end
def shield_hand_slot
return @shield_hand_slot != nil ? @shield_hand_slot : SHIELD_HAND_SLOT
end
def extra_slot_names
return @extra_slot_names != nil ? @extra_slot_names : EXTRA_SLOT_NAMES
end
def ignore_offhand?
return @ignore_offhand != nil ? @ignore_offhand : IGNORE_OFFHAND
end
def attack_count #returns number of attacks already made
return @attack_count != nil ? @attack_count : 0
end
def all_weapons_for_skills?
return @all_weapons_for_skills != nil ? @all_weapons_for_skills : ALL_WEAPONS_FOR_SKILLS
end
#--------------------------------------------------------------------------
# Change behavior of items on character
#--------------------------------------------------------------------------
def multi_weapons_penality=(value)
@multi_weapons_penality = value
end
def weapon_slot_powers=(value)
@weapon_slot_powers = value
end
def weapon_shield_share=(bool)
@weapon_shield_share = bool
end
def shield_hand_slot=(int)
@shield_hand_slot = int
end
def shield_hand_wield=(bool)
@shield_hand_wield = bool
end
def weapon_hand_wield=(bool)
@weapon_hand_wield = bool
end
def ignore_offhand=(bool)
@ignore_offhand = bool
end
def all_weapons_for_skills=(bool)
@all_weapons_for_skills = bool
end
def attack_count=(value) #set number of attacks already made
@attack_count = value
end
#--------------------------------------------------------------------------
# Change names for your slots
#--------------------------------------------------------------------------
def shield_name=(text) #set shield slot name with $game_actors[numberofactor].shield_name = 'Yourname'
@armor_slot_names[0] = text
end
def helmet_name=(text)
@armor_slot_names[1] = text
end
def armor_name=(text)
@armor_slot_names[2] = text
end
def accessory_name=(text)
@armor_slot_names[3] = text
end
def extra_slot_names=(array)
@extra_slot_names = array
end
def armor_slot_names=(array) #set a new array of names.
@armor_slot_names = array
end
def weapon_slot_names=(array) #set a new array of weapon names.
@weapon_slot_names = array
end
end #end class game actor

class Game_Actors
def order_items
for actor in 0...@data.size
if @data[actor] != nil and @data[actor] != 0 then
@data[actor].order_armor_ids #order armors
end
end
end
end

Code:
class Scene_Equip
#==============================================================================
# Closes extra windows
#==============================================================================
alias g7_ms_scene_equip_main main
def main
@additional_initialize_done = false
g7_ms_scene_equip_main
for i in 5...@item_windows.size
@item_windows[i].dispose unless @item_windows[i].nil?
end
end

#==============================================================================
# Initialize the extra right windows
#==============================================================================
def g7_ms_scene_equip_additional_initialize
unless @additional_initialize_done
@item_windows = []
@item_windows[0] = @item_window1 #weapon
@item_windows[1] = @item_window2 #shield
@item_windows[2] = @item_window3 #helmet
@item_windows[3] = @item_window4 #armor
@item_windows[4] = @item_window5 #acc
nb_old_windows = @item_windows.size

for i in nb_old_windows...@actor.armor_slots.max+1
@item_windows.push(Window_EquipItem.new(@actor, i) ) #add the remaining
#windows for extra slots
@item_windows[i].help_window = @help_window
end

@item_windows.push(Window_EquipOffHand.new(@actor, 0))
@item_windows[-1].help_window = @help_window

if G7_MS_MOD::WINDOWS_STRETCH #if windows_stretch is true, stretch window
h = (@actor.weapon_slots.size + @actor.armor_slots.size + 1) * 32
h2 = (G7_MS_MOD::MAX_SHOW_SLOTS+1) * 32
h = [h, h2].min
@right_window.height = h
if @right_window.index > @actor.weapon_slots.size + @actor.armor_slots.size - 1
@right_window.index = @actor.weapon_slots.size + @actor.armor_slots.size - 1
end

if @left_window.y + @left_window.height == 256

@left_window.height = @right_window.height
elsif G7_MS_MOD::HELP_AT_BOTTOM == true and @left_window.height == 416 then
@left_window.height -= 64 #make left window shorter
end
y_pos = (@right_window.y + @right_window.height)
y_space = 480 - y_pos

#if help at bottom, reduce bottom item window size
if G7_MS_MOD::HELP_AT_BOTTOM == true then y_space -= 64 end

for item_window in @item_windows
next if item_window.nil?
item_window.y = y_pos
item_window.height = y_space
end
end

@additional_initialize_done = true
end
end

alias g7_ms_scene_equip_refresh refresh
#==============================================================================
# Refresh and make visible the correct right window
#==============================================================================
def refresh
#this part is used to refresh the equipped item at the right window
g7_ms_scene_equip_additional_initialize

@actor.translucent_texts.fill(false)

@actor.equip_type_force = index_to_equip_part(@right_window.index)
@right_window.item_fix_on
@right_window.scroll_fix_on
save = @right_window.index

@right_window.index = index_to_equip_kind(@right_window.index)

if @right_window.index == 0 and @actor.ignore_offhand? != true then
if @actor.nb_offhand_required(save) > 0 then
@right_window.index = @item_windows.size-1
end
end


@actor.equip_from_menu = true
@actor.equip_mode = 'STORE' #ensure current equipment will get properly stored
# and reequiped

@item_window = @item_windows[@right_window.index]
@item_windows[@right_window.index].visible = true
for i in 0...@item_windows.size
if i != @right_window.index then
@item_windows[i].visible = false
end
end
#equip and remove item
g7_ms_scene_equip_refresh

@actor.equip_from_menu = false
@actor.equip_mode = nil
@actor.equip_type_force = nil

@right_window.index = save

@right_window.scroll_fix_off
@right_window.item_fix_off

if @item_window.index != @old_index
@right_window.refresh
end
@old_index = @item_window.index
end
#==============================================================================
# Convert the right_window.index to equip_type
#==============================================================================
alias g7_ms_scene_equip_update_item update_item
def update_item #this changes the @right_window.index to the correct value
#to take account of extra slots
@actor.equip_type_force = index_to_equip_part(@right_window.index)
@right_window.item_fix_on
@right_window.scroll_fix_on

save = @right_window.index
@right_window.index = index_to_equip_kind(@right_window.index)

@actor.equip_from_menu = true
g7_ms_scene_equip_update_item #equip item
@actor.equip_from_menu = false
@actor.equip_type_force = nil
# if not in item_window screen
if @item_window.index == -1

#if shield-weapon can modify each other
if @actor.shield_hand_wield == true and
if @right_window.index == @actor.shield_hand_slot then
@item_windows[0].refresh
@item_windows[-1].refresh
elsif @right_window.index == 0
@item_windows[@actor.shield_hand_slot].refresh #refresh shield slot
end
end

if @right_window.index == 0 and @actor.ignore_offhand? != true then
if @item_window == @item_windows[-1] then
@item_windows[0].refresh
elsif @item_window == @item_windows[0] then
@item_windows[-1].refresh
end
end

end
@right_window.index = save
@right_window.scroll_fix_off
@right_window.item_fix_off
@actor.equip_type_force = nil
end
#==============================================================================
# Convert index to equip part
#==============================================================================
def index_to_equip_part(index)
#return index of slot in the array [0, @actor.armor_slots, actor.weapon_slots]
if index >= @actor.weapon_slots.size #if armor
return index - (@actor.weapon_slots.size - 1)

elsif index >= 1 #if extra weapon
return index + [@actor.armor_slots.size, 4].max #make it last
else
return 0
end
end
#==============================================================================
# Convert index to equip kind
#==============================================================================
def index_to_equip_kind(index)
#return index of slot in either actor.weapon_slots or actor.armor_slots
i = index_to_equip_part(index)

if index >= @actor.weapon_slots.size #if armor
set = @actor.armor_slots[i-1]
else #if weapon
i = i == 0 ? 0 : i - [@actor.armor_slots.size, 4].max
set = @actor.weapon_slots[i]
end
return set != nil ? set : 0
end
end #end scene_equip
#==============================================================================
# Window_EquipRight
#==============================================================================

class Window_EquipRight < Window_Selectable
def item_fix_on
#fix window
@fixed_item = @data[self.index]
@fixed = true
end

def item_fix_off
#stop fixing window
@fixed_item = nil
@fixed = false
end
#==============================================================================
# Dont scroll right window if you press L or R
#==============================================================================
def update
if Input.repeat?(Input::R) or Input.repeat?(Input::L) then
return
else
super
end
end
#==============================================================================
# Draws equipped items with support of translucent and cursed items
#==============================================================================
def draw_item_name(item, x, y, translucent = false)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)

if item.cursed
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = G7_MS_MOD::CURSED_COLOR
elsif translucent
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 128)
self.contents.font.color = disabled_color
else
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
end

self.contents.draw_text(x + 28, y, 212, 32, item.name)
end


alias g7_ms_window_equipright_item item
#==============================================================================
# Prevent needless update of item quantities in item window
#==============================================================================
def item
#this ensures that the number of items doesn't get updated if you move
#cursor in item window
return @fixed_item if @fixed
return g7_ms_window_equipright_item
end

#==============================================================================
# Change the height of right windows to fit the slots
#==============================================================================
alias g7_ms_window_equipright_initialize initialize
def initialize(actor) #init with a different height

g7_ms_window_equipright_initialize(actor)
h = (actor.weapon_slots.size + actor.armor_slots.size) * 32 #total height
#of right window
self.contents = Bitmap.new(width - 32, h) #change the height

refresh
end

#==============================================================================
# Shows the slot names and the name of the items you have equipped
#==============================================================================
def refresh #remplaced method to show caption of all items and slot
self.contents.clear
@data = []
#------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
self.contents.font.name = G7_MS_MOD::FONT_NAME
for i in 0...@actor.weapon_slots.size
@data.push($data_weapons[@actor.weapon_ids[i]]) #push name of weapon
end
for i in 0...@actor.armor_slots.size
@data.push($data_armors[@actor.armor_ids[i]]) #push name of armor
end
@caption = []
for i in 0...@actor.weapon_slots.size
@caption.push(@actor.weapon_slot_names[i]) #push name of weapon slots

end
for i in 0...@actor.armor_slots.size
@caption.push(@actor.armor_slot_names[@actor.armor_slots[i]-1]) #push name of armor slot
end
@item_max = @data.size
if @actor.translucent_texts == nil then @actor.translucent_texts = Array.new end

for i in 0...@data.size
if @caption[i] != nil
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * i, 92, 32, @caption[i]) #draw name of slots
end
draw_item_name(@data[i], 92, 32 * i, @actor.translucent_texts[i]) #draw name of equipment
end
#support for other script
if defined? xrxs_additional_refresh
xrxs_additional_refresh
end
#------------------------------------------------------------------------------
# End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
end
end

#==============================================================================
# New class to show equipitem in offhand
#==============================================================================
class Window_EquipOffHand < Window_EquipItem
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add equippable weapons

weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
weapon = $data_weapons[i]
if weapon.needs_offhand == false
if G7_MS_MOD::TWOHANDED_IN_OFFHAND != false and weapon.nb_hands <= 1 then
@data.push(weapon)
end
end
end
end
# Add blank page
@data.push(nil)
# Make a bit map and draw all items
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = G7_MS_MOD::FONT_NAME
#self.contents.font.size = 24
for i in 0...@item_max-1
draw_item(i)
end
if G7_MS_MOD::SHOW_REMOVE then
i += 1
x = 4 + i % @column_max * (288 + 32)
y = i / @column_max * 32
self.contents.draw_text(x+4, y, 100, 32, '[Remove]')
end
end
end

class Window_Selectable < Window_Base

def scroll_fix_on
@scroll_fixed = true
end
def scroll_fix_off
@scroll_fixed = false
update_cursor_rect
end
#==============================================================================
# Prevents unwanted scrolling
#==============================================================================

 alias g7_ms_update_cursor_rect update_cursor_rect
def update_cursor_rect
#This prevents the windows from scrolling if scroll is fixed
#This was added to ensure that if there are few slots, the right equip
#screen doesn't scroll needlessly
return if @scroll_fixed
g7_ms_update_cursor_rect
end
end

#==============================================================================
# Shows a new status window if Status_window_arrange is true
#==============================================================================
if G7_MS_MOD::STATUS_WINDOW_ARRANGE
class Window_Status < Window_Base
def refresh
#------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
self.contents.font.name = G7_MS_MOD::FONT_NAME
#------------------------------------------------------------------------------
# End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
self.contents.clear
draw_actor_face(@actor, 4, 30)
draw_actor_name(@actor, 4, 0)
#draw_actor_class(@actor, 4 + 144, 0)
draw_actor_level(@actor, 106, 32)
draw_actor_state(@actor, 106, 64)
draw_actor_hp(@actor, 106, 112, 172)
draw_actor_sp(@actor, 106, 144, 172)
draw_actor_parameter(@actor, 106, 192, 0)
draw_actor_parameter(@actor, 106, 224, 1)
draw_actor_parameter(@actor, 106, 256, 2)
draw_actor_parameter(@actor, 106, 304, 3)
draw_actor_parameter(@actor, 106, 336, 4)
draw_actor_parameter(@actor, 106, 368, 5)
draw_actor_parameter(@actor, 106, 400, 6)
 #------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
if G7_MS_MOD::EVADE
draw_actor_parameter(@actor, 106, 432, 7) # activate if you have a draw_actor_paramter method that draw evade
end
self.contents.font.color = system_color
self.contents.draw_text(320, 16, 80, 32, 'EXP')
self.contents.draw_text(320, 48, 80, 32, 'NEXT')
self.contents.font.color = normal_color
self.contents.draw_text(320 + 80, 16, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(320 + 80, 48, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 80, 96, 32, 'Equipment')

for i in 0...@actor.weapon_slots.size
draw_item_name($data_weapons[@actor.weapon_ids[i]], 320 + 16, 80 + 24 * (i+1))
end

for i in 0...@actor.armor_slots.size
draw_item_name($data_armors[@actor.armor_ids[i]], 320 + 16, 200 + 24 * (i - 4 + @actor.weapon_slots.size))
end
#------------------------------------------------------------------------------
# End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
end
end
end

Code:
class Scene_Battle
#==============================================================================
# Go to phase4 step2 for attack if attack_count < attacks.size
#==============================================================================
alias g7_ms_scene_battle_phase4_step6 update_phase4_step6
def update_phase4_step6(battler=nil)
#This methods make the battler return to phase4 step2 if there
#an extra attack to be made

if battler== nil then #if no parameters
g7_ms_scene_battle_phase4_step6 #first do the appropriate action
if @active_battler.is_a?(Game_Enemy) then return end
@active_battler.attack_count += 1 #increase the number of attack made
if @active_battler.attack_count == @active_battler.attacks.size or
@active_battler.current_action.kind != 0 or
@active_battler.current_action.basic != 0 or
judge == true#if all attacks are made

@active_battler.attack_count = 0
else
@phase4_step = 2 #return for extra attack
end
else #if it requires the battler as a parameters
g7_ms_scene_battle_phase4_step6(battler)
if battler.is_a?(Game_Enemy) then return end
battler.attack_count += 1 #increase the number of attack made
if battler.attack_count == battler.attacks.size or
battler.current_action.kind != 0 or battler.current_action.basic != 0 or
judge == true#if all attacks are made

battler.attack_count = 0 #end of turn and return attack count to 0
else
if @action_battlers.include?(@active_battler) == false then @action_battlers.push(battler) end #add the battler again to the action
battler.phase = 2 #returns for extra attack
end
end

end #end def
end #end class

#--------------------------------------------------------------------------
# Fix equiped item if user load saved game
#--------------------------------------------------------------------------
class Scene_Load < Scene_File
alias g7_ms_scene_load_read_save_data read_save_data
def read_save_data(file)
g7_ms_scene_load_read_save_data(file)
$game_actors.order_items #order armor when you load a saved game in
#case it is an old game
end
end

#--------------------------------------------------------------------------
# Fix items as you open RMXP
#--------------------------------------------------------------------------
class Scene_Title
alias g7_ms_scene_title_main main
def main
RPG.initialized_item_types = false
g7_ms_scene_title_main
RPG.set_new_item_types
end
end

class Interpreter
#==============================================================================
# *Conditional Branch to make it work when comparing extra items
#==============================================================================
alias g7_ms_interpreter_command_111 command_111
def command_111
result = false
broken = false
case @parameters[0]
when 4 # when Actor
actor = $game_actors[@parameters[1]]
if actor != nil
case @parameters[2]
when 3 # if weapon
for i in 0...actor.weapon_ids.size
result |= (actor.weapon_ids[i] == @parameters[3]) #compare
end
broken = true
when 4 # if armor
for i in 0...actor.armor_ids.size
result |= (actor.armor_ids[i] == @parameters[3]) #compare
end
broken = true
end
end
end
unless broken # if other conditional branch
g7_ms_interpreter_command_111 #do the normal condition
return
end
@branch[@list[@index].indent] = result
if @branch[@list[@index].indent] == true
@branch.delete(@list[@index].indent)
return true
end
return command_skip
end
end


module Kernel
private
def Rg(from, to, *step) Rg.new(from, to, *step) end
end

class Rg
#Used to a more effective for ... in ...
include Enumerable
def initialize(from, to, step = sign(to - from))
@from, @to, @step = from, to, step
@to += @step - ((@to - @from) % @step)
end
def each
x = @from
until x == @to
yield x
x += @step
end
self
end
def sign(x)
case
when x > 0
1
when x == 0
0
else
-1
end
end
end



Be warned, that's lifted straight from Steelknight, so I may have edited a few bits here and there, and the first part is full of the custom settings I'm employing, so you'll need to tweak that.
 
You'll want to put the four of them into four blank scripts, above main and below the rest of the scripts. The first one is Multi Equip Script: Modules, the second Multi Equip Script: Actor, the third Multi Equip Script: Windows, and the fourth Multi Equip Script: Other.

Though the names are not important at all. Just paste each section into a separate blank script in your editor, above main and below the rest.
 

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