Customization of the Stat Screen

Customizing the text of the stat screen, including displaying IVs/EVs

  1. TechSkylander1518
    Pokémon Essentials Version:
    v16.2 ➖
    This tutorial contains code that will display a Pokemon's Individual Values and Effort Values in the stat screen. It will also describe how these can be modified to suit different backgrounds. (Described by someone with minor experience in coding, intended for people with very little experience in coding. I'm afraid I can't give super advanced help)

    If you're just wanting the code, here it is:

    [_INTL("STATS"),26,16,0,base,shadow],
    [pokename,46,62,0,base,shadow],
    [_INTL("{1}",pokemon.level),46,92,0,Color.new(64,64,64),Color.new(176,176,176)],
    [_INTL("Item"),16,320,0,base,shadow],
    [_INTL("HP"),292,76,2,base,shadow],
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.hp,pokemon.totalhp),405,76,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[0],pokemon.ev[0]),485,76,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_INTL("Attack"),248,120,0,base,statshadows[0]],
    [_ISPRINTF("{1:d}",pokemon.attack),385,120,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[1],pokemon.ev[1]),475,120,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_INTL("Defense"),248,152,0,base,statshadows[1]],
    [_ISPRINTF("{1:d}",pokemon.defense),385,152,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[2],pokemon.ev[2]),475,152,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_INTL("Sp. Atk"),248,184,0,base,statshadows[3]],
    [_ISPRINTF("{1:d}",pokemon.spatk),385,184,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[4],pokemon.ev[4]),475,184,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_INTL("Sp. Def"),248,216,0,base,statshadows[4]],
    [_ISPRINTF("{1:d}",pokemon.spdef),385,216,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[5],pokemon.ev[5]),475,216,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_INTL("Speed"),248,248,0,base,statshadows[2]],
    [_ISPRINTF("{1:d}",pokemon.speed),385,248,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[3],pokemon.ev[3]),475,248,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_INTL("Ability"),224,284,0,base,shadow],
    [abilityname,362,284,0,Color.new(64,64,64),Color.new(176,176,176)],
    ]


    Copy and paste it into the textpos section of DrawPageThree in PScreen_Summary, overwriting the previously-existing text. It should begin on line 494 and end on line 518, just before "if pokemon.hasItem?".

    The result will look like this.

    [​IMG]

    As you can see, HP gets a bit cramped in the default background's grey. For that reason, I would recommend using this code with a summary screen that doesn't have the grey bar, like Aki's free backgrounds. (Or, if you don't want to to get a new one, you could use an image editing program to reduce the grey bar)

    Should you choose any of those options, I'd suggest replacing line 495=496 with these instead:
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.hp,pokemon.totalhp),405,76,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[0],pokemon.ev[0]),475,76,1,Color.new(64,64,64),Color.new(176,176,176)],

    It'll make the HP values line up better with the other stats.


    Now onto customization. I'm going to highlight parts of the code and explain what they mean. First, I'll cover what each line is creating:
    [_INTL("STATS"),26,16,0,base,shadow], Draws the word "STATS"
    [pokename,46,62,0,base,shadow], Draws the Pokemon's name
    [_INTL("{1}",pokemon.level),46,92,0,Color.new(64,64,64),Color.new(176,176,176)], Draws the number of the Pokemon's level. (does not draw "lvl" or any variation)
    [_INTL("Item"),16,320,0,base,shadow], Draws the word Item
    [_INTL("HP"),292,76,2,base,shadow], Draws the word HP
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.hp,pokemon.totalhp),405,76,1,Color.new(64,64,64),Color.new(176,176,176)], Draws "Current HP/Max HP"
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[0],pokemon.ev[0]),485,76,1,Color.new(64,64,64),Color.new(176,176,176)], Draws "HP IV/HP EVs"
    [_INTL("Attack"),248,120,0,base,statshadows[0]], Draws the word Attack
    [_ISPRINTF("{1:d}",pokemon.attack),385,120,1,Color.new(64,64,64),Color.new(176,176,176)], Draws the Pokemon's Attack stat
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[1],pokemon.ev[1]),475,120,1,Color.new(64,64,64),Color.new(176,176,176)], Draws "Attack IV/Attack EVs"
    [_INTL("Defense"),248,152,0,base,statshadows[1]], Draws the word Defense
    [_ISPRINTF("{1:d}",pokemon.defense),385,152,1,Color.new(64,64,64),Color.new(176,176,176)], Draws the Pokemon's Defense stat
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[2],pokemon.ev[2]),475,152,1,Color.new(64,64,64),Color.new(176,176,176)], Draws "Defense IV/Defense EVs"
    [_INTL("Sp. Atk"),248,184,0,base,statshadows[3]], Draws the words Sp. Attack
    [_ISPRINTF("{1:d}",pokemon.spatk),385,184,1,Color.new(64,64,64),Color.new(176,176,176)], Draws the Pokemon's Special Attack stat
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[4],pokemon.ev[4]),475,184,1,Color.new(64,64,64),Color.new(176,176,176)],
    [_INTL("Sp. Def"),248,216,0,base,statshadows[4]], Draws the words Sp. Defense
    [_ISPRINTF("{1:d}",pokemon.spdef),385,216,1,Color.new(64,64,64),Color.new(176,176,176)], Draws the Pokemon's Special Defense stat
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[5],pokemon.ev[5]),475,216,1,Color.new(64,64,64),Color.new(176,176,176)], Draws "Special Defense IV/ Special Defense EVs"
    [_INTL("Speed"),248,248,0,base,statshadows[2]], Draws the word Speed
    [_ISPRINTF("{1:d}",pokemon.speed),385,248,1,Color.new(64,64,64),Color.new(176,176,176)], Draws the Pokemon's Speed stat
    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[3],pokemon.ev[3]),475,248,1,Color.new(64,64,64),Color.new(176,176,176)], Draws "Speed IV/Speed EVs"
    [_INTL("Ability"),224,284,0,base,shadow], Draws the word Ability
    [abilityname,362,284,0,Color.new(64,64,64),Color.new(176,176,176)], Draws the name of the Pokemon's ability
    ]

    This isn't all of what appears on the Stats screen-the positioning of the ability description and HP bar, for example, have their code located just below this. But hopefully what I explain here should give you the skills necessarily to edit those if you want.

    Let's take a look at an individual line:
    [_INTL("Item"),16,320,0,base,shadow],
    We have three parts to this item:
    • _INTL("Item") tells the game to draw the word Item. If you'd like it to say something besides Item, you would change the text in quotation marks
    • 16,320,0 are the coordinates the word is placed on. The first coordinate is the position on the X-axis (horizontal, 0 is the point farthest left), the second coordinate is the position on the Y-axis (Vertical, 0 is the point farthest up), and the third coordinate (if I'm not mistaken) is the Z-coordinate. You shouldn't need to edit this-I'm pretty sure it's only relevant if text is overlapping (to determine which text is displayed on top), and you shouldn't have overlapping text.
    • base is a pre-existing color design in Essentials. It's the white text you see on the screen.
    • shadow is another pre-existing color design. It's the dark text that creates the illusion of a shadow. Since shadow is added in second, the game rewrites "Item" in shadow's color, but it writes it just slightly below and to the right. This will be done with any other color put after another.
    You could remove base or shadow from the line if you chose. (Don't know why you would, but I guess it depends on the background you have) You can technically remove both and still have your game functional, but base and shadow are the only visible parts. The game would still "write" the text without them, but you couldn't see it.

    This is not to say, though, that you couldn't change the color of your text if you wanted. If you want to make your text a color besides white, you'll need to create a new color. Replace "base" with "Color.new(x,y,z)", where x, y, z is your color in RGB values. (You don't have to be a color expert to know RGB values-just look up an RGB color picker!)

    One thing I didn't cover here is statshadows. statshadows are the red/blue outlines that designate which stat is boosted by one's nature, and which stat is hindered. You shouldn't mess with statshadow's placement-the values are registered with each stat, so unless you're doing a complete revamp of natures, they're good where they are. The colors for statshadows are located just above the textpos, in lines 482 and 483. (482 is the boosted stat, 483 is the lowered stat) As you can see, statshadows uses the same Color.new that was described before, so just change the values if you want to alter the color. But if you change them to something besides the classic red-boosted/blue-lowered colors, do your players a favor and let them know in-game.



    _INTL is used for words that stay the same no matter what Pokemon is being viewed. For numerical values that vary from Pokemon to Pokemon, like stats, you should use _ISPRINTF. (this is not for values that are already text-based, like the Pokemon's name or the description of their ability. I'll get to those in a bit) _ISPRINTF works very similarly to _INTL, but it gets the text just a bit differently. Like before, I'll go through each part of the code in one line.

    [_ISPRINTF("{1:3d}/{2:3d}",pokemon.iv[0],pokemon.ev[0]),485,76,1,Color.new(64,64,64),Color.new(176,176,176)],



    • [_ISPRINTF("{1:3d}/{2:3d}" tells the game how it's going to arrange the text. {1:3d} will pull the first value listed, and {2:3d} will pull the second. In this example code, those values are pokemon.iv[0] and pokemon.ev[0].
    • pokemon.iv[0] pulls the Pokemon's IV of the HP stat. By changing the number between the brackets, you can see the IV of different stats. 1 pulls Attack, 2 pulls Defense, 3 pulls Speed, 4 pulls Special Attack, and 5 pulls Special Defense.
    • pokemon.ev[0] pulls the Pokemon's current EVs of the HP stat. It uses the same system as pokemon.iv for different stats.
    • (From here, the code works pretty much the same as _INTL)
    • 485,76,1 are the coordinates of the characters on the screen
    • Color.new(64,64,64) is the RGB code for the first color the characters will be written in. While this code uses Color.new, you can still use a pre-defined color like base.
    • Color.new(176,176,176) is the RGB code for the second color, written as the first color's shadow.
    • ] closes the original [_ISPRINTF , and
    • , indicates that another line of code will be put into the textpos

    And values that don't store numerical data are even easier. No prefix like _INTL is needed-just put the name of the value after the [, then coordinates, color, and shadow color.