sure
#==============================================================================
# Multi-slot equipment script
#------------------------------------------------------------------------------
# Guillaume777
# 4.0
# 2005/12/21
#==============================================================================
=begin
HISTORY
Version 4.0 2005/12/21 NEW feature : two ( or more ) handed weapons !!!
Just tag a weapon to an element called 2handed and you are set !
I also improved my code a lot.
Version 3.3 2005/12/20 Better comments to help editing my script
Version 3.2 2005/12/19 Fixed bug that was caused if you tried to load a
game saved without the script installed. Supports SDK 1.3
Version 3.1.3 2005/12/19 Tentative fix to reported bug by Rag
Version 3.1.2 2005/12/19
Fixed $game_actors[1].extra_slot_names command
Version 3.1.1 2005/12/19
Minor change, changed name of 1 alias to comply with SDK 1.2
Version 3.1 2005/12/19
Now the armors types are not reset if you load a saved game !
Version 3.0 2005/12/19
Improved code ! Code should now be more compatible with equip scripts, and
simpler to understand.
Also I simplified how extra independant slots are set.
Version 2.3 2005/12/19
Added Begin SDK Enable Test
Version 2.2 2005/12/19
Added support and compliance to SDK 1.2
Version 2.1 2005/12/19
Fixed some bugs
Now if you change the slots, the items equipped are going to get reassigned to proper slots
Equipright windows now can't completely cover the item window
Added a list of changed methods in the code, to help those who could have compatibility
problem with my script.
Version 2.0 2005/12/18
NEW : ALLOWS FOR COMPLETELY INDEPENDANT SLOTS !
This means you can have boots, cape, gauntlets, amulets etc slots and only
items defined as such will be able to be equipped in those slots.
No longer will you be stuck with only armor, shield, helmet and acc
Read the instruction to learn how to do that
Version 1.3 2005/12/17
NEW : Fixed bugs if empty weapon slot
Version 1.2 2005/12/17
NEW : If you change the armor or weapon slots, the armor and weapon
are going to get reequiped ( if there is room for them ) or desequipped
( if not room to equip them)
NEW : If you set starting equipment in the database, the items are going to
get equipped to the right slots
Version 1.1 2005/12/17
NEW : Improved compatibility with various battle systems
Version 1.0 2005/12/17
######################################################################
Instructions
Put this above main and below your favorite equip screen script !
Multiple attacks for 1 weapon
If you want any weapon to do multiple attacks, just add a new element called
attackX2 ( where 2 is the number of attacks you want ) and add that element
to your weapon.
This is cumulative with multiple weapon.
So, a character equipped with a sword with attackX2 and another weapon with
attackX3 would attack a total of 5 times.
#Change name of armor slot
# To change name of armor/weapon slot of a character, use a call script with :
# ( 1 is the number of the actor you want to change )
#
# To change name of shield slot
# $game_actors[1].shield_name = 'Force Field'
# To change name of helmet slot
# $game_actors[1].helmet_name = 'Cap'
# To change name of armor slot
# $game_actors[1].armor_name = 'Jacket'
#
# To change name of accessory slot
# $game_actors[1].accessory_name = 'Relic'
#
# Or you could change them all in 1 sentance with
# $game_actors[1].armor_slot_names = ['Force Field', 'Cap', 'Jacket', 'Relic']
#
# If you don't use those command or if you put nil as a name the script will
# use the normal names you configured in the database
#
#
#Change name of weapon slots
# $game_actors[1].weapon_slot_names = ['Right-Hand','Left-Hand']
#
# This would give you a character with a weapon slot called Right-Hand and the next
# called 'Left-Hand'.
# Note that you must have at least two 0 in WEAPON_KINDS or $game_actors[1].weapon_slots
# or you won't have any second slot
#
# If you don't configure the slots like this, the script will use
# the names in the WEAPON_KIND_NAMES constant. If the names are empty,
# it will use the name in the database
#
#Change name of extra slots
# $game_actors[1].extra_slot_names = ['Boots', 'Pendant', 'Cape']
# If you dont enter anything it will use values in EXTRA_SLOT_NAMES
#
#Change slots
# Change WEAPON_KINDS and ARMOR_KINDS to the slots you want.
# Each 0 in WEAPON_KINDS means a weapon slot ( this affect all your character )
# For example [0,0,0,0] would give you 4 weapon slots and 4 attacks, perfect for a 4 arms monster in your party
# If you have multiple weapon equipped your char will attack witch each weapon.
# Each weapon will have its own independant animation, power and elements
# However while equiping in the menu it will show the power of all weapons combined
#
#
# If you want to change weapon slots to 1 character, use something like
# $game_actors[1].weapon_slots = [0,0]
# This would give 2 weapon slots to the first character in the database
#
# If you change ARMOR_KINDS ( this affect all your characters )
# Each 1 mean Shield
# Each 2 mean Helmet
# Each 3 mean Armor
# Each 4 mean accessory
# For example [ 1, 1, 2, 4, 4] would give you two shield slots,
# one helmet slot, no armor slot and two accessory slots.
# Adding more than one slot for shield/helmet/armor might be
# useful for monster/robot teamates.
# For human characters its probably best to stick with one of each and 2-3 accessories
#
# If you want to change the armor slot of 1 character, use
# $game_actors[1].armor_slots = [1,2,3,4,4,4]
# This would give you 3 accesory to your first character only
#
#
#Get new independant slots ( NEW to 2.0 )
# To get new independant slots, first you must add number 5 or above in
# ARMOR_KINDS or $game_actors[1].armor_slots.
# Each of these number represent a distinct slot.
# After, you must add (number-1) next to the name of the armor you want
# to get assigned to that slot.
#
# Now the item should be only equipable in that slot.
# For example, to get an extra slot you could do
# ARMOR_KINDS = [1,2,3,4,7]
# After that, all armor with (6) will be equipped to the 7 slot
#
#
#WINDOWS_STRETCH
# Windows_stretch = true will stretch your right window in the equipment screen.
# This will allow you to see all your slots at the same time, but will give you less
# space to see the unequipped items at the bottom of the screen
#
#STATUS_WINDOW_ARRANGE
# Status_Window_Arrage = true will give you a new statut window
# If you don't have a status window compatible with my script I suggest
# you use this one
#
##################################################################
#
#COMPATIBILITY
# This script seems to be compatible with most ATB systems and equip systems
#
#IMPROVEMENTS I'D LIKE
# I'd like to add support for 2 handed weapons
# I'd like to add support for a shield+weapons slot
#
#CREDITS
# This script was made thanks to scripts I found and modifed at
#
http://f44.aaa.livedoor.jp/~ytomy/tkool/rpgtech/frame.html
#
http://xms.rdy.jp/x/
# Also thanks to SephirothSpawn for help with extra slots
#
############################################################
#MEMO :
#
#If you want character to have each their own slots:
# To change name of slots :
# $game_actors[1].weapon_slot_names = []
# $game_actors[1].armor_slot_names = []
# $game_actors[1].extra_slot_names = []
#
# To change slots
# $game_actors[1].weapon_slots = []
# $game_actors[1].armor_slots = []
#
#If you want to edit the default slots everyone will use you change
# WEAPON_KINDS = []
# WEAPON_KIND_NAMES = []
# ARMOR_KINDS = []
# EXTRA_SLOT_NAMES = []
################################################################
CHANGED METHODS
REMPLACED :
Game_Actor - animation1_id
Game_Actor - animation2_id
Game_Actor - base_atk
Game_Actor - element_set
Game_Actor - plus_state_set
Game_Actor - minus_state_set
Game_Actor - state_guard?
They are used to check the stats of a weapon in @weapon_ids to allow attack which multiple weapon
Window_EquipRight - refresh #shows the name of all slots and equipped items
Window_Status - refresh # if G7_MS_MOD::STATUS_WINDOW_ARRANGE is true, then show a new status window
ALIASED :
Game_Actor - setup #to init new slots
Game_Actor - equip #to equip new slots
Game_Actor - elements_correct #to remove MULTI_ATTACK_ELEMENT from calculations
Game_Actor - element_rate #to add the element rates of new slots
Game_Actor - base_str base_dex base_agi base_int base_pdef base_mdef base_eva #to add the stats bonus of new slots
Window_Selectable - update_cursor_rect # This was added to ensure that
if @scroll_fixed == true then do not scroll window. This was put
so equipright doesn't scroll needlessly if there are few slots
Window_EquipRight - initialize
initialize the window size proportionly to the number of slot
Window_EquipRight - item
this was aliased so that the number of items in item
window of extra slot doesn't update when moving cursor
Scene_Equip - main # is aliased to close the extra windows
Scene_Equip - refresh #to activatate g7_ms_additional_initialize and make proper windows visible
Scene_Equip - update_item #this changes the @right_window.index to the correct value to take account of extra slots
Scene_Battle - phase4_step6 update_phase4_step6 #to return to phase4 step 2 for extra attacks
Scene_Title - command_continue
Needed to reinitialize changes to $data_armors
Interpreter - command_111
This makes the conditional branch work while comparing items equipped in extra slots
##################################################
=end
#--------------------------------------------------------------------------
# * SDK Log Script
#--------------------------------------------------------------------------
if defined? SDK #if SDK module is there then log script
SDK.log('Multi-slot equipment script', 'Guillaume777', '4.0', '2005/12/21')
end
#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if not defined? SDK or SDK.state('Multi-slot equipment script')
#--------------------------------------------------------------------------
# * Begin Multi-slot equipment script
#--------------------------------------------------------------------------
module G7_MS_MOD #you set the default names,slots, etc here
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 = [2,3,4,5,6,7]
# 1 = shield
# 2 = helmet
# 3 = armor
# 4 = acc
# 5 = and more : extra slot
EXTRA_SLOT_NAMES = ['Gauntlet','Boots','Amulet']
#Name of the extra slots in equip window
#You need as many words as there are '5' in armor_kinds
#The first order of the slots names reflect the order of the 5 in armor_kinds
MULTI_ATTACK_ELEMENT = 'attackx' #name of element for multiple attack, when
#element tagging add the number of attacks after the name
HANDS_ELEMENT = 'handed' #name of element for 2handed weapon
#put the number of hands in front of HANDS_ELEMENT
#in the database
SHIELD_HAND_WIELD = true#true = allow to use shield hand for two handed weapon
SHIELD_HAND_SLOT = 1 #slot number to be used for shield hand
WEAPON_HAND_WIELD = true #true = allow to use weapon hand for two handed weapon
WINDOWS_STRETCH = true #true : equip_right stretch to adjust to nb of slots
MAX_SHOW_SLOTS = 8 #maximum number of slots in 1 screen in equip right window
#Useless if windows_stretch = false
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
def initialize
@weapon_ids = [] # stores the different weapons on the character
@armor_ids = [] #stores the different armors of the character
@attacks = [] #stores cycle of attacks
#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
module RPG
#--------------------------------------------------------------------------
# New armor type = number in name of armor
#--------------------------------------------------------------------------
class Armor
def set_adv_type
if @name.sub!(/\((\d+)\)/, '') != nil
@kind = $1.to_i #set kind to number in name of armor
end
end
end #end armor
class Weapon
#--------------------------------------------------------------------------
# Returns number of hands needed for weapons
#--------------------------------------------------------------------------
def number_hands
nb_hands = 1
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
#--------------------------------------------------------------------------
# Returns the number of attack the weapon can do
#--------------------------------------------------------------------------
def number_attacks
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 number_attacks
end #end module
#--------------------------------------------------------------------------
# Fix armor in $data_armors to correct kind and name
#--------------------------------------------------------------------------
class Scene_Title
alias g7_ms_scene_title_command_continue command_continue
def command_continue #loading
g7_ms_scene_title_command_continue
for armor in $data_armors #for each armor
unless armor == nil #if armor
armor.set_adv_type #set new type
end
end
end
end
class Game_Actor < Game_Battler
include G7_MS_MOD
attr_accessor :equip_type_force
#--------------------------------------------------------------------------
# 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
#==============================================================================
# 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
equip_type = @equip_type_force #equip_type_force is used to bypass the
#equip_type argument
end
if self.enough_hands?(equip_type,id) == false then return end
if 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
if id != 0 then self.fix_handed_weapons(equip_type) 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
arr_emp_w_hands = Array.new #stores slot of empty weapon hand
arr_emp_s_hands = Array.new #stores slot of shield hand
save_force = @equip_type_force
@equip_type_force = nil
for nweapon in 0...self.weapon_slots.size
if self.weapon_ids[nweapon] == 0 then
arr_emp_w_hands.push(nweapon) #stores the empty weapon hand
elsif $data_weapons[self.weapon_ids[nweapon]].number_hands != 1 then
array_wield_hands.push(nweapon) #stores the hand to wield weapon
end
end
for narmor in 0...self.armor_slots.size
if self.armor_slots[narmor] == self.shield_hand_slot and self.armor_ids[narmor] == 0 then
arr_emp_s_hands.push(narmor) #stores empty shield hand
end
end
for nweapon in 0...array_wield_hands.size
if self.weapon_ids[array_wield_hands[nweapon]] == 0 then
nb_hands = 1 #get number of hands required
else
nb_hands = $data_weapons[self.weapon_ids[array_wield_hands[nweapon]]].number_hands
end
#decrease nb_hands for empty weapon hands
if self.weapon_hand_wield == true
for nhand in 0...arr_emp_w_hands.size
if arr_emp_w_hands.size != 0 and nb_hands != 1
#if it finds empty hand
nb_hands += -1 #decrease counter
arr_emp_w_hands.delete_at(0) #delete empty hand reference
end
end
end
#decrease nb_hands for empty weapon hands
if self.shield_hand_wield == true
for nhand in 0...arr_emp_s_hands.size
if arr_emp_s_hands.size != 0 and nb_hands != 1
#if it finds empty hand
nb_hands += -1 #decrease counter
arr_emp_s_hands.delete_at(0) #delete empty hand reference
end
end
end
#if shield needs to be removed for empty end
if self.shield_hand_wield == true 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
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
nb_hands += -1
self.equip(0,0)
end
else
if nhand+self.armor_slots.size != equip_keep
nb_hands += -1
self.equip(nhand+self.armor_slots.size, 0)
end
end
end
end
end
if nb_hands != 1 and nweapon == array_wield_hands.size then #if still can't find a slot
if array_wield_hands[nweapon] == 0 then
self.equip(0, 0)
else
self.equip(array_wield_hands[nweapon]+self.armor_slots.size,0)
end
end
end
@equip_type_force = save_force #returns the equip_type_force
end
def enough_hands?(equip_type, id)
if equip_type == 0 or equip_type > self.armor_slots.size #if weapon
if id !=0
nb = $data_weapons[id].number_hands
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
return true
elsif nb > self.weapon_slots.size and self.shield_hand_wield == false and self.weapon_hand_wield == true
return false
elsif nb > nb_s+1 and self.weapon_hand_wield == false and self.shield_hand_wield == true
return false
elsif nb > self.weapon_slots.size+ nb_s and self.weapon_hand_wield == true and self.shield_hand_wield == true
return false
elsif self.shield_hand_wield == false and self.weapon_hand_wield == false
return false
else
return true
end
end
#==============================================================================
# Equip extra items
#==============================================================================
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
#--------------------------------------------------------------------------
# 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
!= nil and self.armor_ids != 0
kind = $data_armors[self.armor_ids].kind
if equipment_array[kind] == nil then
equipment_array[kind] = Array.new
end
equipment_array[kind].push(self.armor_ids)
#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)-1] == nil then
equipment_array[(self.armor_slots)-1] = Array.new
end
while aitem == nil and equipment_array[(self.armor_slots)-1].size != 0
aitem = equipment_array[(self.armor_slots)-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
#--------------------------------------------------------------------------
# It orders weapons to fit slots
#--------------------------------------------------------------------------
def order_weapon_ids
weapons = Array.new
for i in 0...self.weapon_slots.size
if self.weapon_ids != nil and self.weapon_ids != 0
weapons.push(self.weapon_ids)
end
end
self.weapon_ids = nil #remove all armors
self.weapon_ids = weapons
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.shield_hand_wield = nil
self.shield_hand_slot = nil
self.weapon_hand_wield = nil
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
@weapon_slots = Array.new(array) #new slots
self.weapon_ids = weapon_array #reequip items
self.order_weapon_ids
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
armor_array = Array.new(self.armor_ids)
@armor_slots = Array.new(array) #new array
self.armor_ids = armor_array
self.order_armor_ids #put items at right place
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, 0 ) #remove all weapons
end
return
end
for i in 0...self.weapon_slots.size
if array == nil then array = 0 end #ensure no nil are equiped
if i == 0 then #if first weapon
self.equip(0, array) #equip weapon
else #if extra weapons
self.equip(i + self.armor_slots.size, array)
end
end
end
#--------------------------------------------------------------------------
# Set new array of armors, if nil then it removes all armors
#--------------------------------------------------------------------------
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
for i in 0...self.armor_slots.size
if array == nil then array = 0 end
self.equip(i + 1, array) #equip new 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 == nil then ids = 0 end
end
return ids
end
#--------------------------------------------------------------------------
# Return @weapon_ids
#--------------------------------------------------------------------------
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 == nil then ids = 0 end
end
return ids
end
#--------------------------------------------------------------------------
# Return @weapon_slots
#--------------------------------------------------------------------------
def weapon_slots #return set slots or default slots
return @weapon_slots != nil ? @weapon_slots : WEAPON_KINDS
end
#--------------------------------------------------------------------------
# Return @armor_slots
#--------------------------------------------------------------------------
def armor_slots
return @armor_slots != nil ? @armor_slots : ARMOR_KINDS
end
#--------------------------------------------------------------------------
# Return @shield_hand_wield
#--------------------------------------------------------------------------
def shield_hand_wield
return @shield_hand_wield != nil ? @shield_hand_wield : SHIELD_HAND_WIELD
end
#--------------------------------------------------------------------------
# Return @weapon_hand_wield
#--------------------------------------------------------------------------
def weapon_hand_wield
return @weapon_hand_wield != nil ? @weapon_hand_wield : WEAPON_HAND_WIELD
end
#--------------------------------------------------------------------------
# Return @shield_hand_slot
#--------------------------------------------------------------------------
def shield_hand_slot
return @shield_hand_slot != nil ? @shield_hand_slot : SHIELD_HAND_SLOT
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 == nil then temp_array = default_names end #if not
#custom then set as default
if temp_array == nil then temp_array = $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 == nil then temp_array = default_names end #set as constant
if temp_array == nil then temp_array = $data_system.words.weapon end
#if constant array is empty then use default one
end
return temp_array
end
#--------------------------------------------------------------------------
# Return name of extra slots
#--------------------------------------------------------------------------
def extra_slot_names
return @extra_slot_names != nil ? @extra_slot_names : EXTRA_SLOT_NAMES
end
#--------------------------------------------------------------------------
# Set @shield_hand_slot
#--------------------------------------------------------------------------
def shield_hand_slot=(int)
@shield_hand_slot = int
end
#--------------------------------------------------------------------------
# Set @shield_hand_wield
#--------------------------------------------------------------------------
def shield_hand_wield=(bool)
@shield_hand_wield = bool
end
#--------------------------------------------------------------------------
# Set @weapon_hand_wield
#--------------------------------------------------------------------------
def weapon_hand_wield=(bool)
@weapon_hand_wield = bool
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
#--------------------------------------------------------------------------
# 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 equiping?(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 number of attacks made
#--------------------------------------------------------------------------
def attack_count #returns number of attacks already made
@attack_count = 0 if @attack_count == nil
return @attack_count
end
#--------------------------------------------------------------------------
# Change number of attack made
#--------------------------------------------------------------------------
def attack_count=(value) #set number of attacks already made
@attack_count = value
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 weapons as well as element defined
#at multi_attack_element
attacks = Array.new
for i in 0...self.weapon_ids.size
weapon = $data_weapons[self.weapon_ids]
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
#--------------------------------------------------------------------------
# Used to 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
#--------------------------------------------------------------------------
# Return animation of weapon
#--------------------------------------------------------------------------
def animation1_id #set animation for current weapon
#------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
weapon = self.get_weapon_data
#------------------------------------------------------------------------------
#End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
return weapon != nil ? weapon.animation1_id : 0
end
#--------------------------------------------------------------------------
# Return animation of weapon
#--------------------------------------------------------------------------
def animation2_id #set animation for current weapon
#------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
weapon = self.get_weapon_data
#------------------------------------------------------------------------------
#End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
return weapon != nil ? weapon.animation2_id : 0
end
#--------------------------------------------------------------------------
# Return base_atk of weapon
#--------------------------------------------------------------------------
def base_atk
#------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
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]
n += weapon != nil ? weapon.atk : 0
end
return n
end
#------------------------------------------------------------------------------
#End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
# Return element set of weapon
#--------------------------------------------------------------------------
def element_set #return elemental set of the current weapon
#------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
weapon = self.get_weapon_data
#------------------------------------------------------------------------------
#End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
return weapon != nil ? weapon.element_set : []
end
#--------------------------------------------------------------------------
# Return state effect of weapon
#--------------------------------------------------------------------------
def plus_state_set #status the weapon can give
#------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
weapon = self.get_weapon_data
#------------------------------------------------------------------------------
#End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
return weapon != nil ? weapon.plus_state_set : []
end
#--------------------------------------------------------------------------
# Return state effect of weapon
#--------------------------------------------------------------------------
def minus_state_set #status the weapon can remove
#------------------------------------------------------------------------------
#Begin Multi-slot equipment script Edit
#------------------------------------------------------------------------------
weapon = self.get_weapon_data
#------------------------------------------------------------------------------
#End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
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
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_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]
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]
n += weapon != nil ? weapon.str_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
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]
n += weapon != nil ? weapon.dex_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
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]
n += weapon != nil ? weapon.agi_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
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]
n += weapon != nil ? weapon.int_plus : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
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]
n += weapon != nil ? weapon.pdef : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
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]
n += weapon != nil ? weapon.mdef : 0
end
for i in 4...self.armor_slots.size
armor = $data_armors[self.armor_ids]
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]
n += armor != nil ? armor.eva : 0
end
return n
end
end #end class game actor
###############################################################################
# This is the battle modification used for extra attacks in battle
#
###############################################################################
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
###############################################################################
# This is the Equip scene modification to enable multiple slot equiping
###############################################################################
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
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 == @parameters[3]) #compare
end
broken = true
when 4 # if armor
for i in 0...actor.armor_ids.size
result |= (actor.armor_ids == @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
#==============================================================================
# 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
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 = $fontface
for i in 0...@actor.weapon_slots.size
@data.push($data_weapons[@actor.weapon_ids]) #push name of weapon
end
for i in 0...@actor.armor_slots.size
@data.push($data_armors[@actor.armor_ids]) #push name of armor
end
@caption = []
for i in 0...@actor.weapon_slots.size
@caption.push(@actor.weapon_slot_names) #push name of weapon slots
end
for i in 0...@actor.armor_slots.size
@caption.push(@actor.armor_slot_names[@actor.armor_slots-1]) #push name of armor slot
end
@item_max = @data.size
for i in 0...@data.size
draw_item_name(@data, 92, 32 * i) #draw name of equipment
if @caption != nil
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * i, 92, 32, @caption) #draw name of slots
end
end
#support for other script
if defined? xrxs_additional_refresh
xrxs_additional_refresh
end
#------------------------------------------------------------------------------
# End Multi-slot equipment script Edit
#------------------------------------------------------------------------------
end
end
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.dispose unless @item_windows.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 t