The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: Ahnez67 on February 03, 2011, 11:09:20 PM

Title: Inventory: Breaking Limits
Post by: Ahnez67 on February 03, 2011, 11:09:20 PM
Inventory: Breaking Limits
Version: 1.20
Author: Ahnez67
Date: 02.3.2011

Version History



Planned Future Versions


Description


This Script can change the default limit for Gold (default: 9999999). Itens, Weapons and Armour (Default: 99 each)

Features


Screenshots

(http://img84.imageshack.us/img84/8681/maea.png)

Instructions

Paste it above Main, but below the Default Scripts. Change the limits at lines 18,19, 20 and 21.
Line 22: That one changes the limit in Shops. If it's 99, then, you can only buy itens/armour/weaponry in shops up to 99.
And Done, it's ready to use.

You can change the limits with Script Calls:

AHNEZ67::BREAK::GOLDMAXB = new gold limit
AHNEZ67::BREAK::ITEMMAXB = new item limit
AHNEZ67::BREAK::WEAPONMAXB = new weapon limit
AHNEZ67::BREAK::ARMORMAXB = new armour limit
AHNEZ67::BREAK::SHOPMAXB = new shop limit

Script


Code: [Select]
#-----------------------------------------------------------------------
#---------------------AHNEZ67 INVENTORY BREAKING LIMITS----------------
#----------------------------------------------------------------------
#Place the Script above Main, but below the default Scripts#
#This Script can change the limit of Gold, Items, Weapons and Armour in the
#inventory-
#It's very easy to use, change the parameters (numbers in red) at lines 18 (Gold
#limit, 19 (Item Limit), 20 (Weapon Limit) and 21 (Armour Limit).
#The parameter in line 22, is the limit to buy in shops. if SHOPMAXB (line 22)
#is 99, means that you can only buy things in shops up to 99
##############################################################################
##############################################################################

#EDITABLE REGION#
module AHNEZ67
  module BREAK
   
    GOLDMAXB = 100000000  #Gold limit
    ITEMMAXB = 9999       #Item Limit
    WEAPONMAXB = 9999     #Weapon Limit
    ARMORMAXB = 9999      #Armour Limit
    SHOPMAXB = 9999       #Limit in Shops
  end
end
#EDITABLE REGION END#

class Game_Party < Game_Unit
  def gain_gold(n)
    @gold = [[@gold + n, 0].max, AHNEZ67::BREAK::GOLDMAXB].min
  end

  def gain_item(item, n, include_equip = false)
    number = item_number(item)
    case item
    when RPG::Item
      @items[item.id] = [[number + n, 0].max, AHNEZ67::BREAK::ITEMMAXB].min
    when RPG::Weapon
      @weapons[item.id] = [[number + n, 0].max, AHNEZ67::BREAK::WEAPONMAXB].min
    when RPG::Armor
      @armors[item.id] = [[number + n, 0].max, AHNEZ67::BREAK::ARMORMAXB].min
    end
    n += number
    if include_equip and n < 0
      for actor in members
        while n < 0 and actor.equips.include?(item)
          actor.discard_equip(item)
          n += 1
        end
      end
    end
  end
end

class Window_ShopBuy < Window_Selectable
  def initialize(x, y)
    super(x, y, 304, 304)
    @shop_goods = $game_temp.shop_goods
    refresh
    self.index = 0
  end
 
  def item
    return @data[self.index]
  end
 
  def refresh
    @data = []
    for goods_item in @shop_goods
      case goods_item[0]
      when 0
        item = $data_items[goods_item[1]]
      when 1
        item = $data_weapons[goods_item[1]]
      when 2
        item = $data_armors[goods_item[1]]
      end
      if item != nil
        @data.push(item)
      end
    end
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
 
  def draw_item(index)
    item = @data[index]
    number = $game_party.item_number(item)
    enabled = (item.price <= $game_party.gold and number < AHNEZ67::BREAK::SHOPMAXB)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    draw_item_name(item, rect.x, rect.y, enabled)
    rect.width -= 4
    self.contents.draw_text(rect, item.price, 2)
  end
  def update_help
    @help_window.set_text(item == nil ? "" : item.description)
  end
end

class Scene_Shop < Scene_Base
  def update_buy_selection
    @status_window.item = @buy_window.item
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      @help_window.set_text("")
      return
    end
    if Input.trigger?(Input::C)
      @item = @buy_window.item
      number = $game_party.item_number(@item)
      if @item == nil or @item.price > $game_party.gold or number == AHNEZ67::BREAK::SHOPMAXB
        Sound.play_buzzer
      else
        Sound.play_decision
        max = @item.price == 0 ? AHNEZ67::BREAK::SHOPMAXB : $game_party.gold / @item.price
        max = [max, AHNEZ67::BREAK::SHOPMAXB - number].min
        @buy_window.active = false
        @buy_window.visible = false
        @number_window.set(@item, max, @item.price)
        @number_window.active = true
        @number_window.visible = true
      end
    end
  end
end

Credit




Support


Post here if you encounter any problem with this script

Known Compatibility Issues

None know

Demo


There's no Demo version of this Script. It's not really necessary for such simple Script.

---------------------------------------------------------------------------------------
No credits needed. But it was made by me.
Commercial and non-Commercial games are all the same for me. You are free to use and edit it as you wish
Title: Re: Inventory: Breaking Limits
Post by: Grafikal on February 03, 2011, 11:11:30 PM
I assume you could use it to limit as well?

Code: [Select]
ARMORMAXB = 5       #Armour Limit

This? Or instead does it default to 99? Limiting would be a nice addition if it doesn't already.
Title: Re: Inventory: Breaking Limits
Post by: Ahnez67 on February 03, 2011, 11:13:17 PM
Yeah.

Even 1, 3, 5 works.

if you don't want it to change, simply use 99 as limit
Title: Re: Inventory: Breaking Limits
Post by: Grafikal on February 03, 2011, 11:20:25 PM
Very nice :)
Title: Re: Inventory: Breaking Limits
Post by: Ahnez67 on February 03, 2011, 11:23:06 PM
Thanks -   :D
Title: Re: Inventory: Breaking Limits
Post by: Ahnez67 on February 05, 2011, 03:14:14 AM
Version 1.2
----------------------------------

A minor bug Fixed
Now, limit of Item bought in Shops are customizable
Title: Re: Inventory: Breaking Limits
Post by: pacdiggity on February 05, 2011, 03:29:21 AM
I hate people having too much money in my games. I'm much too lazy to fix it myself, so this will help immensely! Thank you!
*Credited*
Title: Re: Inventory: Breaking Limits
Post by: Xearoth93z on July 22, 2011, 10:37:46 PM
Ive started using this script in my recent game, and I changed to weapon limit to 500 cause of ammunition reserves.  But when I found a different ammo script, I tried to change the limits back but they wouldnt change again.

Its like I had it like this:  AmmoNamex10

Then when I tried to change it, it did this:
AmmoName+
AmmoName+
AmmoName+

continuously through my inventory list.

Any help on how to fix this?
Title: Re: Inventory: Breaking Limits
Post by: Ahnez67 on July 22, 2011, 11:13:02 PM
Ive started using this script in my recent game, and I changed to weapon limit to 500 cause of ammunition reserves.  But when I found a different ammo script, I tried to change the limits back but they wouldnt change again.

Its like I had it like this:  AmmoNamex10

Then when I tried to change it, it did this:
AmmoName+
AmmoName+
AmmoName+

continuously through my inventory list.

Any help on how to fix this?

Are you using another Script that customize the Inventory?

...

Ahn... Put my script under your other Scripts. It should work
Title: Re: Inventory: Breaking Limits
Post by: Xearoth93z on July 24, 2011, 05:00:29 AM
Thanks i got it to work again. :3
Title: Re: Inventory: Breaking Limits
Post by: The Frontera on July 25, 2011, 12:37:39 PM
Can you change limits in game with a script call ?
This would be really useful for something like a bag system...
example:
Standard Gold Limit: 500
Than you find an item "Big Gold Bag"
You change with a script call the gold limit to 1000
And it looks like your bag has been "Upgraded" !
is this possible ?
If not, can you add it ?
Anyway, this is an awesome script ! Good job !  ;D
Title: Re: Inventory: Breaking Limits
Post by: Ahnez67 on July 25, 2011, 07:42:50 PM
Can you change limits in game with a script call ?
This would be really useful for something like a bag system...
example:
Standard Gold Limit: 500
Than you find an item "Big Gold Bag"
You change with a script call the gold limit to 1000
And it looks like your bag has been "Upgraded" !
is this possible ?
If not, can you add it ?
Anyway, this is an awesome script ! Good job !  ;D

Yes, you can change it with Script Calls:

AHNEZ67::BREAK::GOLDMAXB = new gold limit
AHNEZ67::BREAK::ITEMMAXB = new item limit
AHNEZ67::BREAK::WEAPONMAXB = new weapon limit
AHNEZ67::BREAK::ARMORMAXB = new armor limit
AHNEZ67::BREAK::SHOPMAXB = new shop limit
Title: Re: Inventory: Breaking Limits
Post by: The Frontera on July 26, 2011, 10:21:33 AM
Thanks !
I missed that part of the first post...
Now I'll use your script in my new game !
And even if are not necessary, I'll give you credits !
Again, Great Work !
Title: Re: Inventory: Breaking Limits
Post by: allen3v on November 06, 2014, 03:05:05 AM
i love this script! btw, is it possible to have multiple shopmax limits? like, the shopmax limit for items is 10 while the shopmax limit for weapons is 2?..