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
> Item Quantity
drei7717
post Jun 26 2011, 05:26 PM
Post #1


Level 4
Group Icon

Group: Member
Posts: 48
Type: Writer
RM Skill: Intermediate




Wear in the script database I can change the amount of items i can hold? for example
the amount of different type of items you can hold is 10 but the amount of that one item you can hold is 6
Go to the top of the page
 
+Quote Post
   
Redd
post Jun 27 2011, 02:05 PM
Post #2


:<
Group Icon

Group: Revolutionary
Posts: 2,314
Type: Developer
RM Skill: Advanced




Moving to RGSS Script Support, since this has to do with scripts.


__________________________
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Jun 27 2011, 10:52 PM
Post #3


Level 50
Group Icon

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




Something like this?

Night_Runner's Item Limiting Script
CODE
#==============================================================================
# ** Night_Runner's Item Limiting Script.
#------------------------------------------------------------------------------
# History:
#  Date Created: 28/Jun/11
#  Created for: drei7717
#   @> http://www.rpgrevolution.com/forums/index.php?showtopic=51186
#
# Description:
#  This script is designed to limit the maximum number of an individual item,
#   and the number of different items available in the party
#
# How to Install:
#  Copy this entire script. In your game, along the top select Tools >>
#   Script Editor. Along the left, scroll all the way down to the bottom,
#   right click on 'Main', and select 'Insert'. Paste this code in the
#   blank window on the right.
#
# Customization:
#  Line 49 defines the maximum number of an individual item can be held
#   (by default, 10).
#  Line 58 defines the maximum number of different items can be held
#   (by default, 6).
#==============================================================================



#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
#  Edited to limit the number of items available, and the number of different
#  items available
#==============================================================================

class Game_Party
  #--------------------------------------------------------------------------
  # * Alias Methods
  #--------------------------------------------------------------------------
  alias nr_itemLimiter_gain_item  gain_item  unless $@
  #--------------------------------------------------------------------------
  # * Gain Items (or lose)
  #     item_id : item ID
  #     n       : quantity
  #--------------------------------------------------------------------------
  def gain_item(item_id, n)
    # Limit the gain to there can only be a maximum of 10 of this item in
    #  the party
    n = [ 10 - item_number(item_id), n ].min
    # Get a variable to store the number of items
    num_different_items = 0
    # Loop through every item
    for id in 1...$data_items.size
      # Increment the number of different items if this item is in the party
      num_different_items += 1 if item_number(id) > 0
    end
    # If there are less than 6 different items in the party
    if num_different_items < 6
      # Run the original gain_item
      nr_itemLimiter_gain_item(item_id, n)
    end
  end
end



#==============================================================================
# ** End of Script.
#==============================================================================


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
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 - 07:42 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker