Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Inventory Limits
Ty
post Aug 14 2007, 12:33 AM
Post #1


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




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

CODE
#============================================================================
#                            *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


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
jens009
post Aug 14 2007, 02:12 PM
Post #2


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




Hey Syn, Nice script you have here.

I'll just throw some ideas at you just for future updates you may want to do =D

-Maybe enable the script so that it can apply for every actor?

--Each actor has a separate inventory limit.

--Each actor carry their own inventory.

--Inventories have different weights therefore there is a weight limit for every actor/whole party.

Just some ideas you may want to put for future updates of this script.


Nevertheless, nice script Syn!


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
Ty
post Aug 15 2007, 01:09 PM
Post #3


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




QUOTE (jens009 @ Aug 14 2007, 02:12 PM) *
Hey Syn, Nice script you have here.

I'll just throw some ideas at you just for future updates you may want to do =D

-Maybe enable the script so that it can apply for every actor?

--Each actor has a separate inventory limit.

--Each actor carry their own inventory.

--Inventories have different weights therefore there is a weight limit for every actor/whole party.

Just some ideas you may want to put for future updates of this script.


Nevertheless, nice script Syn!


1- Should already work with Trickster's Multiple inventories, may have to do a wee bit of editing.

2- Same as one, just have to do some editing

3- I think I saw a script on CA, may be compatible

4- somethings I was planning in the future.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
Roderick
post Aug 20 2007, 02:59 AM
Post #4


Level 4
Group Icon

Group: Member
Posts: 47
Type: None
RM Skill: Undisclosed




Is it possible to make the items count as 1 not if you have 25 potions you have 25 weight already?
Go to the top of the page
 
+Quote Post
   
Ty
post Aug 21 2007, 11:49 AM
Post #5


Level 38
Group Icon

Group: +Gold Member
Posts: 1,007
Type: Scripter
RM Skill: Undisclosed




Yes, if you do a few mods.

All you would do is add an IF branch before this:
CODE
# 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


to check if the Item being added is a defined item in the customization, if it is then you skip the weight check. So basically, make a new array in the customization section and add an IF branch that is similar in style to the ones I have checking if the item capacity is used up. Then when the item_id is = a defined value in the array skip the check and add as many of that one item as you want, since they will all count as one.


__________________________
My Script Demo link broken? Looking for old scripts? Go here:
http://synthesize.4shared.com
Go to the top of the page
 
+Quote Post
   
Roderick
post Aug 21 2007, 11:02 PM
Post #6


Level 4
Group Icon

Group: Member
Posts: 47
Type: None
RM Skill: Undisclosed




Sorry but i don't know how to script and such so could you tell me what i need to put above the part you posted.
Go to the top of the page
 
+Quote Post
   
Zambaku
post Jul 18 2008, 03:57 AM
Post #7


Level 6
Group Icon

Group: Member
Posts: 78
Type: Artist
RM Skill: Skilled




Is it possible to make a message appear that says that the inventory is full and then you get to choose whitch item to drop: Something in the inventory or the new found item.
Go to the top of the page
 
+Quote Post
   
blakerowe
post Jul 23 2008, 10:10 PM
Post #8


Level 3
Group Icon

Group: Member
Posts: 40
Type: Developer
RM Skill: Masterful




The script is really good. I have used it on 2 of the games i have made. Now if only i could come up with a banking system that would be kool


__________________________
*working*
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 06:04 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker