Script Name: Inventory Limitations
Written by: Synthesize
Current Version: V.1.00
Release Date: August 13, 2007
What is it? Inventory Limitations is a simple script that aliases some Game_Party methods allowing the party to carry only a certain amount of items at a single time. In order to carry more items at one time the 'bag' must be upgraded, this is done by storing the Bag sizes into an Array and then calling the flag. As an example, if you use the default value size of 50 items, then you can carry 25 potions and say 25 high potions. Afterwards your inventory is full since 25+25 = 50. Oh and I indented it better then others, cookie please.
Future Plans: I plan on expanding the script once I get some more time, things I am planning include:
- Create Windows & a Scene
- Add more Designer customization
- Add more features
Screenshots I did not make any Window's or Scenes yet so that might be kind of tough at the moment...So instead of looking at screen shots, go eat some pizza.
DEMO http://www.megaupload.com/?d=YDMGAFTI Demo Script Version: 1.00
The Script Spoiler for :
#============================================================================ # *Syn's Item Limits* #---------------------------------------------------------------------------- # Written by Synthesize # Version 1.00 # August 13, 2007 # Tested with SDK 2.1 #============================================================================ =begin -=What is it?=- The purpose of this script is to allow Item Limitation, or in other words limit the number of items the party can carry at one time. By default, the party can carry 99 of every single item in the database. With this script the party can only carry 50 items (Default value) and every item in the database affects this number. As an example, say you have 25 potions and 25 High Potions, now your inventory is full and the party cannot collect more items. That is, unless you go out and buy a bigger bag. Bag sizes are stored in an Array and called on by a flag. So virtually, you can have as many items as you want, but you need a bigger bag to accomplish that. -=Future Additions=- - Make Custom Item Scene which displays Total Space and etc - Most likely add more features =end #---------------------------------------------------------------------------- # Compatiability #---------------------------------------------------------------------------- # Tested with SDK 2.1 # Tested with DerVVulfman's Grouping and Details # Aliases the following: # Game_Party::gain_item # Game_Party::gain_weapon # Game_Party::gain_armor # Game_Party::initialize # Scene_Equip::Main #--------------------------------------------------------------------------- # Begin Customization Section #--------------------------------------------------------------------------- module ItemLimits # Item Limit Options # Max_item_storage = {1 => 75, 2 => 100, 3 => 125} # Format {flag_id => new_size} # This defiens the default value of the amount of items to be stored. Max_item_storage.default = 50 end #--------------------------------------------------------------------------- # End Customization Section #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- # Begin Game Party Aliased Methods #--------------------------------------------------------------------------- class Game_Party attr_accessor :storage_flag attr_accessor :item_storage attr_accessor :item_count #--------------------------------------------------------------------------- # Aliased Methods # Game_Party::gain_item # Game_Party::gain_weapon # Game_Party::gain_armor # Game_Party::initialize #--------------------------------------------------------------------------- alias syn_gain_item gain_item alias syn_gain_weapon gain_weapon alias syn_gain_armor gain_armor alias syn_init initialize #--------------------------------------------------------------------------- # Initialize # Add additional variables #--------------------------------------------------------------------------- def initialize @item_count = 0 syn_init end #--------------------------------------------------------------------------- # Gain_Item # item_id = Target Item ID # n = amount of item_id which is being added #--------------------------------------------------------------------------- def gain_item(item_id,n) syn_gain_item(item_id,n) syn_item_limits(item_id, n,0) end #--------------------------------------------------------------------------- # Gain_Weapon # item_id = Target Item ID # n = amount of item_id which is being added #--------------------------------------------------------------------------- def gain_weapon(weapon_id,n) syn_gain_weapon(weapon_id,n) syn_item_limits(weapon_id, n,1) end #--------------------------------------------------------------------------- # Gain_Armor # item_id = Target Item ID # n = amount of item_id which is being added #--------------------------------------------------------------------------- def gain_armor(weapon_id,n) syn_gain_armor(weapon_id,n) syn_item_limits(weapon_id, n,2) end #--------------------------------------------------------------------------- # Syn Item Limits # item_id = Target Item ID # n = The amount of items to add # value = Type of Item being checked #--------------------------------------------------------------------------- def syn_item_limits(item_id, n, value) @item_storage = ItemLimits::Max_item_storage[@storage_flag] item_difference = @item_count + n leftover = item_difference - @item_storage case value # Item when 0 if item_difference > @item_storage @item_count = item_difference gain_item(item_id,-leftover) else @item_count = item_difference end # Weapon when 1 if item_difference > @item_storage @item_count = item_difference gain_weapon(item_id,-leftover) else @item_count = item_difference end # Armor when 2 if item_difference > @item_storage @item_count = item_difference gain_armor(item_id,-leftover) else @item_count = item_difference end end end end #--------------------------------------------------------------------------- # End Game_Party modification #-------------------------------------------------------------------------- # Begin Scene_Equip Alias #-------------------------------------------------------------------------- class Scene_Equip alias syn_equip_main main def main # Adds dummy pockets. Prevents items from erasing when unequipping. $game_party.item_storage += 4 syn_equip_main $game_party.item_storage -= 4 end end #----------------------------------------------------------------------------- #============================================================================= # Special Thanks: Northern49 for the General Idea # Tested with SDK 2.1 # May be incompatible with scripts that modify the mentioned aliased classes #----------------------------------------------------------------------------- # *Syn's Item Limits* #=============================================================================
Usage Usage:
This script may be used in either a commercial project or a free ware project free of charge. However, credit must be present somewhere in the project.
Editing/Distribution: Feel free to redistribute this post to other boards/websites. Just keep the wording the same. As for editing the script to suite your tastes feel free. Just keep the original header/footer in tact.
If you have any questions or you found a bug, please PM me or make a post with the following:
1.) SDK Version
2.) Other Scripts
3.) Factors of the bug (What did you do to make it happen?)
4.) version
5.) Error Line
Cheers,
Syn