Defining an item

*For the main page about items, see Items.*
*For a description of how item effects work, see Item effects.*
*For adding, removing, counting and choosing items in the Bag, see Manipulating items.*
This page describes **how to define an item**.

## Defining an item

An item begins with its definition. This means that is is listed in the PBS file "items.txt", or a PBS file named "items\_XYZ.txt" (where "XYZ" is any text), so that it can be recognised by the game as an item. This alone does not give the item an effect, but you *must* start by defining it before you can use it.

This page only describes how to define an item. See the page Item effects to find out how to add effects to defined items.

## PBS file "items.txt"

The PBS file "items.txt" lists all the defined items in the game. Each section in this file is one separate item, where a section begins with a line containing an ID in square brackets and ends when the next section begins. Each line in a section is one separate piece of information about that item.

Aside from the ID line, every line in a section follows the format:

```
XXX = YYY

```

where XXX is a property and YYY is the value or values associated with it (the spaces are optional). For example:

```
[STARDUST]
Name = Stardust
NamePlural = Stardusts
PortionName = bag of Stardust
PortionNamePlural = bags of Stardust
Pocket = 1
Price = 3000
Flags = Fling_30
Description = Lovely, red-colored sand with a loose, silky feel. It can be sold at a high price to shops.
#-------------------------------
[POTION]
Name = Potion
NamePlural = Potions
Pocket = 2
Price = 200
FieldUse = OnPokemon
BattleUse = OnPokemon
Flags = Fling_30
Description = A spray-type medicine for treating wounds. It can be used to restore 20 HP to a single Pokémon.
#-------------------------------
[TM42]
Name = TM42
NamePlural = TM42s
Pocket = 4
Price = 3000
BPPrice = 32
FieldUse = TR
Flags = Fling_70
Move = FACADE
Description = This attack move doubles its power if the user is poisoned, burned, or paralyzed.
#-------------------------------
[TOWNMAP]
Name = Town Map
NamePlural = Town Maps
Pocket = 8
Price = 0
FieldUse = Direct
Flags = KeyItem
Description = A very convenient map that can be viewed anytime. It even shows your present location.

```

All pieces of information are optional, but will have default values if they are not defined. The order of the lines does not matter, except for the ID line in square brackets which must be first.

## Item icons

Each item has a single icon, which is located in the folder "Graphics/Items" and called "XXX.png", where "XXX" is the ID of that item.

If the icon for a machine item (a HM/TM/TR) does not exist, then it will instead try to use other icon(s):

* TM - Tries the icon named "machine\_XXX.png", where "XXX" is the ID of the type of the move it teaches, e.g. "machine\_FLYING.png".
* TR - Tries the icon named "machine\_tr\_XXX.png", where "XXX" is the ID of the type of the move it teaches, e.g. "machine\_tr\_FLYING.png". If this isn't found, it tries the icon that a TM would use, e.g. "machine\_FLYING.png".
* HM - Tries the icon named "machine\_hm\_XXX.png", where "XXX" is the ID of the type of the move it teaches, e.g. "machine\_hm\_FLYING.png". If this isn't found, it tries the icon that a TM would use, e.g. "machine\_FLYING.png".

The item icon can be any size, although 48x48 pixels is traditional.

An item's icon can be animated. For it to be animated, its graphic should contain a number of frames in a row, and each frame must be exactly 48x48 pixels in size. No matter how many frames there are in the graphic, one complete cycle will last 1 second, so having more frames means less time is spent showing each individual frame. Both of these values (48 pixels and time per cycle) are defined as constants in `class ItemIconSprite` and are easily changeable; note that they apply to all item icons.

Items can also have unique small icons for display in the party screen when they are held by a Pokémon. These are located in the folder "Graphics/UI/Party" and called "icon\_item\_XXX.png" (for non-mail items) or "icon\_mail\_XXX.png" (for mail items), where "XXX" is the ID of that item. If there isn't a unique icon for an item, it will use the default "icon\_item.png" or "icon\_mail.png" instead.

## Mail

In addition to the above, each Mail item also needs its own background picture. This picture is located in the folder "Graphics/UI/Mail" and called "mail\_XXX.png", where "XXX" is the ID of that item.

Mail background pictures should be the size of the game screen.