• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Apologies if you've had troubles connecting to the site, you may need a VPN to access it. Staff are also facing issues connecting, so if it's urgent please message Cat on-site or through Discord directly.
  • Hey Guest, staff applications are open! If you are interested in becoming a forum staff member and/or Discord staff member, please apply through this Google Form before April 2! You can also message Cat with any questions.
Resource icon

v21.1 Shrink long Pokémon names and nicknames in the battle screen 2025-02-20

This resource pertains to version 21.1 of Pokémon Essentials.
Here's what happens usually when a Pokémon has a very long nickname:

F73C9ZZ.png


And here's what happens after making the changes in this tutorial:

KvTBMdO.png


In a code editor (or Notepad or whatever), open Data\Scripts\011_Battle\004_Scene\006_Battle_Scene_Objects.rb. Find the following function, and completely delete line 4 (nameOffset = nameWidth - 116 if nameWidth > 116).

Ruby:
Expand Collapse Copy
  def draw_name
    nameWidth = self.bitmap.text_size(@battler.name).width
    nameOffset = 0
    nameOffset = nameWidth - 116 if nameWidth > 116
    pbDrawTextPositions(self.bitmap, [[@battler.name, @spriteBaseX + 8 - nameOffset, 12, :left,
                                       NAME_BASE_COLOR, NAME_SHADOW_COLOR]]
    )
  end

In the line underneath the one you just deleted, change pbDrawTextPositions to pbDrawTextPositionsPokeName.

Next, open Data\Scripts\007_Objects and windows\010_DrawText.rb and find the pbDrawTextPositions function. After the function (i.e. after the last end), copy and paste this new function:

Ruby:
Expand Collapse Copy
def pbDrawTextPositionsPokeName(bitmap, textpos)
  textpos.each do |i|
    textsize = bitmap.text_size(i[0])
    x = i[1]
    y = i[2]
    case i[3]
    when :right, true, 1   # right align
      x -= textsize.width
    when :center, 2   # centered
      x -= (textsize.width / 2)
    end
    i[6] = :none if !i[5]   # No shadow color given, draw plain text
    if textsize.width > 116
      drawsize = 116
    else
      drawsize = textsize.width
    end
    pbDrawShadowText(bitmap, x, y, drawsize, textsize.height, i[0], i[4], i[5])
  end
end

I'm working my way through my game's UI one screen at a time, so I can't say whether or not this would work for (e.g.) the Party screen. (I mean, I haven't even figured out how to use pbSetNarrowFont for the "What will ◯◯◯◯◯◯◯◯◯◯ do?" text, yet. 👀)

Also, I'm not much of a coder, so there's probably a way more efficient way of pulling this off. But it fixes a weird oversight in Essentials so I thought I'd share my progress anyway, in the hope that people can use it as a jumping-off point for their own fixes.
Credits
No credit required.
Author
meejle
Views
394
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from meejle

Back
Top