Join our discord
In partnership with NodeCraft Logo NodeCraft


You are not logged in! Create an account or login to contribute! Log in here!

Database editing

From Pixelmon Wiki
Revision as of 19:20, 4 January 2017 by Some body (talk | contribs)

Pixelmon uses an H2 database to store a variety of Pokémon data, including stats, moves, and spawn biomes. It is possible to edit the database to change these aspects.

Notes

Before attempting to edit the database, there are a few notes to keep in mind.

  • Knowledge of SQL is not required to edit the database because the default H2 console GUI has a visual editor that provides the functionality of simpler SQL commands. However, knowledge of relational databases will provide a significant advantage in understanding the Pixelmon database structure, and knowing how to construct SQL queries will allow data to be manipulated much more easily.
  • This guide uses the default H2 console to edit the database. It is possible to use other database editors such as SQuirreL SQL, but this guide will not include any features and installation steps for these alternate editors.
  • Most database modifications only need to be done server-side. However, certain fields in the database are used client-side; if editing these fields, the custom database should be provided to players on the server to install client-side. If a field is used client-side, it will be mentioned as such.
  • This guide assumes that the database is being modified for a server. However, it is also possible to modify the database on singleplayer by following similar steps.

Setting up a custom database

The initial screen displayed when running the H2 console
  1. If you haven't already, run the server with Pixelmon installed in order to generate a "database" folder in the root Minecraft directory.
  2. In the root Minecraft directory, create a "customdatabase" folder.
  3. Copy the "Pixelmon2.h2.db" file from the "database" folder to the "customdatabase" folder.
  4. In the database folder, run the "h2-<numbers>.jar" file. This will open a window in your internet browser with the H2 console.
  5. In the "JDBC URL" text box, put "jdbc:h2:" followed by the full file path to the "Pixelmon2.h2.db" file inside the "customdatabase" folder. Include a slash at the beginning of the path, and omit the ".h2.db" extension from the file name (i.e., just use "Pixelmon2"). Leave the "User Name" and "Password" fields blank.
  6. Click the "Connect" button.
  7. You should see a screen similar to the image below. Make sure that you can see a list of database table names on the left sidebar; if you cannot, you did not connect to the database correctly.
The H2 console after connecting to the Pixelmon database

Editing database tables

Note: If you know how to use SQL queries to edit the database, you can skip this section.

  • To view a table, click on its entry in the left sidebar.
  • To edit a table after viewing it, scroll to the bottom of the table and click the "Edit" button.
    • To add a new row to the table, click the DatabaseInsert.png icon and fill in each column's values. Once you have done this, click the DatabaseConfirm.png icon on the left to save the row. You can click the DatabaseCancel.png icon to cancel adding a row.
  • To edit an existing row, click the DatabaseUpdate.png icon in the row you want to edit. The row's values will become editable text boxes. Again, click the DatabaseConfirm.png icon on the left to save the row, or click the DatabaseCancel.png icon to cancel the modification.
  • To delete a row, click the DatabaseDelete.png icon on the left of the row you want to delete.

Tables

Table Used Can edit Can add Can delete
ABILITIES Yes No No No
BADGES No N/A N/A N/A
BIOMES No N/A N/A N/A
CUSTOM_DROPS No N/A N/A N/A
CUSTOM_MESSAGES No N/A N/A N/A
CUSTOM_TEAMMEMBERS No N/A N/A N/A
CUSTOM_TRAINER No N/A N/A N/A
EGGGROUPS Yes No No No
HMREQUIREMENTS No N/A N/A N/A
MOVEANIMATIONS No N/A N/A N/A
MOVECATEGORIES Yes No No No
MOVEEFFECTS No N/A N/A N/A
MOVES Yes Yes No No
PIXELMON Yes Yes No No
PIXELMONDROPS Yes Yes Yes Yes
PIXELMONEGGSKILLS Yes Yes Yes Yes
PIXELMONEVOLUTIONS Yes Yes Yes Yes
PIXELMONFLY Yes Yes Yes No
PIXELMONHELDITEMS No N/A N/A N/A
PIXELMONLEVELSKILLS Yes Yes Yes Yes
PIXELMONRIDE Yes Yes Yes No
PIXELMONSPAWNBIOMES Yes Yes Yes Yes
PIXELMONSPAWNLOCATIONS Yes Yes Yes Yes
PIXELMONSPAWNTIMES Yes Yes Yes No
PIXELMONSWIM Yes Yes Yes No
PIXELMONTMHMSKILLS Yes Yes Yes Yes
PIXELMONTRADES Yes Yes Yes Yes
PIXELMONTUTORSKILLS Yes Yes Yes Yes
SHOPITEMS No N/A N/A N/A
SHOPKEEPERITEMS No N/A N/A N/A
SHOPKEEPERS No N/A N/A N/A
TRAINER No N/A N/A N/A
TRAINERDROPS No N/A N/A N/A
TRAINERMESSAGES No N/A N/A N/A
TRAINERPIXELMONPOOL No N/A N/A N/A
TRAINERSPAWNBIOMES Yes Yes Yes Yes
TRAINERTYPES Yes No Yes No
TYPES Yes No No No

ABILITIES

This table assigns numerical IDs to all Abilities. This table should not be modified.

BADGES

This table is not currently used by Pixelmon.

BIOMES

This table is not currently used by Pixelmon. Spawn biomes are defined directly in PIXELMONSPAWNBIOMES.

CUSTOM_DROPS

This table is not currently used by Pixelmon.

CUSTOM_MESSAGES

This table is not currently used by Pixelmon.

CUSTOM_TEAMMEMBERS

This table is not currently used by Pixelmon.

CUSTOM_TRAINER

This table is not currently used by Pixelmon.

EGGGROUPS

This table assigns numerical IDs to all Egg Groups. This table should not be modified.

HMREQUIREMENTS

This table is not currently used by Pixelmon.

MOVEANIMATIONS

This table is not currently used by Pixelmon.

MOVECATEGORIES

This table assigns numerical IDs to all move categories. This table should not be modified.

MOVEEFFECTS

This table is not currently used by Pixelmon. Move effects are defined directly in the MOVES table.

MOVES

This table contains data about all moves in Pixelmon. Existing moves should not be removed, and new moves should not be added.

  • MOVEID: The numerical ID of the move. Do not modify this field.
  • NAME: The English name of the move, which is referenced in Pixelmon's code and used to obtain the translated name of the move. Do not modify this field.
  • TMID: The move's TM number, or null if the move is not a TM. Do not modify this field.
  • HMID: The move's HM number, or null if the move is not an HM. Do not modify this field.
  • TYPEID: The ID of the move's type, corresponding to the ID in the TYPES table.
  • MOVECATEGORYID: The ID of the move's move category, corresponding to the ID in the MOVECATEGORIES table. If changed, client-side database installation is required.
  • POWER: The move's base power, or null if the move has no base power. If changed, client-side database installation is required.
  • ACCURACY: The move's base accuracy, or null if the move does not use accuracy checks. If changed, client-side database installation is required.
  • PP: The move's base PP. If changed, client-side database installation is required.
  • PPMAX: Unused.
  • EFFECT: The move's additional effect. Semicolons can be used to separate multiple effects on one move, while colons are used to pass arguments into an effect. New effects cannot be added. A list of possible effects can be seen by entering the following query:
SELECT DISTINCT EFFECT FROM MOVES ORDER BY EFFECT
  • MAKESCONTACT: Whether the move makes contact with its target, triggering effects from sources such as Static and Rocky Helmet.
  • Targeting data: These fields define data about move targeting in double battles. If changed, client-side database installation is required.
    • HITSALL: Whether the move hits all of its possible targets at once.
    • HITSOPPOSITEFOE: Whether the move can target the opponent directly opposite of the user.
    • HITSADJACENTFOE: Whether the move can target opponents adjacent to the user.
    • HITSEXTENDEDFOE: Unused.
    • HITSSELF: Whether the move can target the user.
    • HITSADJACENTALLY: Whether the move can target the user's partner.
    • HITSEXTENDEDALLY: Unused.
  • DESCRIPTION: Unused.
  • ATTACKANIMATIONS: Unused.
  • TUTORTYPE: Whether the move is a tutor move (1), an event tutor move (2), or not a tutor move (null).

PIXELMON

This table contains data about all Pokémon in Pixelmon, along with unimplemented Pokémon up to Generation 6. Pokémon should not be added or removed from this table.

  • PIXELMONID: The Pokémon's numerical ID. Do not modify this field.
  • NATIONALPOKEDEXNUMBER: The Pokémon's Pokédex number. Do not modify this field.
  • PIXELMONFULLNAME: The Pokémon's unlocalized species name, used in Pixelmon code and for translation. Do not modify this field.
  • PIXELMONNAME: Unused.
  • Types: These fields define the Pokémon's types using IDs from the TYPES table. If changed, client-side database installation is required.
    • PIXELMONTYPE1ID: The Pokémon's primary type.
    • PIXELMONTYPE2ID: The Pokémon's secondary type, or null if the Pokémon only has one type.
  • Abilities: These fields define the Pokémon's Abilities using IDs from the ABILITIES table. If changed, client-side database installation is required.
    • ABILITY1ID: The Pokémon's first Ability.
    • ABILITY2ID: The Pokémon's second Ability, or null if the Pokémon only has one normal Ability.
    • ABILITYHIDDENID: The Pokémon's hidden Ability, or null if the Pokémon has no hidden Ability.
  • Egg Groups: These fields define the Pokémon's Egg Groups using IDs from the EGGGROUPS table.
    • EGGGROUP1ID: The Pokémon's first Egg Group.
    • EGGGROUP2ID: The Pokémon's second Egg Group, or null if the Pokémon only has one Egg Group.
  • EGGCYCLES: The number of Egg cycles needed to hatch an Egg containing the Pokémon.
  • Dimensions: These fields define scaling for the Pokémon's model. If changed, client-side database installation is required.
    • POKEDEXHEIGHT: The height-wise scale of the Pokémon.
    • POKEDEXWIDTH: The width-wise scale of the Pokémon.
    • POKEDEXLENGTH: The length-wise scale of the Pokémon.
  • POKEDEXWEIGHT: The weight of the Pokémon in kilograms. This affects the Pokémon's Pokédex entry and certain moves such as Low Kick. If changed, client-side database installation is required.
  • POKEDEXDESCRIPTION: Unused.
  • MALEPERCENT: The percentage chance of the Pokémon being male. -1 means that the Pokémon is genderless.
  • CATCHRATE: The Pokémon's catch rate.
  • RARITY: The relative rarity of the Pokémon when spawning naturally. -1 means that the Pokémon uses the Legendary Pokémon spawn rate and displays a message when the Pokémon spawns.
  • SPAWNTIMEID: The spawn time of the Pokémon, using IDs from the PIXELMONSPAWNTIMES table.
  • MINGROUPSIZE: The minimum number of Pokémon that spawn in a group whenever the Pokémon spawns.
  • MAXGROUPSIZE: The maximum number of Pokémon that spawn in a group whenever the Pokémon spawns.
  • BASEEXP: A value used when calculating experience gained from defeating the Pokémon in battle. A higher BASEEXP causes the Pokémon to give more experience when defeated.
  • EXPERIENCEGROUP: The rate at which the Pokémon's levels up from experience gained. More details can be found here.
  • Base stats: These fields define the Pokémon's base stats.
    • BASEHP: The Pokémon's base HP.
    • BASEATK: The Pokémon's base Attack.
    • BASEDEF: The Pokémon's base Defense.
    • BASESPATK: The Pokémon's base Special Attack.
    • BASESPDEF: The Pokémon's base Special Defense.
    • BASESPD: The Pokémon's base Speed.
  • EV yield: These fields define the Pokémon's EV yield.
    • EVGAINHP: The Pokémon HP EV yield.
    • EVGAINATK: The Pokémon Attack EV yield.
    • EVGAINDEF: The Pokémon Defense EV yield.
    • EVGAINSPATK: The Pokémon Special Attack EV yield.
    • EVGAINSPDEF: The Pokémon Special Defense EV yield.
    • EVGAINSPD: The Pokémon Speed EV yield.
  • MINSPAWNLEVEL: The minimum level that the Pokémon will spawn at.
  • MAXSPAWNLEVEL: One level higher than the maximum level that the Pokémon will spawn at. If this value is the same as MINSPAWNLEVEL, the Pokémon will always spawn at MINSPAWNLEVEL.
  • MODELSCALE: The amount to scale the Pokémon's model in all directions by. If changed, client-side database installation is required.
  • Behavior: These fields define how often the Pokémon spawns with a certain behavior. The remainder of the time (100 - PERCENTTIMID - PERCENTAGRESSIVE), the Pokémon has a neutral behavior and ignores players outside of battle.
  • PERCENTTIMID: The percent of the time that the Pokémon timid. This causes the Pokémon to attempt to move away from players when outside of battle.
  • PERCENTAGRESSIVE: The percent of the time that the Pokémon is aggressive. This causes the Pokémon to approach and engage nearby players in battle.
  • ISRIDEABLE: Whether the Pokémon can be mounted.
  • CANFLY: If true, a rideable Pokémon becomes a flying mount.
  • CANSWIM: If true, a rideable Pokémon becomes a water mount.
  • DOESHOVER: This affects the Pokémon's animation. Do not modify this field.
  • BASEFRIENDSHIP: The initial happiness that the Pokémon starts at after being captured. After being traded, the Pokémon also resets to this happiness.
  • FORM: The form index of the Pokémon. Do not modify this field.

PIXELMONHELDITEMS

This table is not currently used by Pixelmon.

SHOPITEMS

This table is not currently used by Pixelmon. Shopkeeper items are defined in the shopkeeper external JSON files.

SHOPKEEPERSITEMS

This table is not currently used by Pixelmon. Shopkeeper items are defined in the shopkeeper external JSON files.

SHOPKEEPERS

This table is not currently used by Pixelmon. Shopkeepers are defined in the shopkeeper external JSON files.

TRAINER

This table is not currently used by Pixelmon. NPC Trainers are defined in the NPC external JSON files.

TRAINERDROPS

This table is not currently used by Pixelmon.

TRAINERMESSAGES

This table is not currently used by Pixelmon. NPC Trainer dialogue is defined in the NPC external JSON files.

TRAINERPIXELMON

This table is not currently used by Pixelmon. NPC Trainer Pokémon are defined in the NPC external JSON files.

© 2012 - 2025 Pixelmon Mod