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 2 Guests are viewing this topic.

modern algebra

#25
Ugh, yeah. Thanks for reporting that. I hate it when I leave errors like that.

Replace @placements with @inventory.placements and it should be fine. It should look like this:


@inventory.placements.each { |slot| count -= (slot.rect.width*slot.rect.height) }


Though, are you still using 1.0 and not 1.0b? That line should be around 1987, not 1879.

Unless you deleted the header, which you absolutely should not do.


EDIT::

Script is now updated. It still says 1.0b but it shouldn't - it should be 1.0c since I updated the above line in the script. But I'm too lazy to release another version just to change the letter. Point is, if you got this script before I made this post, you will need to redownload the script.

Zero2008

Does that include me?
Did u make a change so big that it's worth changing or did u just fix it up and post the fixed script?
just wanna be safe LOL!

modern algebra

The only change I made is the one in my previous post. I changed @placements to @inventory.placements. If you do that manually then there is no reason to redownload the script.

Zero2008

Cool then. Okay now i have just one last suggestion for your script.
When you go and buy items the item just goes to the person that has a slot open.
What it should let you do is choose the person that u want to hold the newly bought item. And if the person has a full inventory then it should give u either a sound effect or give you a message telling you that the inventory is full.

What do you think?

i think it would be good cuz then you wont have to  sort through the items one by one deciding who will have what because they will have it from the start cuz u bought it for them.

modern algebra

It's not a bad idea, but I'd have to add things to Scene Shop, which would make it incompatible with a lot more scripts. It's not really worth the effort I don't think.

Maybe I will do it in the future, but not for a long long time if ever.

Zero2008

LOL! fair enough!
Still a great script though!
Again thanks i really needed it!

Zero2008

Um I have a question, i tried opening the storage box but i keep getting syntax errors.
Could i maybe get an example of how to do it?

modern algebra

#32
Do you get errors opening the storage box in the demo? The red and green chests are both examples of a storage box.

You can look at those events for examples on how to setup storage boxes.

In text, it's something like this:

potion = [0, 1, 4]
spear = [1, 3, 1]
shield = [2, 1, 1]
items = [potion, spear, shield]
open_storage (0, items, "Red Chest", 79)


But you have to make sure that none of the lines go over the limit and onto a new line.

The best way to do it is to not use such long names like potion, spear, etc... and instead use something like this:

a = [0, 1, 4]
b = [1, 3, 1]
c = [2, 1, 1]
items = [a,b,c]
name = "Red Chest"
open_storage (0, items, name, 79)

Zero2008

Umm...
Yeah im still a little confused.

I just want to make a big storage box where I can store or withdraw any item that was previously stored.
Could i get a code for that? i can't seem to figure out how to do that... ???

modern algebra


open_storage (0, [], "Chest", 79)



That's it. If you have other storage units, then you need to change the 0 to whatever index you want this storage chest to have.


Zero2008

Awesome now i can open it. Thanks, but i want the actor to be able to take his or her own items and add them to the storage unit. I tried the add to storage Script tage but it won't work for some reason, what code or codes do i need to do that.
Also is there a code that is able to increase the size of the storage unit?

modern algebra

You just scroll to an actor by pressing Q or W and once in those inventories, you can add to the inventory by clicking on an item and going down to store.

Shadowemokitty

Alright I just downloaded this, and pasted the script Into a blank map of my own (along with the other two scripts you said were needed/recommended). I created my own item, made an inventory folder just like on your game and put my item in there and had everything set up exactly as in your game as far as my item.

Now when I first start the game, If I open my inventory, everything is fine. If I try to open my inventory after I have placed my item in it, It gives me this error:

Script 'Grid Inventory' line 1837: RGSSError Occured
disposed bitmap

I checked line 1837 and it says  "contents.font.size = default_font_size"

What am I doing wrong?

Zero2008

Oh... i did not see that anywhere dude. Thanks!
But the Storage inventory is a tad bit too small. I tried the resize script call but its not working...
here is what i used:

resize_storage_inventory (0, 10, 10)

I don't understand why it doesn't work...
What did i do wrong?

modern algebra

#39
Is 0 the correct index for that storage unit?

NM, there was a mistake in the code. Go to about line 1053 and change:


   $game_system.open_storage (id).resize_grid (width, height)


to:


   $game_system.open_storage (storage_id).resize_grid (width, height)


Also, note that you could set the size directly when first opening a storage inventory by adding that to the call when the chest is first opened. SO:

open_storage (0, [], "Chest", 79, [10, 10])

Would make the storage unit 10x10

Also note that the number 79 is the icon for the chest. Chances are you don't want that icon though, so you should change it.

Zero2008

Wow thanks dude!
Also for me the line was 945 for those who can't find the line exactly!

thanks again man!

modern algebra

Did you delete the header of the script? It's 108 lines, which might explain why it's different. In any case, you really shouldn't do that. Put the header back in the script. It has all the instructions.

adamass

Hi there,
I decided to try you grid script since you told me (about limited inventory script) that this grod script was a bit like what I sought.
I tried it, loved it as suspected until I tested a fight.
I get an error wich maybe you could help me for.
Know that I use ziifee's wait gauge script, but oddly it never made any error occur with your limited inventory script.
The error message was Script 'Grid inventory 1.0' line 3201:noMethodError occured
undefined method 'inventory' for nil:nil Class

I know nothing in scripting at all, but I feel it might be easily repaired. Otherwise it seems I'll have to stick with the basic default inventory system (unless anyone manage to figure what's happenning or you repair the bug I mentioned earlier about your limited inventory script).


Yeah, I cannot discard ziifee's battle system it is quite nice indeed.

modern algebra

Hmm, well try putting the Grid Inventory Script below all other custom scripts you have (but still above Main) and see if that works.

adamass

Quote from: modern algebra on September 03, 2009, 03:15:49 PM
Hmm, well try putting the Grid Inventory Script below all other custom scripts you have (but still above Main) and see if that works.

Hmmm, same type of error. Unlike my previous test, I tried an actual ingame fight rather than a test from database. Error message is still linked to line 3202, but is related to ennemies it seems:

undefined method 'inventory' for #<game_ennemy:0x12b7070>

Maybe it helps to discover the origin of the error and a way to help me repair it?

modern algebra

Does ziifee's battle system allow enemies to use items? I think that is where the problem is originating from.

Around where the error is, you should see:


  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start Item Selection
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalr_invgrid_slctitm_windo_4h21 start_item_selection
  def start_item_selection (*args)
    # 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
  end


Replace it with:



  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Start Item Selection
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalr_invgrid_slctitm_windo_4h21 start_item_selection
  def start_item_selection (*args)
    # Run Original Method
    modalr_invgrid_slctitm_windo_4h21 (*args)
    return unless  ModernAlgebra::GI_PERSONAL_ITEM_USE || !@active_battler.actor?
    # Setup inventory
    @item_window.ma_inventory = @active_battler.inventory
    @item_window.refresh
  end


The only difference is that it checks if the active battler is an enemy or not and doesn't proceed if it isn't an actor.

Hopefully, that will resolve the issue. Tell me if it doesn't

adamass

Man I really hoped it would clear everything, but the same error occurs... ...well, strangely, sometimes it is about the same error message I last showed you and sometimes the first one (with the 'nil' word instead)

Dunno if Ziifee's script allows ennemies using items.

modern algebra

Can you give me the complete error messages. Like the last one and include the line number. Copy it completely.

adamass

#48
There you go (battle test from database VS succubus):

message 1:
Script 'Grid inventory 1.0' line 3202: NoMethod error occured
undefined method 'inventory' for #<Game_ennemy: 0x1327780>

message 2:
Script 'Grid inventory 1.0' line 3202: NoMethod error occured
undefined method 'inventory' for nil:NilClass

I am not too sure what affects what message is shown, but according to my tests, it seems it depends if the ennemy is attacking/acting or not before I select the inventory command. Not sure tho...




adamass

Why, you know I'd send you ziifee's demo so that you could check upon it if you desire so, but I ain't sure it's a good Idea to post it here. Maybe that would help you in your search for a solution  :-\