The Bag is accessible via the variable
$PokemonBag, which is an instance of
class PokemonBag (created with the code
$PokemonBag = PokemonBag.new). It contains arrays representing the Bag's pockets, as well as an array that remembers which items are registered for quick use in the Ready menu, and some navigation-based variables.
There are several settings related to the Bag. These are:
# The names of each pocket of the Bag. Ignore the first entry (""). def self.bag_pocket_names return ["", _INTL("Items"), _INTL("Medicine"), _INTL("Poké Balls"), _INTL("TMs & HMs"), _INTL("Berries"), _INTL("Mail"), _INTL("Battle Items"), _INTL("Key Items") ] end # The maximum number of slots per pocket (-1 means infinite number). Ignore # the first number (0). BAG_MAX_POCKET_SIZE = [0, -1, -1, -1, -1, -1, -1, -1, -1] # The maximum number of items each slot in the Bag can hold. BAG_MAX_PER_SLOT = 999 # Whether each pocket in turn auto-sorts itself by item ID number. Ignore the # first entry (the 0). BAG_POCKET_AUTO_SORT = [0, false, false, false, true, true, false, false, false]
What you can do with an item
The things you can do with an item depend on what item it is.
|Action||When it is available|
|Make Mystery Gift|
The player can also rearrange items in a pocket by selecting one and pressing the Z key. The item name turns red and the cursor changes, and it can then be moved around with the up/down keys. Pressing the Z key again returns the cursor to normal and leaves the item in its new position, while pressing the X key cancels the move.
A pocket which has been set to auto-sort itself will not let the player manually rearrange its contents.
Registering an item
Registering an item makes it show up in the Ready menu, accessible from the overworld by pressing the D key. There is no limit to how many items can be registered at once. An item remains registered even if the player consumes it; if the player gains more of that item later, it will automatically reappear in the Ready menu. Unregistering an item can only be done in the Bag.
Any item with a UseInField item handler can be registered. This includes several Key Items such as the Bicycle and Super Rod, and also includes consumable items like Honey, Repel and Escape Rope.
The list of currently registered items is stored in the array
@registeredItems. This is not an inventory in and of itself; remember that an item can be registered even while the player doesn't have it.
Key Items, HMs and TMs don't have their quantities shown, because it is assumed that the player will only ever own one of each of these items. Despite this, they still have quantities just like any other item. Their quantities should have no bearing on the game, as checking for the presence of one of these items (with
$PokemonBag.pbHasItem?(:BICYCLE)) will only care whether there is more than 0 of them in the Bag. Even so, for the sake of neatness and logic, you should try to make sure the player is never given multiples of the same Key Item/HM/TM.
- The Items pocket notoriously contains a lot of items compared to the other pockets, with potentially over 200 different items that go in it. Why not split this pocket's items up into others?
- The most obvious solution is to move all the held items into their own pocket. If you want to keep the same number of pockets overall, then the Held Items pocket could replace the Mail pocket. The mail items would be moved into the Items pocket (if indeed you have mail in your game).