Inventory Limitations

DraconisKnight

Villager
Member
Joined
Aug 17, 2017
Messages
27
Reaction score
15
First Language
English
Primarily Uses
RMMV
Draconis Inventory Limitations v1.2
by DraconisKnight
Introduction:
I made this plugin for my own project after finding other limited inventory plugins, such as the one by Mr. Trivel. I couldn't get how I wanted my inventory to work since I was wanting to use a variable and items to control my max limit.

With Inventory Limitations, you can use variables to limit and adjust the cap with usage of items. All it takes is setting your variables up and events that either increase or decrease the max limit.

Features:
- Limiting your party's inventory with $gameVariables
- Making it were a stack can equal a space with the Exempt note tag
  • Three options: Numerical, Mathematical, and $data
    • Numerical: <Exempt: 0> and <Exempt: 1>
      • <Exempt: 0> makes all items in that stack count towards the inventory cap.
      • <Exempt: 1> tells the plugin not to count that item. This one is best used on key items.
    • Mathematical: <Exempt: $gameVariables.value(i) -1>
      • $gameVariables.value(i) would equal the variable assigned to the number of that particular item the party has in possession. The minus one in the equation will deduce one item for the inventory count. The rest will be exempt.
    • $data
      • Added to the help file by Zarsla. They use data straight from the database. To use this option, use the following note tags as each will be for their respective category in your project database.
        • <Exempt: $gameParty.numItems($dataItems(i))> or <Exempt: $gameParty.numItems($dataItems(i)) - 1>
        • <Exempt: $gameParty.numItems($dataWeapons(i))> or <Exempt: $gameParty.numItems($dataWeapons(i)) - 1>
        • <Exempt: $gameParty.numItems($dataArmors(i))> or <Exempt: $gameParty.numItems($dataArmors(i)) - 1>

Note that will be the object's index your database. And use the square brackets around i.​






-Some customization to Scene Shop after adding inventory count to the status window. Inventory count can be set to show used space over the total space (inventory cap), only the remaining slots available, or the remaining slots available over the inventory cap.

- Script call: $gameParty.getInventUsedSpace (); => Returns the occupied space. Can be used in your events to see if the party can carry anymore new items/item stacks.

Setting up Inventory Limitations: (Added 6 March 2018)
Install Draconis_InventoryLimitations.js in your Plugin Manager. If you are using Yanfly's Item Core, make sure Inventory Limitations in under it.

Follow the help file with the parameters. The only one that does not need input is "Exempt".

On your first map, make a parallel process. All you need to do here is assign variables: one for the inventory cap (if using the variable method) and several more for the number of X items the party has. Those variables will be used in the math version of the Exempt note tag.

EX: 10x Potions
Event Page will have Control Variables: #001 Potions Exempt = Number of Potions

In the items tab of the database, select potion and enter <Exempt: $gameVariables.value(1)-1> .

Screenshots:
Attached.

Downloads:
Download plugin only here.
Download Demo Project here.

Terms of Use:
This plugin is free to use for both non-commercial and commercial use. All I ask is credit for using this plugin.

Also credit Zarsla as they added a new gain item function to the plugin.

Modifications are fine as long credit is given.

Thanks goes to:
-Mr. Trivel => Author of MrT_LimitedInventory as it started my coding journey.

-Yanfly => Whose plugins I picked apart and reverse engineered while also reading the core files.

-TheoAllen => Author of a weight based inventory that was also studied for version 1.1.

Compatible with:
-Yanfly Core Engine
-Yanfly's Item Core without Independent Items engaged.

Upcoming Features:
-A non-stacking inventory system with its own discard and discard confirm. [Current Project]

-A way for those using a static inventory cap to increase if they wish

-[Finished: April 2018 to January 2019] Discard works for all item categories with the exception of Key Items.

-[Finished: July 2019 to January 2020] A confirm window before the discard to help prevent accidental discarding.

-Layering windows because MV just overwriting it looks tacky. Purely for aesthetics.

-Possibly adding a speed option. Maybe after tinkering with the concept.

Note:
- I just noticed a small bug with if you are awarding one item (such as a potion), I'm already working on a fix. But it works fine if you award more one. (Resolved- Help file expanded on how to avoid this.)

-Item Limit Window refreshes after opening the item menu if using YEP_X_ItemDiscard. (Resolved between April 2018 to January 2018. The plugin now has its own discard function that YEP_X_ItemDiscard isn't needed. Within the discard function, this plugin updates the limit window automatically.)

-Any bought item (that exceeds the inventory limit) is automatically deleted. I still want to address this in the plugin, but after hitting the JS books and taking time to understand how the shop functions work. (Resolved April 2018 by overwriting the shop's isEnabled function.)

-A bug with <Exempt: 0> and the current gainItem function. Function currently discards an item stack if it exceeds the inventory cap. [Current Project]
Versions:
1.2-
Added a Discard Confirm for a stacking inventory system along with a command that gives the option to jump to Scene_Equip on weapons and armors. The option to change all new (current) windows for those wishing/planning to use a plugin that changes the scene's background.

1.1a- Fixed bug with Window_ShopBuy's isEnabled function. Also added a few customization options to Scene Shop.

1.1- Big update including:
  1. Added an action window with three commands: use, throw away, and cancel. Discard works with items only. [Completed April 2018]
-Fixed bug in the use command. Before it was enabled on all or disabled [Completed January 2019.]

-Made it were discard is disabled for all items that register as a 'Key Item'.

2. Overwrote the original Window_ShopBuy.prototype.isEnabled to update with inventory. [Completed April 2018]

-Meaning if the bag is full and the party doesn't have one of the items the vendor is selling, that item cannot be bought unless room is made.

1.0d - *Done by Zarsla* Thank you very much. They added a new gain item function to the plugin that doesn't require any checks. The plugin now automatically discards any items over the inventory cap as well as adding the new note tags to the help file. In addition, the party's gold can be included as a 'stack' in the inventory.

1.0c - Added script calls and one set of instructions for inventory checks. (Gaining new and size.)

1.0b - Figured out how to code the note tag for one item. Instructions have been edited and included an example on how to set up the variable.

1.0 - Released.
 

Attachments

Last edited:

kovak

Silverguard
Veteran
Joined
Apr 3, 2016
Messages
1,255
Reaction score
1,558
First Language
PT - EN
Primarily Uses
RMMV
A great addition for Dungeon Crawlers for sure :)
 

WesdrasLink

Veteran
Veteran
Joined
Jan 2, 2013
Messages
35
Reaction score
46
First Language
Portuguese
Primarily Uses
RMMV
This is awesome!
I was waiting for a plugin like this, thank you very much!
 

DraconisKnight

Villager
Member
Joined
Aug 17, 2017
Messages
27
Reaction score
15
First Language
English
Primarily Uses
RMMV
You're welcome. :)

If you have any questions, just let me know.
 

krain11

Villager
Member
Joined
Mar 24, 2017
Messages
11
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hi, I set a control variable for the max limit of the items on my first map. Then I put a note tag (<Exempt :0> or <Exempt: 1> to my items, weapons and equipments. However, I keep getting items and the limit is showing as 105/100.

Did I miss anything???
 

DraconisKnight

Villager
Member
Joined
Aug 17, 2017
Messages
27
Reaction score
15
First Language
English
Primarily Uses
RMMV
Are you wanting a stack to use an item space? That would require you to also assigned variables to the party's possession count for each item. Then, that variable can be used in the note tag.

As for going over the item limit, it would require some eventing. I think a condition branch would work. Now that I think about it, that would require a script call to be assigned to a variable... Which I didn't think about when I did this. I think the script call you will need is $gameParty.getInventUsedSpace .

Let me check tomorrow as I am away from my computer.
 

FiercestPixel

Veteran
Veteran
Joined
Jan 28, 2018
Messages
32
Reaction score
6
First Language
English
Primarily Uses
RMMV
Yes I'm having the same problem krain is having, what do we do about the player going over the item cap? AASCREENSHOT.png
 

Attachments

Last edited:

krain11

Villager
Member
Joined
Mar 24, 2017
Messages
11
Reaction score
0
First Language
English
Primarily Uses
RMMV
Are you wanting a stack to use an item space? That would require you to also assigned variables to the party's possession count for each item. Then, that variable can be used in the note tag.

As for going over the item limit, it would require some eventing. I think a condition branch would work. Now that I think about it, that would require a script call to be assigned to a variable... Which I didn't think about when I did this. I think the script call you will need is $gameParty.getInventUsedSpace .

Let me check tomorrow as I am away from my computer.
I only want to limit the items that my character can carry. I think I'll try limiting the possession count for each item for now.
 

DraconisKnight

Villager
Member
Joined
Aug 17, 2017
Messages
27
Reaction score
15
First Language
English
Primarily Uses
RMMV
@krain11 and @FiercestPixel
I follow. I'm still looking into a swap/discard seen in games like Monster Hunter and Legend of Dragoon, but I have at least found a solution for keeping the party from going over your limit.

It requires a check assigning a variable to $gameParty.getInventUsedSpace() and using a conditional branch before an event can process a treasure or shop process. I've updated the help file covering that in a little more detail.

@grubfisher Not at the moment. I may look into it in the future.
 

FiercestPixel

Veteran
Veteran
Joined
Jan 28, 2018
Messages
32
Reaction score
6
First Language
English
Primarily Uses
RMMV
@krain11 and @FiercestPixel
I follow. I'm still looking into a swap/discard seen in games like Monster Hunter and Legend of Dragoon, but I have at least found a solution for keeping the party from going over your limit.

It requires a check assigning a variable to $gameParty.getInventUsedSpace() and using a conditional branch before an event can process a treasure or shop process. I've updated the help file covering that in a little more detail.


The script worked perfectly in a conditional branch. Yeah, a discard function would take this plugin to the next level! You're awesome, thanks for the quick replies!
 

Blue Symphony

Wandering soul
Veteran
Joined
Jan 24, 2014
Messages
60
Reaction score
22
First Language
Spanish
Primarily Uses
RMMV
Thank you so much! This is exactly was I was looking for! :)
 

Jarcsme

Warper
Member
Joined
Sep 3, 2018
Messages
1
Reaction score
0
First Language
German
Primarily Uses
RMMV
At first: Thanks for the Plugin!
I'd like that my character starts to slow down when it's overcharging. As in The ElderScrollSkyrim V. I have chosen the method of variables and wanted to create a common event for this purpose. Someone an idea how to set such a common event up? (I hope my English is understandable..?) Thanks in advance!
 

DraconisKnight

Villager
Member
Joined
Aug 17, 2017
Messages
27
Reaction score
15
First Language
English
Primarily Uses
RMMV
@Blue Symphony and @Jarcsme You're welcome. I'm glad you like them. Now to ask your question, Jarcsme.

I believe that you can use a conditional branch using the script calls listed in the help file. If the $gameParty.getInventUsedSpace() is greater than $gameParty.getInventTotalSpace(), then change the actor's speed using Movement Route. I think that will work.

And for those waiting on a discard, I'm so sorry for the delay as I've been focused on my project. If memory serves me correctly, I got a discard to work, but I want to fine tune it as the item limit window updates after entering the Scene_Item after backing out when using YEP_X_ItemDiscard.
 

Zarsla

Veteran
Veteran
Joined
Jan 23, 2015
Messages
690
Reaction score
206
First Language
English
Primarily Uses
@DraconisKnight I made some edits to your plugin.
1. I made it so adding items would follow the item settings. Ie if your inventory is full, you can't gain items. This works both with events and code.
2. I added gold to the game, and made it something that can be apart of your inventory. Right now it's tied to a switch, though you can use other eval codes. Or just leave it blank if you don't want gold to be counted as apart of your inventory limit. You can still have as much gold as you want tho.
3.I add notetags in the help file. To do a stacking inventory. ie where you can have multiple versions of each item, and it's the number of unique items you want to take you space. Basically do this instead of the variable method.
Items:
<Exempt: ($gameParty.numItems($dataItems[x]) - 1)>

Weapons
<Exempt: ($gameParty.numItems($dataWeapons[x]) - 1)>


Armors:
<Exempt: ($gameParty.numItems($dataArmors[x]) - 1)>

Replace X with the id of the item, weapon or armor
Link.​
 

DraconisKnight

Villager
Member
Joined
Aug 17, 2017
Messages
27
Reaction score
15
First Language
English
Primarily Uses
RMMV
@Zarsla I can't thank you enough. I didn't think about overriding the original gainItem function. And the new one gainItem works like a charm in addition to the note tags you added. Using the new tags feels more streamlined compared to the variable method I started using in my own project months ago. So, thank you thank you. :)
 

Reptalia1994

Villager
Member
Joined
Nov 11, 2018
Messages
29
Reaction score
5
First Language
Spanish
Primarily Uses
RMMV
just this is what I was looking for, however I can not understand how it works ... could you or someone could upload a demo example .. both normal objects and ammunition as bullets or arrows ... sorry for my ignorance and my bad English xD
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Profile Posts

*Buys all the PVGames assets, ends up creating his own ground tiles.* At least I used the other types of graphics? Right? :kaoswt:
If you could fold a sheet of paper 42 times, the stack would reach from the earth to the moon. Do whatever you want with that information.
wishing that everyone stays safe at this time
Ami
4 days im not using my laptop to waiting someone to reinstall (sigh)
Stream will be live shortly with some Donkey Kong 64! Feel free to drop by!

Forum statistics

Threads
95,497
Messages
929,612
Members
125,747
Latest member
aliceinsh
Top