Main Menu
  • Welcome to The RPG Maker Resource Kit.

Limited Inventory

Started by modern algebra, April 27, 2009, 10:11:22 PM

0 Members and 6 Guests are viewing this topic.

Mitsarugi

Quote from: modern algebra on January 07, 2011, 06:01:02 AM
Well, I gave you two solutions since I wasn't sure which you wanted from your request - one was if you wanted them to go to loot but not to open, while the other was if you wanted to immediately destroy the items and not go to loot at all. It sounds like you chose the first one instead of the second. Go back to the PM and test the second one.
okay i will thanks ^^

Mitsarugi

QuoteAnyway, I'm a little confused as to what you're asking. Do you want it to go to Loot but just not immediately open the loot window? Or do you want the item to be immediately destroyed?

If the former, a possible solution is as follows: no guarantees as I haven't looked at the script for a very long time and I forget how it was supposed to work, but try replacing line 1036:


            show_loot

with:

            @item_window.refresh ($game_party.limit_inventory)

If the latter, try replacing this whole section from lines 1026 - 1039:

          $game_temp.slots_to_discard.add_item (type, id, n)
          # Deactivate Command Window
          @command_window.active = false
          @command_window.index = -1
          @command_window.visible = false
          # Reactivate previous Window
          if @loot_window.visible
            @item_window.refresh ($game_party.limit_inventory, 1)
            @loot_window.refresh ($game_temp.slots_to_discard, 1)
          else
            show_loot
          end
          @item_window.active = true
          RPG::SE.new (Sound::MA_DISCARD_SE).play

with:


          RPG::SE.new (Sound::MA_DESTROY_SE).play
          @command_window.active = false
          @command_window.visible = false


Again, I don't remember the script well enough to know if those changes would break anything. I don't think they should, but you should try it out in a test project first
.

as you told me in your PM only the first solution works for me, the second freezes once you click on discard (destroy) the item.
the only problem now is that once closing the item window it asks me if i'm okay with discarding the items , i would like it not to show this question. thanks for the help so far it works like a charm :p

modern algebra

Well, instead of just:


          RPG::SE.new (Sound::MA_DESTROY_SE).play
          @command_window.active = false
          @command_window.visible = false


try making it:


          RPG::SE.new (Sound::MA_DESTROY_SE).play
          @command_window.active = false
          @command_window.visible = false
          @item_window.refresh ($game_party.limit_inventory, 1)
          @item_window.active = true


Like I said, I don't really remember this script very well and certainly don't feel like relearning it. Hopefully that will work fine.

Mitsarugi

Quote from: modern algebra on January 16, 2011, 06:28:33 PM
Well, instead of just replacing:


$game_temp.slots_to_discard.add_item (type, id, n)
          # Deactivate Command Window
          @command_window.active = false
          @command_window.index = -1
          @command_window.visible = false
          # Reactivate previous Window
          if @loot_window.visible
            @item_window.refresh ($game_party.limit_inventory, 1)
            @loot_window.refresh ($game_temp.slots_to_discard, 1)
          else
            show_loot
          end
          @item_window.active = true
          RPG::SE.new (Sound::MA_DISCARD_SE).play


with


          RPG::SE.new (Sound::MA_DESTROY_SE).play
          @command_window.active = false
          @command_window.visible = false


try making it:


          RPG::SE.new (Sound::MA_DESTROY_SE).play
          @command_window.active = false
          @command_window.visible = false
          @item_window.refresh ($game_party.limit_inventory, 1)
          @item_window.active = true


Like I said, I don't really remember this script very well and certainly don't feel like relearning it. Hopefully that will work fine.

yes that worked thanks Modern algebra, just one little thing

make it

RPG::SE.new (Sound::MA_DESTROY_SE).play
          @command_window.active = false
          @command_window.visible = false
          @item_window.refresh ($game_party.limit_inventory)
          @item_window.active = true


instead, you'll see why (it gives a little bug if you don"t )

thanks again :p

JiM83

I received this error when I obtained a Non-Discard item from a
chest while my inventory was already full. This happened in the
Limited Inventory 1.1 Demo. I'm not using any other scripts.

Script 'Limited Inventory 1.1c' line 480: NoMethodError occurred.
undefined method 'item_type' for nil:NilClass

Fizzly

#80
Quote from: JiM83 on January 22, 2011, 11:50:57 AM
I received this error when I obtained a Non-Discard item from a
chest while my inventory was already full. This happened in the
Limited Inventory 1.1 Demo. I'm not using any other scripts.

Script 'Limited Inventory 1.1c' line 480: NoMethodError occurred.
undefined method 'item_type' for nil:NilClass
Yup, checked this and you're right. <waiting for fixing this>  ::)

Hmmm, I wonder is it possible to had the free slots number in variable? Could you help, modern_algebra? :)
Regards,
Mike

Foghart

Its a good script to make the player build a strategy to fight a tough boss or a quest boss.
Congrats!

Infinate X

This is an awesome script but I was wondering if I could use the normal Items window with the limited Items features.

EXAMPLE:
-No dark blue rectangles
-Can not scroll down to empty slots

BTW i forget what I was gonna post here (after the BTW)


EDIT: Another thing I wonder if it is possible:
Can the loot be disabled without disabling the ability to discard items?

modern algebra

Well, you could remove the loot scene, but it would be reckless. What if the player's inventory was full and you wanted someone to give them a key item? Without a loot scene it would destroy the item.

As for getting rid of the blocks, I haven't worked with this script for a very long time so no guarantees, but you could try finding this in the refresh method of the Window_Item class (still inside the Limited Inventory script - I do not mean the default Window_Item class):


    @item_max = inventory.max_size == -1 ? @data.size : inventory.max_size
    create_contents
    # Calculate number of empty slots to draw
    empty_slots = (inventory.max_size == -1 || !$scene.is_a? (Scene_Item)) ? 0 : inventory.max_size - inventory.slots.size


and changing it to:


    @item_max = @data.size
    create_contents
    # Calculate number of empty slots to draw
    empty_slots = 0

rofl1337

Is there a way to specify items, that do not use up item slots?
I would love that feature.

modern algebra

There isn't, though that would be a good idea for the future.

rofl1337


rofl1337

#87
Double-Post-Bump, because I love this script.
I have another suggestion.
Could you add the option to "hide" items? You should still be able to check if there are present in the inventory, via events, but they don't show up in the
inventory screen.
I think there are a few possible uses for that.

Edit:
In the discard-window, the description box always displays the description of the last item in the inventory and not the one that is selected in the discard pile.
Is this a bug, or caused by this script conflicting with KGC_CategorizeItem?


IXFURU

Question about this script:

Is it possible, or would it be possible to use only one part of the script?

I need only the part which does the item stacking limitations. 

DRIACS system gives the ability to discard items, and it seems to be incompatible when the two scripts are running together.  So, if there was a way to limit via switch or some sort of boolean flag the parts of this script which do the same thing as DRIACS, just so I could use the stack-size limits that would be very beneficial.  Thanks.

Dimosthennis

I tried some stuff to fix this bug that I found but I can't fix it :(
When I open the Item Manu I get this error:

Script 'Limited Inventory 1.1b' line 851: ArgumentError occurred.
Wrong number of arguments(2 for 0)

I am useing YEMs scripts I removed YEMs Item Overhaul.
Anyway of fixing this? :/
MrD

digdarkevil


hiromu656

Is there any way to add inventory slots rather than change the amount of slots there are. For instance instead of acquiring a specific backpack ingame, you can find multiple pouches throughout the game that just add more slots to your total inventory space.

pacdiggity

s = $game_party.limit_inventory.slots.size
s += 6 # The amount you're adjusting the size by. This can be any operation (+, -, *, /)
# Then either:
$game_party.limit_inventory.resize(s)
# Or:
resize_inventory(s)
it's like a metaphor or something i don't know

hiromu656

There's no way I missed that...

Is that in the script? Or should I be adding that to it in some way?

pacdiggity

No, it's a command I whipped up just then. Use it in an event script call when you want to adjust the inventory. It should work, though I didn't test it.
it's like a metaphor or something i don't know

hiromu656

#95
Sounds good. Thanks a lot.

But... How exactly do I get this to work? Should I make this its own script? Or is that entire thing one script call.

pacdiggity

It's a script call you use when you want to adjust the inventory relative to what it already is.
Essentially, it's only three lines:
s = $game_party.limit_inventory.slots.size
s += 6 # Or whatever
resize_inventory(s)
it's like a metaphor or something i don't know

hiromu656

I used this:
s = $game_party.limit_inventory.slots.size
s += 6 # Or whatever
resize_inventory(5)

All it did was change the inventory size to 5.

Then I used:
s = $game_party.limit_inventory.slots.size
s += 6 # Or whatever
resize_inventory(s + 5)

And what that did was for some reason subtract 5 from the total size. So I tried using a minus sign instead, and that did the same as what my initial test had done.

;9

pacdiggity

Check the last line of my code. It's an s, not a 5.
it's like a metaphor or something i don't know

hiromu656

Sorry, this is an extremely late reply, but I only used 5 because I thought that s was just a placeholder for a number. But at first, I used the s as it is but still nothing beneficial happened.

What I did was create an event in which you get a new pouch, then I called the script, (copying what you typed). When I tested the event, it resized my inventory to 6. So it didn't add more spaces.