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
No edit summary
Tag: Visual edit
Maruno (talk | contribs)
mNo edit summary
Tag: Source edit
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
This page describes how to '''edit the attributes of a Pokémon''', such as its gender, owner or ribbons.
 
This page describes how to '''edit the attributes of a Pokémon''', such as its gender, owner or ribbons.
   
== Editing a Pokémon ==
+
== Deciding which Pokémon to edit ==
   
 
The first step is to find the Pokémon to edit. This can be done a variety of different ways depending on the circumstances. For example:
 
The first step is to find the Pokémon to edit. This can be done a variety of different ways depending on the circumstances. For example:
   
 
pkmn = $Trainer.party[0]
 
pkmn = $Trainer.party[0]
pkmn = pbFirstAblePokemon(1)
+
pkmn = $Trainer.first_able_pokemon
pkmn = $Trainer.lastPokemon
+
pkmn = $Trainer.last_pokemon
 
pkmn = pbGetPokemon(1)
 
pkmn = pbGetPokemon(1)
   
These will all return a Pokémon (if possible) and call it "<code>pkmn</code>". This article assumes that the Pokémon being edited is referred to as "<code>pkmn</code>".
+
These will all return a Pokémon (if possible) and call it "<code>pkmn</code>". This page assumes that the Pokémon being edited is referred to as "<code>pkmn</code>".
   
=== Common attributes to edit ===
+
== Attributes that can be edited ==
   
 
{| class="article-table" border="1"
 
{| class="article-table" border="1"
Line 21: Line 21:
 
|-
 
|-
 
| Ability
 
| Ability
| <code>pkmn.setAbility(2)</code>
+
| <code>pkmn.ability_index = 2</code><br /><code>pkmn.ability = :INTIMIDATE</code>
| Sets the Pokémon's [[Abilities|ability]] to be the first natural (0), second natural (1) or a hidden (2-5) ability available to its species. Use <code>pkmn.setAbility(nil)</code> to remove the override and have the ability determined by the Pokémon's personal ID.
+
| To set the Pokémon's ability to one that is [[Defining a species|defined]] as available to its species, set its ability index to the appropriate number. 0 is the first regular ability, 1 is the second regular ability, and 2+ are hidden abilities. Use <code>pkmn.ability_index = nil</code> to make the choice of ability be determined by the Pokémon's personal ID.
   
  +
To set the Pokémon's ability to any existing ability at all, simply set its ability. Note that this only applies until the Pokémon's species or form changes, so this usually shouldn't be used. Set the ability to <code>nil</code> to make the choice of ability be determined as normal (from the Pokémon's ability index, which by default is derived from its personal ID).
It is not possible to give the Pokémon any ability other than those defined in the [[PBS file]] "pokemon.txt" for its species.
 
 
|-
 
|-
  +
| Contest stats
| Ball used
 
  +
| <code>pkmn.beauty = 42<br />pkmn.cool = 42<br />pkmn.cute = 42<br />pkmn.smart = 42<br />pkmn.tough = 42<br />pkmn.sheen = 42</code>
| <code>pkmn.ballused=7</code>
 
  +
| Sets the Pokémon's contest stats. Each stat should be a number between 0 and 255 inclusive.
| Sets the type of Poké Ball the Pokémon is contained in. The list of Poké Balls and their corresponding numbers is in the script section '''PItem_PokeBalls'''.
 
  +
  +
Note that these properties are currently unused (except beauty for Feebas' evolution).
 
|-
 
|-
 
| EVs
 
| EVs
| <code>pkmn.ev[2]=42</code>
+
| <code>pkmn.ev[:DEFENSE] = 42</code>
| Sets the Pokémon's EVs for a given stat. Each stat should be a number between 0 and 255 inclusive. The stats (the number in square brackets) are as follows:
+
| Sets the Pokémon's EVs for a given stat. Each stat should be a number between 0 and 252 inclusive. The possible stats (as mentioned in the square brackets) are as follows:
   
* 0 = HP
+
* :HP
  +
* :ATTACK
* 1 = Attack
 
  +
* :DEFENSE
* 2 = Defense
 
  +
* :SPECIAL_ATTACK
* 3 = Speed
 
  +
* :SPECIAL_DEFENSE
* 4 = Special Attack
 
  +
* :SPEED
* 5 = Special Defense
 
  +
|-
  +
| Experience
  +
| <code>pkmn.exp = 12345</code>
  +
| Sets the Pokémon's Experience Points. You will usually want to add/subtract amounts from this, rather than setting it to a specific new value.
  +
|-
  +
| First moves
  +
| <code>pkmn.add_first_move(:TACKLE)<br />pkmn.record_first_moves<br />pkmn.remove_first_move(:TACKLE)</code>
  +
| Registers a move as being a first-known move for the Pokémon (which it can relearn via the [[Useful NPCs|Move Relearner]]). The second option takes all moves currently known by the Pokémon and registers those as its first-known moves (all other first-known moves are cleared). The last option will clear a particular move from the Pokémon's list of first-known moves (it does nothing if it wasn't a first-known move).
 
|-
 
|-
 
| Form
 
| Form
| <code>pkmn.form=1</code>
+
| <code>pkmn.form = 1</code>
 
| Sets the Pokémon's [[Forms|form]]. 0 is the default form as defined in the [[PBS file]] "pokemon.txt".
 
| Sets the Pokémon's [[Forms|form]]. 0 is the default form as defined in the [[PBS file]] "pokemon.txt".
   
Some Pokémon species determine their form automatically depending on various factors. Their form cannot be manually changed this way, as they will immediately change back.
+
Some Pokémon species determine their form automatically depending on various factors. Their form cannot be manually changed this way, as they will immediately change back. You can alter the code responsible for this to not recalculate if the form is currently a particular number(s), allowing you to set the Pokémon's form to that number(s) this way.
   
Setting a Pokémon's form will also recalculate its stats.
+
Setting a Pokémon's form will also recalculate its stats and mark it as seen in the Pokédex. It will also trigger any changes that happen when the Pokémon changes form, such as try to learn a form-specific move for Rotom.
  +
|-
  +
| Fused Pokémon
  +
| <code>pkmn.fused = pkmn2</code>
  +
| Sets the Pokémon which is fused with this Pokémon. <code>pkmn2</code> is itself a Pokémon and can itself be edited. Use <code>pkmn.fused = nil</code> to erase the fused Pokémon.
 
|-
 
|-
 
| Gender
 
| Gender
 
| <code>pkmn.makeMale</code><br /><code>pkmn.makeFemale</code>
 
| <code>pkmn.makeMale</code><br /><code>pkmn.makeFemale</code>
| Sets the Pokémon's gender to male or female. They cannot give a Pokémon a gender it cannot have. Use <code>pkmn.setGender(nil)</code> to remove the override and have the gender determined by the Pokémon's personal ID.
+
| Sets the Pokémon's gender to male or female. This cannot make a Pokémon a gender it cannot be. Use <code>pkmn.gender = nil</code> to remove the override and have the gender be determined by the Pokémon's personal ID.
   
 
You will also need to record the new gender as seen, so that it will show up in the [[Pokédex]]. To do this, use <code>pbSeenForm(pkmn)</code> afterwards.
 
You will also need to record the new gender as seen, so that it will show up in the [[Pokédex]]. To do this, use <code>pbSeenForm(pkmn)</code> afterwards.
 
|-
 
|-
 
| Happiness
 
| Happiness
| <code>pkmn.happiness=200</code>
+
| <code>pkmn.happiness = 200</code><br /><code>pkmn.changeHappiness("walking")</code>
 
| Sets the Pokémon's happiness. This should be a number between 0 and 255 inclusive.
 
| Sets the Pokémon's happiness. This should be a number between 0 and 255 inclusive.
  +
  +
The second line of code will change the Pokémon's happiness as it would change if triggered by a particular event. This takes into account modifiers such as the Soothe Bell and Luxury Ball. The possible events are:
  +
  +
* "walking"
  +
* "levelup"
  +
* "groom"
  +
* "evberry"
  +
* "vitamin"
  +
* "wing"
  +
* "machine"
  +
* "battleitem"
  +
* "faint"
  +
* "faintbad"
  +
* "powder"
  +
* "energyroot"
  +
* "revivalherb"
  +
|-
  +
| Hatched map
  +
| <code>pkmn.hatched_map = 42</code>
  +
| Sets the map in which the Pokémon hatched from an egg. Is used only if the Pokémon's obtain method is "egg received".
  +
|-
  +
| Hatched time
  +
| <code>pkmn.timeEggHatched = Time.now</code>
  +
| Sets the time at which the Pokémon hatched from an egg. Can only be set if the Pokémon's obtain method is "egg received", and is only used in that case.
 
|-
 
|-
 
| Held item
 
| Held item
| <code>pkmn.setItem(:ORANBERRY)</code>
+
| <code>pkmn.item = :ORANBERRY</code>
| Sets the Pokémon's [[Items|held item]]. "<code>0</code>" means no item.
+
| Sets the Pokémon's [[Items|held item]]. Use <code>pkmn.item = nil</code> to delete the held item.
   
If the item is a mail item, then <code>pkmn.mail</code> should also be set: <code>pkmn.mail=PokemonMail.new(PBItems::GRASSMAIL,"This is a message.","Dave")</code>
+
If the item is a mail item, then <code>pkmn.mail</code> should also be set: <code>pkmn.mail = Mail.new(:GRASSMAIL, "This is a message.", "Dave")</code>
   
If the item is a mail item which shows Pokémon on it, then this should instead be: <code>pkmn.mail=PokemonMail.new(PBItems::GRASSMAIL,"This is a message.","Dave",pkmn1,pkmn2,pkmn3)</code>. Each "<code>pkmn#</code>" should be an array of the form <code>[species,gender,shininess,form,shadowness,is egg?]</code>.
+
If the item is a mail item which shows Pokémon on it, then this should instead be: <code>pkmn.mail = Mail.new(:GRASSMAIL, "This is a message.", "Dave", pkmn1, pkmn2, pkmn3)</code>. Each "<code>pkmn#</code>" should be an array of the form <code>[species, gender, shininess, form, shadowness, is egg?]</code>.
  +
|-
  +
| HP
  +
| <code>pkmn.hp = 42<br />pkmn.heal_HP<br />pkmn.heal</code>
  +
| Sets the Pokémon's current HP. The second option fully restores the Pokémon's HP. The last option will fully restore the Pokémon's HP, cure its status problem, and restore all its moves' PP to full.
 
|-
 
|-
 
| IVs
 
| IVs
| <code>pkmn.iv[2]=7</code>
+
| <code>pkmn.iv[:DEFENSE] = 7</code>
| Sets the Pokémon's IVs for a given stat. Each stat should be a number between 0 and 31 inclusive. The stats (the number in square brackets) are as follows:
+
| Sets the Pokémon's IVs for a given stat. Each stat should be a number between 0 and 31 inclusive. The possible stats (as mentioned in the square brackets) are as follows:
   
* 0 = HP
+
* :HP
  +
* :ATTACK
* 1 = Attack
 
  +
* :DEFENSE
* 2 = Defense
 
  +
* :SPECIAL_ATTACK
* 3 = Speed
 
  +
* :SPECIAL_DEFENSE
* 4 = Special Attack
 
  +
* :SPEED
* 5 = Special Defense
 
|-
 
| Language
 
| <code>pkmn.language=2</code>
 
| Sets the Pokémon's language. Is one of the following:
 
   
  +
<code>pkmn.ivMaxed[:DEFENSE] = true</code> will treat the Pokémon's IV in the given stat as the highest possible value (31) when it comes to calculating its effect on the Pokémon's stats. It is set by Hyper Training. Use <code>pkmn.ivMaxed[:DEFENSE] = nil</code> to remove this override.
* 0 = Unknown
 
* 1 = Japanese
 
* 2 = English (default)
 
* 3 = French
 
* 4 = Italian
 
* 5 = German
 
* 7 = Spanish
 
* 8 = Korean
 
 
|-
 
|-
 
| Level
 
| Level
| <code>pkmn.level=42</code>
+
| <code>pkmn.level = 42</code>
 
| Sets the Pokémon's current level.
 
| Sets the Pokémon's current level.
   
 
What it actually does is change the Pokémon's "<code>exp</code>" value to be the lowest possible value for that level.
 
What it actually does is change the Pokémon's "<code>exp</code>" value to be the lowest possible value for that level.
 
|-
 
|-
  +
| Markings
| Moveset
 
| <code>pkmn.pbLearnMove(:TACKLE)<br />pkmn.pbDeleteMove(:TACKLE)<br />pkmn.resetMoves</code>
+
| <code>pkmn.markings = 5</code>
| The first option teaches a move to the Pokémon. This can teach any move, and will do so without informing the player. If the Pokémon already knows 4 moves, the first move will be forgotten, the other three bumped up and the new move added to the end.
+
| Sets which markings the Pokémon has. Each marking has a value, and the Pokémon will have the markings whose values add up to the number set. The six markings are in order:
   
  +
* 1 = ●
The second option deletes a move from the Pokémon, if it knows it. Again, this will happen without informing the player.
 
  +
* 2 = ▲
  +
* 4 = ■
  +
* 8 = ♥
  +
* 16 = ★
  +
* 32 = ♦
  +
  +
For example, if this number is 5, the values that make 5 are 1 (circle) and 4 (square), so the Pokémon will have those two markings.
  +
|-
  +
| Moves
  +
| <code>pkmn.learn_move(:TACKLE)<br />pkmn.forget_move(:TACKLE)<br />pkmn.reset_moves</code>
  +
| The first option teaches a move to the Pokémon. This can teach any move, and will do so without informing the player. If the Pokémon already knows a full set of moves, the first move will be forgotten, the others bumped up and the new move added to the end.
  +
  +
The second option deletes a move from the Pokémon, if it knows it. Again, this will happen without informing the player. Note that this is able to make a Pokémon forget its last move.
   
 
The third option resets the Pokémon's moveset to what a wild Pokémon of that species/level/form would know. This can be useful when changing a Pokémon's level/form.
 
The third option resets the Pokémon's moveset to what a wild Pokémon of that species/level/form would know. This can be useful when changing a Pokémon's level/form.
 
|-
 
|-
 
| Nature
 
| Nature
| <code>pkmn.setNature(:HASTY)</code>
+
| <code>pkmn.nature = :HASTY</code>
| Sets the Pokémon's nature. Use <code>pkmn.setNature(nil)</code> to remove the override and have the nature determined by the Pokémon's personal ID.
+
| Sets the Pokémon's nature. Use <code>pkmn.nature = nil</code> to remove the override and have the nature be determined by the Pokémon's personal ID.
  +
  +
<code>pkmn.nature_for_stats = :HASTY</code> will treat the Pokémon's nature as this one when it comes to calculating its effect on the Pokémon's stats. It is used by the Gen 8 mints. Use <code>pkmn.nature_for_stats = nil</code> to remove this override and have the stats be affected by the Pokémon's actual nature.
 
|-
 
|-
 
| Nickname
 
| Nickname
| <code>pkmn.name="Dave"</code>
+
| <code>pkmn.name = "Dave"</code>
| Sets the Pokémon's nickname to a given phrase. Use <code>pkmn.name=nil</code> to remove the nickname.
+
| Sets the Pokémon's nickname to a given phrase. Use <code>pkmn.name = nil</code> to remove the nickname.
   
 
To let the player choose their own name, simply call <code>pbNickname(pkmn)</code>.
 
To let the player choose their own name, simply call <code>pbNickname(pkmn)</code>.
  +
|-
  +
| Obtain level
  +
| <code>pkmn.obtain_level = 42</code>
  +
| Sets which Level the Pokémon was at when it was obtained.
  +
|-
  +
| Obtain map
  +
| <code>pkmn.obtain_map = 42</code>
  +
| Sets the map in which the Pokémon was obtained.
  +
|-
  +
| Obtain method
  +
| <code>pkmn.obtain_method = 1</code>
  +
| Sets the method by which the Pokémon was obtained. The number is either <code>0</code> ("met"), <code>1</code> ("egg received", i.e. it then hatched), <code>2</code> ("[[Trading Pokémon|traded]]") or <code>4</code> ("fateful encounter").
 
|-
 
|-
 
| Obtain text
 
| Obtain text
| <code>pkmn.obtainText=_I("Day-Care Couple")</code>
+
| <code>pkmn.obtain_text = "Day-Care Couple"</code>
| Sets the phrase to use instead of the obtain map's name as the place where the Pokémon was obtained. Use <code>pkmn.obtainText=nil</code> to remove the phrase.
+
| Sets the phrase to use, instead of the obtain map's name, as the place where the Pokémon was obtained. Use <code>pkmn.obtain_text = nil</code> to remove the phrase.
  +
|-
  +
| Owner's gender
  +
| <code>pkmn.owner.gender = 1</code>
  +
| Sets the gender of the Pokémon's original owner. The number is either <code>0</code> (male), <code>1</code> (female), <code>2</code> (mixed) or <code>3</code> (unknown).
  +
|-
  +
| Owner's ID number
  +
| <code>pkmn.owner.id = $Trainer.id</code><br /><code>pkmn.owner.id = $Trainer.make_foreign_ID</code>
  +
| Sets the ID number of the Pokémon's original owner. The first option sets it to the player's ID number, and the second option sets it to a random other ID number.
  +
  +
This and the original owner's name determine whether the Pokémon originally belonged to the player or not.
  +
|-
  +
| Owner's language
  +
| <code>pkmn.owner.language = 2</code>
  +
| Sets the language of the Pokémon's original owner. Is one of the following:
  +
  +
* 0 = Unknown
  +
* 1 = Japanese
  +
* 2 = English (default)
  +
* 3 = French
  +
* 4 = Italian
  +
* 5 = German
  +
* 7 = Spanish
  +
* 8 = Korean
  +
|-
  +
| Owner's name
  +
| <code>pkmn.owner.name = "Dave"</code>
  +
| Sets the name of the Pokémon's original owner.
  +
  +
This and the original owner's ID number determine whether the Pokémon originally belonged to the player or not.
  +
|-
  +
| Personal ID
  +
| <code><nowiki>pkmn.personalID = rand(2 ** 16) | rand(2 ** 16) << 16</nowiki></code>
  +
| Sets the Pokémon's personal ID. The example will randomise the Pokémon's personal ID, although it can also be set to any value between 0 and 4,294,967,295 inclusive.
  +
  +
Note that the Pokémon's gender, nature, ability and shininess all depend on the value of the personal ID by default. Spinda's spot locations and the [[Evolution|evolution methods]] "Silcoon" and "Cascoon" also depend on it.
  +
|-
  +
| Poké Ball
  +
| <code>pkmn.poke_ball = :ULTRABALL</code>
  +
| Sets the type of Poké Ball the Pokémon is contained in. This is the ID of a Poké Ball item.
 
|-
 
|-
 
| Pokérus
 
| Pokérus
| <code>pkmn.givePokerus<br />pkmn.givePokerus(4)</code>
+
| <code>pkmn.givePokerus</code><br /><code>pkmn.givePokerus(4)</code>
| Gives the Pokémon Pokérus. The parameter is optional, and is the strain of Pokérus to give (between 1 and 15; the strain is randomly chosen if not given).
+
| Gives the Pokémon Pokérus. The parameter is optional, and is the strain of Pokérus to give (between 1 and 15 inclusive; the strain is randomly chosen if not given). The strain number determines how many days the Pokémon will be infected for before becoming immune.
   
<code>pkmn.pokerusStage</code> will return either <code>0</code> (never infected), <code>1</code> (currently infectious), or <code>2</code> (cured/immune).
+
<code>pkmn.pokerusStage</code> will return either <code>0</code> (never infected), <code>1</code> (currently infectious) or <code>2</code> (cured/immune).
 
|-
 
|-
 
| Ribbons
 
| Ribbons
| <code>pkmn.giveRibbon(:HOENNCOOL)<br />pkmn.takeRibbon(:HOENNCOOL)</code>
+
| <code>pkmn.giveRibbon(:HOENNCOOL)</code><br /><code>pkmn.takeRibbon(:HOENNCOOL)</code>
 
| Gives the Pokémon the specified ribbon (or removes it).
 
| Gives the Pokémon the specified ribbon (or removes it).
   
 
There are a few other methods dealing with ribbons:
 
There are a few other methods dealing with ribbons:
   
* <code>pkmn.upgradeRibbon(:HOENNCOOL,:HOENNCOOLSUPER,:HOENNCOOLHYPER,:HOENNCOOLMASTER)</code> - Any number of ribbons can be listed. Either adds the first ribbon if the Pokémon has none of them, or turns the possessed ribbon into the next one listed. Returns the number of the ribbon added/upgraded into, or 0 if nothing changed.
+
* <code>pkmn.upgradeRibbon(:HOENNCOOL, :HOENNCOOLSUPER, :HOENNCOOLHYPER, :HOENNCOOLMASTER)</code> - Any number of ribbons can be listed. Either adds the first ribbon if the Pokémon has none of them, or turns the possessed ribbon into the next one listed. Returns the ID of the ribbon added/upgraded into, or <code>nil</code> if nothing changed.
* <code>pkmn.ribbonCount</code> - Returns the total number of ribbons the Pokémon has.
+
* <code>pkmn.numRibbons</code> - Returns the total number of ribbons the Pokémon has.
* <code>pkmn.hasRibbon?(:HOENNCOOL)</code> - Returns TRUE if the Pokémon has the specified ribbon, and FALSE if not.
+
* <code>pkmn.hasRibbon?(:HOENNCOOL)</code> - Returns <code>true</code> if the Pokémon has the specified ribbon, and <code>false</code> if not.
 
* <code>pkmn.clearAllRibbons</code> - Removes all ribbons from the Pokémon.
 
* <code>pkmn.clearAllRibbons</code> - Removes all ribbons from the Pokémon.
 
|-
 
|-
Line 139: Line 236:
 
| <code>pkmn.makeShadow</code>
 
| <code>pkmn.makeShadow</code>
 
| Makes the Pokémon a [[Shadow Pokémon]]. It is not so easy to turn a Shadow Pokémon into a regular Pokémon, though.
 
| Makes the Pokémon a [[Shadow Pokémon]]. It is not so easy to turn a Shadow Pokémon into a regular Pokémon, though.
  +
  +
<code>pkmn.adjustHeart(-50)</code> will add the given amount to the Pokémon's heart gauge (this amount is usually negative). If the heart gauge is 0, the Pokémon can be purified.
 
|-
 
|-
 
| Shininess
 
| Shininess
| <code>pkmn.makeShiny<br />pkmn.makeNotShiny</code>
+
| <code>pkmn.shiny = true<br />pkmn.shiny = false</code>
| Makes the Pokémon [[Shiny Pokémon|shiny]], or not. Use <code>pkmn.shinyflag=nil</code> to remove the override and have the shininess determined by the Pokémon's personal ID.
+
| Makes the Pokémon [[Shiny Pokémon|shiny]], or not. Use <code>pkmn.shiny = nil</code> to remove the override and have the shininess be determined by the Pokémon's personal ID.
|}
 
 
=== Rare attributes to edit ===
 
 
The following are attributes you are unlikely to ever want to edit. They are listed mainly for completeness.
 
 
{| class="article-table" border="1"
 
! Attribute
 
! Code
 
! Description
 
|-
 
| Contest stats
 
| <code>pkmn.beauty=42<br />pkmn.cool=42<br />pkmn.cute=42<br />pkmn.smart=42<br />pkmn.tough=42<br />pkmn.sheen=42</code>
 
| Sets the Pokémon's contest stats. Each stat should be a number between 0 and 255 inclusive.
 
Note that these properties are currently unused (except beauty for Feebas' evolution).
 
|-
 
| Current HP
 
| <code>pkmn.hp=42<br />pkmn.healHP<br />pkmn.heal</code>
 
| Sets the Pokémon's current HP. The second option fully heals the Pokémon's HP. The last option will also restore the Pokémon's PP and status to full/normal.
 
|-
 
| Egg steps
 
| <code>pkmn.eggsteps=5355</code>
 
| Sets the number of steps required for the [[Eggs|Pokémon egg]] to hatch.
 
|-
 
| Experience
 
| <code>pkmn.exp=12345</code>
 
| Sets the Pokémon's Experience Points. You will usually want to add/subtract amounts from this, rather than setting it to a specific new value.
 
|-
 
| Fused Pokémon
 
| <code>pkmn.fused=pkmn2</code>
 
| Sets the Pokémon which is fused with this Pokémon. <code>pkmn2</code>is itself a Pokémon. Use <code>pkmn.fused=nil</code> to erase the fused Pokémon.
 
|-
 
| Hatched map
 
| <code>pkmn.hatchedMap=42</code>
 
| Sets the map in which the Pokémon hatched from an egg. Is used only if the Pokémon's obtain method is "egg received".
 
|-
 
| Hatched time
 
| <code>pkmn.timeEggHatched=Time.now</code>
 
| Sets the time at which the Pokémon hatched from an egg. Is used only if the Pokémon's obtain method is "egg received".
 
|-
 
| Markings
 
| <code>pkmn.markings=5</code>
 
| Sets the markings the Pokémon has. Each marking has a value, and the Pokémon will have the markings whose values add up to the number specified. The six markings are in order:
 
* 1 = ●
 
* 4 = ▲
 
* 2 = ■
 
* 8 = ♥
 
* 16 = ★
 
* 32 = ♦
 
For example, if this number is 5, the values that make 5 are 1 (circle) and 4 (triangle), so the Pokémon will have those two markings.
 
|-
 
| Obtain level
 
| <code>pkmn.obtainLevel=42</code>
 
| Sets the Level at which the Pokémon was obtained.
 
|-
 
| Obtain map
 
| <code>pkmn.obtainMap=42</code>
 
| Sets the map in which the Pokémon was obtained.
 
|-
 
| Obtain method
 
| <code>pkmn.obtainMode=1</code>
 
| Sets the method by which the Pokémon was obtained. The number is either <code>nil</code>, <code>0</code> ("met"), <code>1</code> ("egg received", i.e. it then hatched), <code>2</code> ("[[Trading Pokémon|traded]]") or <code>4</code> ("fateful encounter").
 
|-
 
| Original trainer's gender
 
| <code>pkmn.otgender=1</code>
 
| Sets the gender of the Pokémon's original trainer. The number is either <code>0</code> (male), <code>1</code> (female), <code>2</code> (mixed) or <code>3</code> (unknown).
 
|-
 
| Original trainer's ID number
 
| <code>pkmn.trainerID=$Trainer.id<br />pkmn.trainerID=$Trainer.getForeignID</code>
 
| Sets the ID number of the Pokémon's original trainer. The first option sets it to the player's ID number, and the second option sets it to a random other ID number.
 
 
This and the original trainer's name determine whether the Pokémon originally belonged to the player or not.
 
|-
 
| Original trainer's name
 
| <code>pkmn.ot="Dave"</code>
 
| Sets the name of the Pokémon's original trainer.
 
 
This and the original trainer's ID number determine whether the Pokémon originally belonged to the player or not.
 
|-
 
| Personal ID
 
| <code>pkmn.personalID=rand(2**32)</code>
 
| Sets the Pokémon's personal ID. The example will randomise the Pokémon's personal ID, although it can also be set to any value between 0 and 4,294,967,295.
 
 
Note that the Pokémon's gender, nature, ability and shininess all depend on the value of the personal ID by default. Spinda's spot locations and the [[Evolution|evolution methods]] "Silcoon" and "Cascoon" also depend on it.
 
 
|-
 
|-
 
| Species
 
| Species
| <code>pkmn.species=PBSpecies::BULBASAUR</code>
+
| <code>pkmn.species = :BULBASAUR</code>
| Sets the Pokémon's species.
+
| Sets the Pokémon's species. This will also recalculate the Pokémon's level, ability and stats.
 
|-
 
|-
 
| Status
 
| Status
| <code>pkmn.status=PBStatuses::POISON<br />pkmn.status=0<br />pkmn.healStatus</code>
+
| <code>pkmn.status = :POISON<br />pkmn.status = :NONE<br />pkmn.heal_status</code>
 
| Sets the Pokémon's status. The possible statuses are:
 
| Sets the Pokémon's status. The possible statuses are:
   
  +
* <code>:NONE</code>
* 0 (healthy)
 
* 1 (or <code>PBStatuses::SLEEP</code>)
+
* <code>:SLEEP</code>
* 2 (or <code>PBStatuses::POISON</code>)
+
* <code>:POISON</code>
* 3 (or <code>PBStatuses::BURN</code>)
+
* <code>:BURN</code>
* 4 (or <code>PBStatuses::PARALYSIS</code>)
+
* <code>:PARALYSIS</code>
* 5 (or <code>PBStatuses::FROZEN</code>)
+
* <code>:FROZEN</code>
   
If putting the Pokémon to sleep, then <code>pkmn.statusCount=3</code>should also be set, where the number is the number of rounds the Pokémon will remain asleep.
+
If putting the Pokémon to sleep, then <code>pkmn.statusCount = 3</code>should also be set, where the number is the number of rounds the Pokémon will remain asleep.
  +
|-
  +
| Steps to hatch
  +
| <code>pkmn.steps_to_hatch = 5120</code>
  +
| Sets the number of steps required for the [[Eggs|Pokémon egg]] to hatch. If this is 0, <code>pkmn</code> is a Pokémon and not an egg.
  +
|-
  +
| Time received
  +
| <code>pkmn.timeReceived = Time.now</code>
  +
| Sets the time when the Pokémon was obtained.
 
|}
 
|}
   
== What can't be changed ==
+
=== What can't be changed ===
   
 
There are some attributes of a Pokémon that cannot be changed directly. These are:
 
There are some attributes of a Pokémon that cannot be changed directly. These are:
Line 256: Line 279:
 
** Attack
 
** Attack
 
** Defense
 
** Defense
** Speed
 
 
** Special Attack
 
** Special Attack
 
** Special Defense
 
** Special Defense
  +
** Speed
  +
* Height
  +
* Weight
  +
* EV yield
   
 
== The last part of editing a Pokémon ==
 
== The last part of editing a Pokémon ==
   
Once a Pokémon's attributes have been edited, its stats may need to be recalculated. This is done by the following code:
+
Once a Pokémon's attributes have been edited, its stats may need to be recalculated. This is done by the following line of code:
   
pkmn.calcStats
+
pkmn.calc_stats
   
 
To be safe, you should always include this line after all other edits.
 
To be safe, you should always include this line after all other edits.

Revision as of 22:19, 19 May 2021

For giving, taking, counting and choosing Pokémon, see Manipulating Pokémon.

This page describes how to edit the attributes of a Pokémon, such as its gender, owner or ribbons.

Deciding which Pokémon to edit

The first step is to find the Pokémon to edit. This can be done a variety of different ways depending on the circumstances. For example:

pkmn = $Trainer.party[0]
pkmn = $Trainer.first_able_pokemon
pkmn = $Trainer.last_pokemon
pkmn = pbGetPokemon(1)

These will all return a Pokémon (if possible) and call it "pkmn". This page assumes that the Pokémon being edited is referred to as "pkmn".

Attributes that can be edited

Attribute Code Description
Ability pkmn.ability_index = 2
pkmn.ability = :INTIMIDATE
To set the Pokémon's ability to one that is defined as available to its species, set its ability index to the appropriate number. 0 is the first regular ability, 1 is the second regular ability, and 2+ are hidden abilities. Use pkmn.ability_index = nil to make the choice of ability be determined by the Pokémon's personal ID.

To set the Pokémon's ability to any existing ability at all, simply set its ability. Note that this only applies until the Pokémon's species or form changes, so this usually shouldn't be used. Set the ability to nil to make the choice of ability be determined as normal (from the Pokémon's ability index, which by default is derived from its personal ID).

Contest stats pkmn.beauty = 42
pkmn.cool = 42
pkmn.cute = 42
pkmn.smart = 42
pkmn.tough = 42
pkmn.sheen = 42
Sets the Pokémon's contest stats. Each stat should be a number between 0 and 255 inclusive.

Note that these properties are currently unused (except beauty for Feebas' evolution).

EVs pkmn.ev[:DEFENSE] = 42 Sets the Pokémon's EVs for a given stat. Each stat should be a number between 0 and 252 inclusive. The possible stats (as mentioned in the square brackets) are as follows:
  • :HP
  • :ATTACK
  • :DEFENSE
  • :SPECIAL_ATTACK
  • :SPECIAL_DEFENSE
  • :SPEED
Experience pkmn.exp = 12345 Sets the Pokémon's Experience Points. You will usually want to add/subtract amounts from this, rather than setting it to a specific new value.
First moves pkmn.add_first_move(:TACKLE)
pkmn.record_first_moves
pkmn.remove_first_move(:TACKLE)
Registers a move as being a first-known move for the Pokémon (which it can relearn via the Move Relearner). The second option takes all moves currently known by the Pokémon and registers those as its first-known moves (all other first-known moves are cleared). The last option will clear a particular move from the Pokémon's list of first-known moves (it does nothing if it wasn't a first-known move).
Form pkmn.form = 1 Sets the Pokémon's form. 0 is the default form as defined in the PBS file "pokemon.txt".

Some Pokémon species determine their form automatically depending on various factors. Their form cannot be manually changed this way, as they will immediately change back. You can alter the code responsible for this to not recalculate if the form is currently a particular number(s), allowing you to set the Pokémon's form to that number(s) this way.

Setting a Pokémon's form will also recalculate its stats and mark it as seen in the Pokédex. It will also trigger any changes that happen when the Pokémon changes form, such as try to learn a form-specific move for Rotom.

Fused Pokémon pkmn.fused = pkmn2 Sets the Pokémon which is fused with this Pokémon. pkmn2 is itself a Pokémon and can itself be edited. Use pkmn.fused = nil to erase the fused Pokémon.
Gender pkmn.makeMale
pkmn.makeFemale
Sets the Pokémon's gender to male or female. This cannot make a Pokémon a gender it cannot be. Use pkmn.gender = nil to remove the override and have the gender be determined by the Pokémon's personal ID.

You will also need to record the new gender as seen, so that it will show up in the Pokédex. To do this, use pbSeenForm(pkmn) afterwards.

Happiness pkmn.happiness = 200
pkmn.changeHappiness("walking")
Sets the Pokémon's happiness. This should be a number between 0 and 255 inclusive.

The second line of code will change the Pokémon's happiness as it would change if triggered by a particular event. This takes into account modifiers such as the Soothe Bell and Luxury Ball. The possible events are:

  • "walking"
  • "levelup"
  • "groom"
  • "evberry"
  • "vitamin"
  • "wing"
  • "machine"
  • "battleitem"
  • "faint"
  • "faintbad"
  • "powder"
  • "energyroot"
  • "revivalherb"
Hatched map pkmn.hatched_map = 42 Sets the map in which the Pokémon hatched from an egg. Is used only if the Pokémon's obtain method is "egg received".
Hatched time pkmn.timeEggHatched = Time.now Sets the time at which the Pokémon hatched from an egg. Can only be set if the Pokémon's obtain method is "egg received", and is only used in that case.
Held item pkmn.item = :ORANBERRY Sets the Pokémon's held item. Use pkmn.item = nil to delete the held item.

If the item is a mail item, then pkmn.mail should also be set: pkmn.mail = Mail.new(:GRASSMAIL, "This is a message.", "Dave")

If the item is a mail item which shows Pokémon on it, then this should instead be: pkmn.mail = Mail.new(:GRASSMAIL, "This is a message.", "Dave", pkmn1, pkmn2, pkmn3). Each "pkmn#" should be an array of the form [species, gender, shininess, form, shadowness, is egg?].

HP pkmn.hp = 42
pkmn.heal_HP
pkmn.heal
Sets the Pokémon's current HP. The second option fully restores the Pokémon's HP. The last option will fully restore the Pokémon's HP, cure its status problem, and restore all its moves' PP to full.
IVs pkmn.iv[:DEFENSE] = 7 Sets the Pokémon's IVs for a given stat. Each stat should be a number between 0 and 31 inclusive. The possible stats (as mentioned in the square brackets) are as follows:
  • :HP
  • :ATTACK
  • :DEFENSE
  • :SPECIAL_ATTACK
  • :SPECIAL_DEFENSE
  • :SPEED

pkmn.ivMaxed[:DEFENSE] = true will treat the Pokémon's IV in the given stat as the highest possible value (31) when it comes to calculating its effect on the Pokémon's stats. It is set by Hyper Training. Use pkmn.ivMaxed[:DEFENSE] = nil to remove this override.

Level pkmn.level = 42 Sets the Pokémon's current level.

What it actually does is change the Pokémon's "exp" value to be the lowest possible value for that level.

Markings pkmn.markings = 5 Sets which markings the Pokémon has. Each marking has a value, and the Pokémon will have the markings whose values add up to the number set. The six markings are in order:
  • 1 = ●
  • 2 = ▲
  • 4 = ■
  • 8 = ♥
  • 16 = ★
  • 32 = ♦

For example, if this number is 5, the values that make 5 are 1 (circle) and 4 (square), so the Pokémon will have those two markings.

Moves pkmn.learn_move(:TACKLE)
pkmn.forget_move(:TACKLE)
pkmn.reset_moves
The first option teaches a move to the Pokémon. This can teach any move, and will do so without informing the player. If the Pokémon already knows a full set of moves, the first move will be forgotten, the others bumped up and the new move added to the end.

The second option deletes a move from the Pokémon, if it knows it. Again, this will happen without informing the player. Note that this is able to make a Pokémon forget its last move.

The third option resets the Pokémon's moveset to what a wild Pokémon of that species/level/form would know. This can be useful when changing a Pokémon's level/form.

Nature pkmn.nature = :HASTY Sets the Pokémon's nature. Use pkmn.nature = nil to remove the override and have the nature be determined by the Pokémon's personal ID.

pkmn.nature_for_stats = :HASTY will treat the Pokémon's nature as this one when it comes to calculating its effect on the Pokémon's stats. It is used by the Gen 8 mints. Use pkmn.nature_for_stats = nil to remove this override and have the stats be affected by the Pokémon's actual nature.

Nickname pkmn.name = "Dave" Sets the Pokémon's nickname to a given phrase. Use pkmn.name = nil to remove the nickname.

To let the player choose their own name, simply call pbNickname(pkmn).

Obtain level pkmn.obtain_level = 42 Sets which Level the Pokémon was at when it was obtained.
Obtain map pkmn.obtain_map = 42 Sets the map in which the Pokémon was obtained.
Obtain method pkmn.obtain_method = 1 Sets the method by which the Pokémon was obtained. The number is either 0 ("met"), 1 ("egg received", i.e. it then hatched), 2 ("traded") or 4 ("fateful encounter").
Obtain text pkmn.obtain_text = "Day-Care Couple" Sets the phrase to use, instead of the obtain map's name, as the place where the Pokémon was obtained. Use pkmn.obtain_text = nil to remove the phrase.
Owner's gender pkmn.owner.gender = 1 Sets the gender of the Pokémon's original owner. The number is either 0 (male), 1 (female), 2 (mixed) or 3 (unknown).
Owner's ID number pkmn.owner.id = $Trainer.id
pkmn.owner.id = $Trainer.make_foreign_ID
Sets the ID number of the Pokémon's original owner. The first option sets it to the player's ID number, and the second option sets it to a random other ID number.

This and the original owner's name determine whether the Pokémon originally belonged to the player or not.

Owner's language pkmn.owner.language = 2 Sets the language of the Pokémon's original owner. Is one of the following:
  • 0 = Unknown
  • 1 = Japanese
  • 2 = English (default)
  • 3 = French
  • 4 = Italian
  • 5 = German
  • 7 = Spanish
  • 8 = Korean
Owner's name pkmn.owner.name = "Dave" Sets the name of the Pokémon's original owner.

This and the original owner's ID number determine whether the Pokémon originally belonged to the player or not.

Personal ID pkmn.personalID = rand(2 ** 16) | rand(2 ** 16) << 16 Sets the Pokémon's personal ID. The example will randomise the Pokémon's personal ID, although it can also be set to any value between 0 and 4,294,967,295 inclusive.

Note that the Pokémon's gender, nature, ability and shininess all depend on the value of the personal ID by default. Spinda's spot locations and the evolution methods "Silcoon" and "Cascoon" also depend on it.

Poké Ball pkmn.poke_ball = :ULTRABALL Sets the type of Poké Ball the Pokémon is contained in. This is the ID of a Poké Ball item.
Pokérus pkmn.givePokerus
pkmn.givePokerus(4)
Gives the Pokémon Pokérus. The parameter is optional, and is the strain of Pokérus to give (between 1 and 15 inclusive; the strain is randomly chosen if not given). The strain number determines how many days the Pokémon will be infected for before becoming immune.

pkmn.pokerusStage will return either 0 (never infected), 1 (currently infectious) or 2 (cured/immune).

Ribbons pkmn.giveRibbon(:HOENNCOOL)
pkmn.takeRibbon(:HOENNCOOL)
Gives the Pokémon the specified ribbon (or removes it).

There are a few other methods dealing with ribbons:

  • pkmn.upgradeRibbon(:HOENNCOOL, :HOENNCOOLSUPER, :HOENNCOOLHYPER, :HOENNCOOLMASTER) - Any number of ribbons can be listed. Either adds the first ribbon if the Pokémon has none of them, or turns the possessed ribbon into the next one listed. Returns the ID of the ribbon added/upgraded into, or nil if nothing changed.
  • pkmn.numRibbons - Returns the total number of ribbons the Pokémon has.
  • pkmn.hasRibbon?(:HOENNCOOL) - Returns true if the Pokémon has the specified ribbon, and false if not.
  • pkmn.clearAllRibbons - Removes all ribbons from the Pokémon.
Shadowness pkmn.makeShadow Makes the Pokémon a Shadow Pokémon. It is not so easy to turn a Shadow Pokémon into a regular Pokémon, though.

pkmn.adjustHeart(-50) will add the given amount to the Pokémon's heart gauge (this amount is usually negative). If the heart gauge is 0, the Pokémon can be purified.

Shininess pkmn.shiny = true
pkmn.shiny = false
Makes the Pokémon shiny, or not. Use pkmn.shiny = nil to remove the override and have the shininess be determined by the Pokémon's personal ID.
Species pkmn.species = :BULBASAUR Sets the Pokémon's species. This will also recalculate the Pokémon's level, ability and stats.
Status pkmn.status = :POISON
pkmn.status = :NONE
pkmn.heal_status
Sets the Pokémon's status. The possible statuses are:
  • :NONE
  • :SLEEP
  • :POISON
  • :BURN
  • :PARALYSIS
  • :FROZEN

If putting the Pokémon to sleep, then pkmn.statusCount = 3should also be set, where the number is the number of rounds the Pokémon will remain asleep.

Steps to hatch pkmn.steps_to_hatch = 5120 Sets the number of steps required for the Pokémon egg to hatch. If this is 0, pkmn is a Pokémon and not an egg.
Time received pkmn.timeReceived = Time.now Sets the time when the Pokémon was obtained.

What can't be changed

There are some attributes of a Pokémon that cannot be changed directly. These are:

  • Type 1
  • Type 2
  • Stats:
    • Maximum HP
    • Attack
    • Defense
    • Special Attack
    • Special Defense
    • Speed
  • Height
  • Weight
  • EV yield

The last part of editing a Pokémon

Once a Pokémon's attributes have been edited, its stats may need to be recalculated. This is done by the following line of code:

pkmn.calc_stats

To be safe, you should always include this line after all other edits.