Essentials Docs Wiki

The Essentials wiki has moved and is now at: Essentials Engine wiki

This wiki will no longer be updated.

READ MORE

Essentials Docs Wiki
Advertisement
File:Bag (1).png

The Bag is the player's portable inventory, in which items are stored. It is accessible from the pause menu.

The Bag

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 a variable that remembers which item is registered for quick use, and some navigation-based variables.

There are several settings related to the Bag. These are:

#===============================================================================
# * The names of each pocket of the Bag. Leave the first entry blank.
# * The maximum number of slots per pocket (-1 means infinite number). Ignore
#      the first number (0).
# * The maximum number of items each slot in the Bag can hold.
# * Whether each pocket in turn auto-sorts itself by item ID number. Ignore the
#      first entry (the 0).
# * The pocket number containing all berries. Is opened when choosing one to
#      plant, and cannot view a different pocket while doing so.
#===============================================================================
def pbPocketNames; return ["",
   _INTL("Items"),
   _INTL("Medicine"),
   _INTL("Poké Balls"),
   _INTL("TMs & HMs"),
   _INTL("Berries"),
   _INTL("Mail"),
   _INTL("Battle Items"),
   _INTL("Key Items")
]; end
MAXPOCKETSIZE  = [0,-1,-1,-1,-1,-1,-1,-1,-1]
BAGMAXPERSLOT  = 99
POCKETAUTOSORT = [0,false,false,false,true,true,false,false,false]
BERRYPOCKET    = 5

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
Use
  • If the item can be used from the Bag (i.e. it has a UseFromBag or UseOnPokemon item handler).
  • If the item is a TM or a HM, and the player has at least 1 Pokémon.
Read
  • If the item is a Mail item.
Give
  • If the player has at least 1 Pokémon, and the item is not a Key Item or a HM (or infinite TM).
Toss
  • If the item is not a Key Item, a HM or an infinite use TM.
  • Always appears during Debug mode.
Register/Deselect
  • If the item can be registered (see below) and currently isn't, or if the item is currently registered, respectively.
Make Mystery Gift
  • Debug mode only. Creates a new Mystery Gift containing a definable quantity of the item.

The player can also swap the positions of two items in a pocket by selecting one of the items with the Z key and then the other with the C key. While an item is selected for moving, it will be shown in red.

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 allows it to be quickly used in the overworld by pressing the F5 key, without needing to open the Bag. Only one item can be registered at a time.

Only Key Items can be registered, and only if that item has a UseInField item handler (i.e. tickets and other plot coupons cannot be registered).

The ID of the registered item is stored in the variable $PokemonBag.registeredItem (it equals 0 if there is no registered item).

Displaying items

Key Items and HMs (and infinite 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 will only care whether there are 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.

Tips

  • 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).
Advertisement