Main Menu
  • Welcome to The RPG Maker Resource Kit.

Grid Inventory 1.0f

Started by modern algebra, July 31, 2009, 06:32:22 AM

0 Members and 1 Guest are viewing this topic.

quigonkeichy

Apologies for the necro/ressurection, but is there any way to make this compatible with YEM? The only problem I've ran into is that I can't use the '  GI_PERSONAL_ITEM_USE' function which was what I was really wanting. Whenever I try to select items in battle I get an error on line 3215, with 'undefined method 'inventory''.

Apologies for the necro again.

modern algebra

Well, which script or scripts in YEM specifically conflict? I don't think I'm up for making it compatible with 60+ scripts.

Also, have you tried switching the order (ie. putting this script below the problematice YEM scripts in the Script Editor)?

Additionally, what is the specific error? Tell me verbatim.

quigonkeichy

The error's coming from line 3215 in the inventory grid script. Whenever I try to go into the item menu, I get:

Script 'Grid Inventory 1.0e' line 3215: NoMethodError occurred.

Undefined method 'inventory' for nil:NilClass

This is with this script placed underneath the five main BEM scripts. When it's above that you can go into the item menu fine, so I assume it's those ones which are being problematic.

modern algebra

Well, I don't have time to learn BEM and figure out what it's up to, but on a very cursory look, try going to lines 3211-3216 and replace this:


    # Run Original Method
    modalr_invgrid_slctitm_windo_4h21 (*args)
    return unless  ModernAlgebra::GI_PERSONAL_ITEM_USE
    # Setup inventory
    @item_window.ma_inventory = @active_battler.inventory
    @item_window.refresh


with the following:



    # Run Original Method
    modalr_invgrid_slctitm_windo_4h21 (*args)
    return unless  ModernAlgebra::GI_PERSONAL_ITEM_USE
    # Setup inventory
    @item_window.ma_inventory = @selected_battler.inventory if @selected_battler
    @item_window.refresh


That might not fix the problem and it might not be the only problem between the scripts, but if the errors are more widespread then that then I am sorry, but I probably won't be able to write a compatibility patch at this time.

quigonkeichy


Duende

#130
Sorry for necro-posting.

Hello, in first place, thanks you very much for this incredible script. :)

These days I've been working with this script.

I'm trying to pass it to RPG Maker VX Ace, and also make some changes. I want each grid is sixteen grids. That is, in your example a Ring is a imagen of 32x32 and this occupies a grid. I want that ring holding one of those mini grids and have a imagen of 8x8, so that I can get 16 rings in a grid, and while the selection and movement square is a grid (16 mini grids) and objects like a shield continue have 2x4 grids and imagen of 64x128. Something like this:



Could you guide me a little to know what parts of the script should be modified to make those changes?

I do not know if I have explained well, my English sucks.

modern algebra

The method that draws the grid is just the refresh method of Window_InventoryGrid:



  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Refresh
  #    width  : the width of the current inventory
  #    height : the height of the current inventory
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def refresh (inventory)
    self.contents.clear
    width = inventory.grid.xsize
    height = inventory.grid.ysize
    colour = Color.new (*ModernAlgebra::GI_GRID_COLOUR)
    # Calculate the scaling factor:
    scaling_factor = [(contents.width - 2) / width.to_f, (contents.height - 2) / height.to_f].min / 32.0
    scaling_factor = 1 if scaling_factor > 1
    multiplier = (32*scaling_factor).to_i
    # Centre the grid
    x = ((contents.width - (width*multiplier)) / 2)
    y = ((contents.height - (height*multiplier)) / 2)
    # Draw vertical lines
    for i in 0...width + 1
      self.contents.fill_rect (x + i*multiplier, y, 2, height*multiplier, colour)
    end
    # Draw horizontal lines
    for i in 0...height + 1
      self.contents.fill_rect (x, y + i*multiplier, width*multiplier + 2, 2, colour)
    end
    return self.x + 16 + x, self.y + 16 + y, scaling_factor
  end

Duende

Thank you, I saw it after sending you PM.

I'm gradually translating script to VX Ace and also make the change I mentioned in the post above. I managed to draw the grid and add the cursor movement.



Where in the code become the cursor in a rectangle?

modern algebra

It's done in the update_cursor method of Window_InventoryCursor.

Maybe you should start with a script that's a little simpler. This is an old script with which I am no longer familiar. I will not be able to walk you through everything, and it might be better for you to get a little more experience before tackling this script.

Duende

Thanks for your help, modern algebra. I decided to start almost from zero, and use your inventory system like reference.

modern algebra

That's a good idea. Good luck!

Duende

#136
Hi again, modern algebra.

I'm having problems with the items. How did you create unique items?

Edit: Ok, I saw this: http://rmrk.net/index.php/topic,47427.0.html

modern algebra

Sorry I haven't been around to answer your questions. I've been lazy. Anyway, the unique items in this script aren't actually unique and don't rely on the Item Instances Base. It was just a graphical thing, where a new slot would be created whenever the items exceeded the maximum permitted in a group.

Watfordj

are you going to port this script to ace?

&&&&&&&&&&&&&

&&&&&&&&&&&&&&&&

mirage

I'm so sorry for necroposting, but the item description can't show variables as it used to after I put in your script.
Can you fix that, please?
(Sorry if my English isn't good)