FANDOM


This article describes how Pokémon work in-game, including how individual Pokémon are defined and other general information relating to them.

See also

Defining a species

  • For how a Pokémon species is defined. This is different to defining individual Pokémon in-game, which is what this article is about.

Editing a Pokémon

  • For how to change something about a particular Pokémon.

Manipulating Pokémon

  • For how to add, remove, count and choose Pokémon.

Shiny Pokémon

  • For how to make a Pokémon shiny, and how shininess works.

Multiple forms

  • For how to give a Pokémon multiple forms, including gender differences.

Shadow Pokémon

  • For how to make Shadow Pokémon and manipulate them, as well as purification.

Eggs

  • For how Pokémon eggs work.

A Pokémon's attributes

Each individual Pokémon in the game has a number of attributes. Together, these attributes define that specific Pokémon. The term "poke" in the examples below should be replaced with the Pokémon to be modified (e.g. $Trainer.party[0] is the first Pokémon in the player's party).

Attribute Description
species The Pokemon's species.
name The Pokemon's nickname. If blank, is the Pokémon's species name instead.
level The Pokémon's current level. Depends on the attribute "exp".
exp The Pokémon's Experience Points. The attribute "level" depends on this.
type1
type2
The Pokemon's first and second types. Depends on the first/second types as defined for the Pokémon's species in the PBS file "pokemon.txt" (or in the script section PokemonMultipleForms if the Pokémon has an alternate form).

If the Pokémon only has one type, then "type2" will be the same as "type1".

ability The ID number of the Pokemon's ability. Depends on the attribute "abilityflag" if defined, or the attribute "personalid" if not.
abilityflag If defined, forces the Pokémon's ability to be the first natural (0), second natural (1) or hidden (2) ability available to its species. It is not possible to give the Pokémon any ability other than those defined in the PBS file "pokemon.txt" for its species.
gender The Pokémon's gender. Is either 0 (male), 1 (female) or 2 (genderless). Depends on the attribute "genderflag" if defined, or the attribute "personalID" if not.
genderflag If defined, forces the Pokémon to be male (0) or female (1). It cannot be set to a gender that the Pokémon cannot have.
nature The Pokemon's nature. Depends on the attribute "natureflag" if defined, or the attribute "personalID" if not.
natureflag If defined, forces the Pokémon's nature to be the value of this attribute.
isShiny? Whether the Pokémon is shiny or not. Depends on the attribute "personalID".
shinyflag If defined, forces the Pokémon to be shiny (true) or not (false).
form The Pokémon's form. 0 is the default form, and Pokémon with form 0 are as defined in the PBS file "pokemon.txt".
hp The Pokémon's current HP.
totalhp
attack
defense
speed
spatk
spdef
In order:
  • The current maximum HP amount the Pokémon can have.
  • The Pokémon's Attack stat.
  • The Pokémon's Defense stat.
  • The Pokémon's Speed stat.
  • The Pokémon's Special Attack stat.
  • The Pokémon's Special Defense stat.

All of these are calculated depending on the Pokémon's species, level, IVs, EVs and nature.

happiness The Pokémon's happiness. Is a number between 0 and 255 inclusive.
status The Pokémon's status. One of:
  • 0 (healthy)
  • 1 (or PBStatuses::SLEEP)
  • 2 (or PBStatuses::POISON)
  • 3 (or PBStatuses::BURN)
  • 4 (or PBStatuses::PARALYSIS)
  • 5 (or PBStatuses::FROZEN)
statusCount Is 0, except if the Pokémon is:
  • Asleep - Is the number of rounds the Pokémon will remain asleep. This number is set when the Pokémon is made to fall asleep.
  • Badly poisoned - If the Pokémon is Poisoned and this is "1", the Pokémon is badly poisoned instead (which affects how much poison damage it takes in battle). When the Pokémon leaves battle while badly poisoned, this value is set to 0 and it becomes regular Poisoned (even in later battles).
eggsteps Used for Pokémon eggs. The number of steps until the egg hatches. If it is 0, it is a Pokémon. The script poke.egg? will return TRUE if it is an egg (i.e. if "eggsteps" is a positive number), and FALSE if it is a Pokémon.

This is the only way in which eggs are different to Pokémon.

moves An array of up to 4 moves that the Pokémon knows. Each move has the following attributes:
  • id - The internal number of the move. Can also be referred to as PBMoves::TACKLE.
  • pp - The remaining PP of the move.
  • ppup - The number of boosts to the maximum PP this move has had. One boost will add a fifth of the original maximum PP, and item effects limit the maximum number of allowed boosts to 3 (there is no inherent limit on the number of boosts allowed).

In addition, the following two attributes cannot be changed, but are still useful:

  • type - The move's type. Is looked up from the PBS file "moves.txt".
  • totalpp - The maximum PP of this move. It takes into account any boosts given to it.
ballused A number representing the type of Poké Ball that the Pokémon is in. The list of Poké Balls and their corresponding numbers is in the script section PokémonBalls. Is 0 by default, i.e. a regular Poké Ball.
item The Pokémon's held item. Is the internal number of that item, which is the same as PBItems::ORANBERRY (or similar).
mail If the Pokémon's item is not a mail item, this attribute is "nil". If it is a mail item, then this attribute is an array of several attributes:
  • item - Is the same value as the Pokémon's held item. This determines the mail's background image.
  • message - The mail's message.
  • sender - The name of the mail's sender.
  • pokeX, formX - The species and forms of up to three Pokémon to appear on the mail, if appropriate ("X" is 1, 2 or 3).
ev An array of the Effort Values this Pokémon has, in the order:
  1. HP
  2. Attack
  3. Defense
  4. Speed
  5. Special Attack
  6. Special Defense

These can each be between 0 and 255 inclusive. They are all 0 when the Pokémon is created.

iv An array of the Individual Values this Pokémon has, in the order:
  1. HP
  2. Attack
  3. Defense
  4. Speed
  5. Special Attack
  6. Special Defense

These can each be between 0 and 31 inclusive. They are randomly set when the Pokémon is created.

pokerus Is a number between 0 and 255 which describes the Pokérus infection state of this Pokémon. It contains both the strain of the virus, and the remaining infection time in days. As a rough explanation:
  • 0 - The Pokémon does not have Pokérus, and has never had it.
  • >15, has a remainder when divided by 16 - The Pokémon has Pokérus and is infectious. The remainder is the number of days remaining for it to be infectious.
  • >15, has no remainder when divided by 16 - The Pokémon has had Pokérus in the past, and is no longer infectious.
fused Another Pokémon which has been fused with this Pokémon (or nil if there is none). It is a Pokémon itself. Currently only used by Kyurem, to record a fused Reshiram or Zekrom.
beauty
cool
cute
smart
tough
sheen
The Pokémon's contest stats.

They currently do nothing in Essentials (except "beauty", which is involved in the evolution method "Feebas", but there is no existing way to change its value).

markings The Pokémon's markings. The binary version of this number indicates which markings the Pokémon has.
ribbons An array of the Pokémon's ribbons. Each element of the array is either TRUE (has that particular ribbon) or FALSE (doesn't have that particular ribbon).
personalID The Pokémon's personal ID number. A 32-bit number (i.e. a number between 0 and 4,294,967,295), which is randomly generated when the Pokémon is created. The last two octets of the binary version of the ID number (a number between 0 and 65535) is displayed in a Pokémon summary screen, and is given by poke.publicID.

Determines the Pokémon's gender, ability, nature and shininess. It also determines where Spinda's spots are, and is used in the evolution methods "Silcoon" and "Cascoon".

trainerID
ot
otgender
The Pokémon's original trainer's ID number (a 32-bit number), name and gender respectively. The last two octets of the binary version of the ID number (a number between 0 and 65535) is displayed on the Trainer card and in Pokémon summary screens. Gender is either 0 (male), 1 (female), 2 (mixed) or 3 (unknown), and only used to colour in some text in a Pokémon summary screen.

Use poke.isForeign?($Trainer) to determine whether the Pokémon was originally owned by the player or not. Returns TRUE if either "trainerID" or "ot" do not match the player's (i.e. is foreign to the player), and FALSE if they both match (i.e. the player is the original owner). This example considers the player ($Trainer), but the script can be used for other (NPC) trainers, e.g. in battle.

obtainMode
obtainMap
obtainLevel
hatchedmap
The method, map ID and Level at which the Pokémon was obtained, and the map the Pokémon hatched from an egg on. "obtainMode" is either "nil", "0" (met), "1" (egg received), "2" (traded) or "4" (fateful encounter).

These three attributes are all set when the Pokémon is generated, and again (except for "obtainMode") when an egg hatches.

The script poke.timeReceived returns the time and date the Pokémon was met (in seconds since the Unix epoch). Similarly, the script poke.timeEggHatched returns the time/date the Pokémon hatched.

obtainText If this is a string of text, that text will be shown instead of the name of the "obtainMap" in the Summary screens.

Any egg obtained from the Day Care will have this set to "Day-Care Couple".

language The Pokémon's language. Is one of the following:
  • 0 - Unknown
  • 1 - Japanese
  • 2 - English (default)
  • 3 - French
  • 4 - Italian
  • 5 - German
  • 7 - Spanish
  • 8 - Korean

Pokémon that the player catches will have the same language as the player.

There are also two functions that affect Pokémon, as follows:

Function What it does
poke.heal Fully heals the Pokémon. Restores the HP to full, the status to normal, and the PP of all moves to full.
calcStats Recalculates the Pokémon's stats (total HP, Attack, Defense, etc.).

Used when creating a Pokémon or egg, when an egg hatches, when a Pokémon's level/species/nature/gender/shininess changes, when an EV-modifying item is used, and when a Pokémon's form changes.

Level limit

The level limit is defined in the script section Settings, and is a variable called MAXLEVEL (default 100).

In the script section PBExperience is a large array containing all the "Exp per level" numbers for each growth rate. These numbers only go up to level 100. If the level limit is increased, then the "Exp per level" numbers for levels above 100 are calculated by formulae instead of being looked up in the array. These calculations are written in the def self.pbGetExpInternal. There are different calculations depending on which growth rate the Pokémon's species has.

Pokérus

Pokérus is a virus that can rarely be contracted by a Pokémon. While it is infected, a Pokémon will receive more EVs from battle than usual. A Pokémon will be infectious for a while after contracting Pokérus, but will still receive the effect of it forever after.

The attribute which records a Pokémon's Pokérus is described above. It works the same as in the official games.

Only wild Pokémon or eggs from the Day Care may be generated with Pokérus. The chance of this is defined in the script section Settings, and is a variable called POKERUSCHANCE (default 3).

After any battle, an uninfected Pokémon in the player's party will have a 33% chance of catching Pokérus from each infected Pokémon next to it.

Related tutorials

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.