Hey Guys i need a edit of this script
Currently it allows you to have a weapon and 4 accessories slots
id like to have it so its a shiled and 4 accessories instead
Also (i don´t know if it´s related to this script) there is a glitch going on with the original accessory slot
if you press Q / W to switch to another actor it will crash and sometimes the selectable won´t show up :/
Thanks for the help in advance
#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
# This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add equippable weapons
if @equip_type == 0
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)
@data.push($data_weapons[i])
end
end
end
# Add equippable armor
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
@data.push($data_armors[i])
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)
for i in 0...@item_max-1
draw_item(i)
end
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make windows
@help_window = Window_Help.new
@help_window. y = 50
@left_window = Window_EquipLeft.new(@actor)
@left_window. y = 100
@right_window = Window_EquipRight.new(@actor)
@right_window. y = 100
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window1. y = 292
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window2. y = 292
# Associate help window
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
# Set cursor position
@right_window.index = @equip_index
refresh
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Set item window to visible
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index >= 1)
# Get currently equipped item
item1 = @right_window.item
# Set current item window to @item_window
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window2
when 3
@item_window = @item_window2
end
# If right window is active
if @right_window.active
# Erase parameters for after equipment change
@left_window.set_new_parameters( nil, nil, nil)
end
# If item window is active
if @item_window.active
# Get currently selected item
item2 = @item_window.item
# Change equipment
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
# Get parameters for after equipment change
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# Return equipment
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# Draw in left window
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
end
Here are your replacements:
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add equippable armor
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
# If shield slot
if @equip_type == 1
# Only add equip if it is a Shield type
@data.push($data_armors[i]) if $data_armors[i].kind == 0
else
# Push accessories but not Shields
@data.push($data_armors[i]) if $data_armors[i].kind != 0
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)
for i in 0...@item_max-1
draw_item(i)
end
end
@item_window1 = Window_EquipItem.new(@actor, 1) # Shield slot
@item_window1. y = 292
@item_window2 = Window_EquipItem.new(@actor, 2) # 4-anything slots
@item_window2. y = 292
As for the bug:
# Set current item window to @item_window
if @right_window.index == 0
@item_window = @item_window1
else
@item_window = @item_window2
end
hm okay so it does give me the chance to equip 4 accessories now
and the weapon slot is now replaced with the shield slot
or at least the list of shields appear but i can´t equip them
also the actos are still supose to have a weapon which you can´t see
and i still need to be able to switch those out via event commands ( if possible)
Oh right, I didn't think of that. Actors have a @weapon and @armor1, @armor2, @armor3, and @armor4. I'd basically need to write another variable, probably @shield, and somehow incorporate that into the default methods...which could take a while.