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.

Having a spot of trouble with inventory/equip screen...(pic included)...

http://i181.photobucket.com/albums/x259 ... ipting.jpg[/img]

I get this when i go to test play the game, go into my character menu, go to EQUIP and then highlight ALUXES and hit ENTER.
I have Theory's Greater Icon script which increases icon size and Guillame777's multi-slot script which adds more slots available for armor. They've been working just fine until tonight, don't know why cause nothing changed...any help would be GREATLY appreciated...

Here's the script in question...the line itself is in red...
#==============================================================================
# Multi-slot equipment script
#------------------------------------------------------------------------------
# Section 3:  Windows
#------------------------------------------------------------------------------
# Guillaume777
# 6.2.1
# 2006/02/14
#==============================================================================

#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
#  This class performs equipment screen processing.
#==============================================================================
class Scene_Equip
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  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  # Head
    @item_windows[3] = @item_window4  # Chest
    @item_windows[4] = @item_window5  # Necklace
    @item_windows[5] = @item_window6  # Right Hand Ring
    @item_windows[6] = @item_window7  # Left Hand Ring
    @item_windows[7] = @item_window8  # Waist
    @item_windows[8] = @item_window9  # Legs
    @item_windows[9] = @item_window10  # Feet
    @item_windows[10] = @item_window11  # Shoulders
    @item_windows[11] = @item_window12  # Arms
    @item_windows[12] = @item_window13  # Wrists
    @item_windows[13] = @item_window14  # Hands 
    nb_old_windows = @item_windows.size
    for i in nb_old_windows...@actor.armor_slots.max+1
      # Add the remaining windows for extra slots
      @item_windows.push(Window_EquipItem.new(@actor, i) )
      @item_windows.help_window = @help_window
    end
    @item_windows.push(Window_EquipOffHand.new(@actor, 0))
    @item_windows[-1].help_window = @help_window
    # If windows_stretch is true, stretch window
    if G7_MS_MOD::WINDOWS_STRETCH
      h = (@actor.weapon_slots.size + @actor.armor_slots.size + 1) * 50
      h2 = (G7_MS_MOD::MAX_SHOW_SLOTS+1) * 50
      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
        # Make left window shorter
        @left_window.height -= 64
      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
  #--------------------------------------------------------------------------
  # * Refresh and make visible the correct right window
  #--------------------------------------------------------------------------
  alias g7_ms_scene_equip_refresh refresh
  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 re-equiped
    @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.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
    # Equip item
    g7_ms_scene_equip_update_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
          # Refresh the shield slot
          @item_windows[@actor.shield_hand_slot].refresh
        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
  #     index : slot number
  #--------------------------------------------------------------------------
  def index_to_equip_part(index)
    # Return index of slot in the
    # array [0, @actor.armor_slots, actor.weapon_slots]
    # If Armor
    if index >= @actor.weapon_slots.size
      return index - (@actor.weapon_slots.size - 1)
    # If extra weapon
    elsif index >= 1
      # Make it last
      return index + [@actor.armor_slots.size, 4].max
    else
      return 0
    end
end
  #--------------------------------------------------------------------------
  # Convert index to equip kind
  #     index : slot number
  #--------------------------------------------------------------------------
  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 armor
    if index >= @actor.weapon_slots.size
      set = @actor.armor_slots[i-1]
    # If weapon 
    else
      i = i == 0 ? 0 : i - [@actor.armor_slots.size, 4].max
      set = @actor.weapon_slots
    end
    return set != nil ? set : 0
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Scene Equip
  #-------------------------------------------------------------------------- 
end



#==============================================================================
# ** Window_EquipRight
#------------------------------------------------------------------------------
#  This window displays items the actor is currently equipped with on the
#  equipment screen.
#==============================================================================
class Window_EquipRight < Window_Selectable
  #--------------------------------------------------------------------------
  # * Item Fix On
  #--------------------------------------------------------------------------
  def item_fix_on
    # Fix window
    @fixed_item = @data[self.index]
    @fixed = true
  end
  #--------------------------------------------------------------------------
  # * Item Fix Off
  #--------------------------------------------------------------------------
  def item_fix_off
    #stop fixing window
    @fixed_item = nil
    @fixed = false
  end
  #--------------------------------------------------------------------------
  # * Don't 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
  #     item        : item
  #     x           : draw spot x-coordinate
  #     y           : draw spot y-coordinate
  #     translucent : draw translucent
  #--------------------------------------------------------------------------
  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
  #--------------------------------------------------------------------------
  # * Prevent needless update of item quantities in item window
  #--------------------------------------------------------------------------
  alias g7_ms_window_equipright_item item
  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
  #     actor : actor
  #--------------------------------------------------------------------------
  alias g7_ms_window_equipright_initialize initialize
  def initialize(actor)
    # Initialize with a different height
    g7_ms_window_equipright_initialize(actor)
    # Total height of right window
    h = (actor.weapon_slots.size + actor.armor_slots.size) * 32
    # Change the height                                                       
    self.contents = Bitmap.new(width - 32, h)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Shows the slot names and the name of the items you have equipped
  #--------------------------------------------------------------------------
  def refresh
    # Replaced 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
      # Push the name(s) of the weapon(s)
      @data.push($data_weapons[@actor.weapon_ids])
    end
    for i in 0...@actor.armor_slots.size
      # Push the names of the armors
      @data.push($data_armors[@actor.armor_ids])
    end
    @caption = []
    for i in 0...@actor.weapon_slots.size
      # Push the name(s) of the weapon slots
      @caption.push(@actor.weapon_slot_names)
    end
    for i in 0...@actor.armor_slots.size
      # Push the names of the armor slots
      @caption.push(@actor.armor_slot_names[@actor.armor_slots-1])
    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 != nil
        self.contents.font.color = system_color
        # Draw the name of the slots
        self.contents.draw_text(4, 32 * i, 92, 32, @caption)
      end
      # Draw the name of the equipment
      draw_item_name(@data, 92, 32 * i, @actor.translucent_texts)
    end
    # Support for other script
    if defined? xrxs_additional_refresh
      xrxs_additional_refresh
    end
  # End Multi-slot equipment script Edit
  end
  #--------------------------------------------------------------------------
  # * End of CLASS:  Window EquipRight
  #--------------------------------------------------------------------------
end



#============================================================================
# ** Window_EquipOffHand
#----------------------------------------------------------------------------
#  A new window class that displays an equipped item in the actor's off hand.
#============================================================================
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
        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 = @item_max -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 of CLASS:  Window EquipOffHand
  #--------------------------------------------------------------------------
end



#==============================================================================
# ** Window_Selectable
#------------------------------------------------------------------------------
#  This window class contains cursor movement and scroll functions.
#==============================================================================
class Window_Selectable < Window_Base
  #--------------------------------------------------------------------------
  # * Scroll Fix On
  #--------------------------------------------------------------------------
  def scroll_fix_on
    @scroll_fixed = true
  end
  #--------------------------------------------------------------------------
  # * Scroll Fix Off
  #-------------------------------------------------------------------------- 
  def scroll_fix_off
    @scroll_fixed = false
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  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 of CLASS:  Window Selectable
  #-------------------------------------------------------------------------- 
end



#==============================================================================
# *** Global IF condition
#     Shows a new status window if Status_window_arrange is true
#==============================================================================
if G7_MS_MOD::STATUS_WINDOW_ARRANGE
  #============================================================================
  # ** Window_Status
  #----------------------------------------------------------------------------
  #  This window displays full status specs on the status screen.
  #============================================================================
  class Window_Status < Window_Base
    #--------------------------------------------------------------------------
    # * Refresh
    #--------------------------------------------------------------------------
    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
        # Activate if you have a draw_actor_paramter method that draws evade
        draw_actor_parameter(@actor, 96, 432, 7)
      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')
      y = 108
      for i in 0...@actor.weapon_slots.size
        draw_item_name($data_weapons[@actor.weapon_ids], 320 + 16, y)
        y += G7_MS_MOD::STATUS_WINDOW_SPACING
      end
      for i in 0...@actor.armor_slots.size
        draw_item_name($data_armors[@actor.armor_ids], 320 + 16, y)
        y += G7_MS_MOD::STATUS_WINDOW_SPACING
      end
      # End Multi-slot equipment script Edit     
    end
    #------------------------------------------------------------------------
    # * End of CLASS:  Window Status
    #------------------------------------------------------------------------
  end
  #--------------------------------------------------------------------------
  # * End of Global IF condition
  #--------------------------------------------------------------------------
end
 
ok, I changed line 110 to

@item_windows[0].visible = false

now i can get into my equip menu, but once I scroll about halfway down it crashes and gives me this error:
----------------------------------------------------------------------------
Script 'Multi-slot script: Windows' line 107: No MethodError occurred.
undefined method 'visible=' for nil:NilClass
---------------------------------------------------------------------------

in the previously spoilered script, line 107 reads:

@item_windows[@right_window.index].visible = true

it sounded like the same type issue as the last question but it wasn't fixed by the same solution...
 
so, @item_windows[@right_window.index] is not a window, but it's equal to nil.

check if @right_window.index is in range of @item_windows

sorry for my bad english ^^
 
sorry to get back with a reply so late.

I know nothing about scripting/programming, I function more on the artistic side (I'm not so great with logic). I'm not sure what you mean by "in range of @item_windows

I still get the
----------------------------------------------------------------------------
Script 'Multi-slot script: Windows' line 107: No MethodError occurred.
undefined method 'visible=' for nil:NilClass

----------------------------------------------------------------------------
error though, I don't know how to fix this.
 
I think you could change the line 110 to:
Code:
@item_windows[i].visible = false rescue nil

and line 107 to:
Code:
@item_windows[@right_window.index].visible = true rescue nil
it's not a right answer, but your script will not crash
 
thanks for all your help Berka, I appreciate it; you're the only one who's helped and it gives me hope  =)

I replaced the code with what you gave me but I still get the exact same error. I think the problem lies in some kind of conflict between Guillame777's Multi-slot script and Theory's Greater Icons script, it's the only thing I can think of at this point. Unfortunately I know next to nothing about syntax and logic errors in programming  =(
 
Is this the whole script, or is there more? Reason I ask is that if I put this into a new game I get an error. If there is more and you can post it, I'd be happy to take a look at it and see what's wrong. If for some reason you can't, or my rmxp is just being strange, try putting it in a new game on your comp and see what happens.:)
 

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