Read more about advertising your project here
Limited Inventory

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 95
2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
Limited Inventory
Version: 1.1c
Author: modern algebra
Date: September 27, 2009

Version History


  • <Version 1.1c> 09.27.2009 - Fixed a bug that freezes user input when using an item with scope set to None.
  • <Version 1.1b> 09.20.2009 - Fixed a hash updating bug that did not recognize items gained and discarded through loot as having been gained or discarded.
  • <Version 1.1> 08.19.2009 - Fixed some bugs, including some discardability problems and an improper scaling effect with empty slots
  • <Version 1.0b> 04.27.2009 - Fixed a bug with equipping something into an empty slot.
  • <Version 1.0> 04.27.2009 - Original Release

Description


Essentially, this allows you to limit the number of items a party can carry. Rather than being able to hold 99 of all items, this script divides inventory space into a limited number of slots, each of which can hold a single item type, and for which you can set a maximum stack size. So, for instance, if you have 6 potions, and the maximum stack size for potions is 5, then potions will take up two slots in the inventory, one with 5 in it and the other with only 1. This script allows you to change the number of slots in the inventory in-game with ease, as well. It allows you to discard items easily (and set items as non-discardable), and if there is ever a time in which you get more items than you have space for, it will call a loot screen so you can choose which items to discard.

Features

  • Limited Slot-based Inventory system
  • Can change the number of slots at any time during the game.
  • Can set a maximum stack size for each type of item individually
  • Can set an item to be undiscardable
  • Lots of customizability, even to what words represent what things in the inventory
  • Will automatically call a loot scene any time the party has too many items, so that the player can choose what to discard

Screenshots





Instructions

Quote from: Header
Place this script above Main and below other custom scripts.

To set a number of the default conditions for this script, please see the Editable Regions at 53, 84, and 109. Be sure to read the comments next to each consant to see what it does.

To set an item as non-discardable, put this command into its note box:

Code: [Select]
    \NONDISCARD

To set an item to have a stack size different from the default, use this command in its note box:

Code: [Select]
    \STACKMAX[x]

where x is and integer and the new maximum stack size for that item.

To resize the party inventory in-game, say after an event where the get a new backpack or whatever, then all you need to do is put this code into a call script:

    
Code: [Select]
resize_inventory (x)
 
where x is an integer and the new number of slots in the party inventory.

Script


It is a large script. Please see the text document or retrieve the script from the demo. They are both attached at the bottom of this post.

Credit


  • modern algebra

Thanks

  • grafikal009, for the request
  • Fizzly, for major bug reports
  • Celianna, for a bug report

Support


With such a large script, there are bound to be bugs. Please post in this topic at rmrk.net for swiftest support, and be as detailed as possible.

Known Compatibility Issues

No known compatibility issues, yet. But anything that heavily modifies Scene_Item or Window_Item would likely be incompatible.

Demo


Limited Inventory 1.1b Demo


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: February 11, 2010, 09:37:29 PM by Modern Algebra »

********
Resource Artist
Rep:
Level 92
\\\\\
Project of the Month winner for June 2009

**
Rep: +0/-0Level 81
That one guy in that one place.
lol, modern... I got so used to seeing the other avatar and sig that when I saw on the other post you had finished, I was like... Who the hell?

Anyway, thanks for making this, I had thought about a limited inventory before, but as I think I somewhat said in the other post I had found the request already.

This'll be a nice addition to my game.

and, for this, I love you in a purely professional way.

Edit: Found a bug :D, if you go into your equip screen and attempt to equip an empty slot anything (I think) it pops up with
Quote
"line465: NoMethodError occurred. undefined method 'ma_discardable?' for nil:NilClass"
It unequips fine, Its just equipping something into an empty slot, as equipping into an already filled slot works as well. So basically, if you try to equip something into an empty slot it'll result in that error.
« Last Edit: April 28, 2009, 01:16:58 AM by mortigneous »
Hmm.... rm2k isn't compatible with vista? Looks like I'll go to rmvx... Scripting?
Oh sweet, I get to add new stuff! OH DEAR GOD! *head explodes*
CLICKY!
MyMiniCity

*
Rep:
Level 95
2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
Thanks for catching that.

To fix it, replace that line with:

Code: [Select]
      if item != nil && !item.ma_discardable?

EDIT::

Actually, that's not entirely true. That will fix the syntax error, but could potentially cause other problems in the script. Just get the script from the new demo or the new text file that I just uploaded, as that has the complete fix in it.
« Last Edit: April 28, 2009, 01:57:22 AM by modern algebra »

**
Rep: +0/-0Level 81
That one guy in that one place.
Also, would it be possible for you to make this script so that it has an option for something like the non-discardable items, but have them called key items, in a different page, but have up, say, above the help box have something like, Items, or inventory or something, then, beside that something like key items, then selecting key items brings you to a different menu that would basically just be an inventory for key items that wouldn't take up the players inventory space? I know that's long and probably has a lot of errors with grammar, but I'm kinda tired and changed where I was going with it a couple of times... (just ignore that random mess, unless you feel like you absolutely must read it... the lower description is better by far.)

Anyway, picture!

-Sorry about it being an off-site picture, I was having some odd issues with attaching.... (This site doesn't show any recognition of it being attached? Too used to RRR lol) but I hope that explains what I mean (basically just if you label an item as a 'key item' some way [possibly an item note?] it goes under Key items, and does not take up space in the inventory whatsoever. This way your not filling up your players' inventories with a bunch of useless crap that are basically just trophies that serve no purpose other than giving players that reminiscent feeling of that one very special quest.
« Last Edit: April 28, 2009, 02:53:31 AM by mortigneous »
Hmm.... rm2k isn't compatible with vista? Looks like I'll go to rmvx... Scripting?
Oh sweet, I get to add new stuff! OH DEAR GOD! *head explodes*
CLICKY!
MyMiniCity

*
Rep:
Level 95
2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
I might add that later. How do you want ot be able to switch over to Key Items?

**
Rep: +0/-0Level 81
That one guy in that one place.
not entirely sure on this, but I guess something where you have it to where you select item in the game menu, and it goes into the inventory, you hit the cancel button (esc?) and it moves the selection up to inventory and key items, and there you can select either one. Or if you have another way that's easier to script that's fine as well :D

I'm going to sleep pretty much right after I post this, but I'll check it tomorrow when I get home and see if you have questions/specifications.
Hmm.... rm2k isn't compatible with vista? Looks like I'll go to rmvx... Scripting?
Oh sweet, I get to add new stuff! OH DEAR GOD! *head explodes*
CLICKY!
MyMiniCity

**
Rep: +0/-0Level 81
That one guy in that one place.
I just now noticed something, when you are able to scroll down, it doesn't show the cursor at the bottom that basically says 'Hey! there's more!' it just shows the one up at the top. (see attached)

Also, how's the key items thing going? :P
Hmm.... rm2k isn't compatible with vista? Looks like I'll go to rmvx... Scripting?
Oh sweet, I get to add new stuff! OH DEAR GOD! *head explodes*
CLICKY!
MyMiniCity

*
Rep:
Level 95
2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
Yeah, it would show the cursor if you actually had items down there and not just empty slots. I've noted the concern though and will add it when I look at this script again. I haven't started working on the Key Items thing, and to be honest, it's pretty low in my queue.

**
Rep:
Level 82
Edit: Never mind.... LOL :-\


Nice script Algebra!
Its very usefull. You think you can do the same but making every actor in ones party have their own inventory or something?
« Last Edit: May 23, 2009, 03:19:25 AM by Zero2008 »

***
Rep:
Level 87
Thanks, it's really nice! But I found a bug: even if an item is non-discardable, the "discard" option is faded to gray, but it's still active and you can select this -> item goes to the Loot... Can you fix this? ^ ^;
Regards,
Mike

*
Rep:
Level 95
2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
Hmm, you're right. Around line 1011, change this:

Code: [Select]
         slot = @item_window.ma_grfkl_lim_nvtry_item_8rn
          type, id, n = slot.item_type, slot.item_id, slot.amount

Replace it with:

Code: [Select]
         slot = @item_window.ma_grfkl_lim_nvtry_item_8rn
          unless slot.item.ma_discardable?
            Sound.play_buzzer
            return
          end
          type, id, n = slot.item_type, slot.item_id, slot.amount

That ought to fix it.
« Last Edit: August 14, 2009, 11:20:20 PM by modern algebra »

***
Rep:
Level 87
Yup, it's working fine right now. ^^ Thank you!
Regards,
Mike

*
Rep:
Level 95
2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
Good to hear. Tell me if you encounter any other problems.

***
Rep:
Level 87
Hmm, I think there is one more. But not sure if I can call this a bug or glith. Anyway, if you change default amount of items in script for more than (default) one, they just can't group together. I mean, I've got for example 3x apples, and they are in inventory as: apple, apple and apple. When I'll get another two one, I have: apple, apple, apple, apple x2. Shouldn't they be as: apple x5?  ;) If you can fix this, would be great. =)

EDIT: And another one! ^^; This should be fixed for sure:
There is non-discardable item in inventory. I want to throw away some stuff (discardable) to make space for new one. When I'll use "Change" option, from Loot window, I can change discardable stuff (from Loot) with non-discardable one (from the inventory). So in fact, I can use a trick to throw something really important... ^^; <LOST MY KEYYY!! T_T>
« Last Edit: August 15, 2009, 01:23:45 AM by Fizzly »
Regards,
Mike

*
Rep:
Level 95
2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
I'll look into those bugs. They definitely shouldn't be happening.

***
Rep:
Level 87
Bump? =p

Anyway, modern algebra, can I have a little request about that script? I thin kthat would be pretty useful for others too. I mean:
Weapons can be "clickable" too, but instead of inactive "Use" option, they'll be "Equip" option. Same could be with armors and shields. :) That would be really great.
Regards,
Mike

*
Rep:
Level 95
2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
Then I'd have to introduce a targetting window, as well as an equip window to show what is being replaced and a stats window to show the difference in stats. Further, it's make the Equip scene useless, meaning that anyone wanting to use it would probably want to get rid of it, which is even more :( Also, any scenes which are so extensive would mean that anybody who has a nice custom Equip scene probably wouldn't want this script.

It's a nice idea, but it's a lot more trouble than it's worth. I'd rather not.

I will look into those errors though. Sorry for the time, but I've been busy.

***
Rep:
Level 87
No problem, and thanks. Still waiting for fixes, by the way.  ;)
Regards,
Mike

*
Rep:
Level 95
2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
Updated to 1.1. Those bugs should be fixed now.

It does tell me that grafikal hasn't been using the script he requested though :P I should be upset with him >: (

********
Resource Artist
Rep:
Level 92
\\\\\
Project of the Month winner for June 2009
Haha, I was using it for a while, but never got around to extensively testing it since I didn't progress enough in the game to use the inventory a whole lot .______.

*
Rep:
Level 95
2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
 ;D

Also, @mortigenous - the new version does show the white arrow when there are more spaces down

***
Rep:
Level 87
Now it works just perfect!! Thanks, modern algebra.  ;)
Regards,
Mike

********
Resource Artist
Rep:
Level 92
\\\\\
Project of the Month winner for June 2009
Bump? =p

Anyway, modern algebra, can I have a little request about that script? I thin kthat would be pretty useful for others too. I mean:
Weapons can be "clickable" too, but instead of inactive "Use" option, they'll be "Equip" option. Same could be with armors and shields. :) That would be really great.

Curious if that was implemented? That sounds really convenient O_O

*
Rep:
Level 95
2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
No, I decided against it. It's not a bad idea but it's a lot of work:

Then I'd have to introduce  an equip window to show what is being replaced and a stats window to show the difference in stats. Further, it'd make the Equip scene useless, meaning that anyone wanting to use it would probably want to get rid of it, which is even more :( Also, any scenes which are so extensive would mean that anybody who has a nice custom Equip scene probably wouldn't want this script.

Maybe one day. Lots of other scripts to fix before that though.