• 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.
  • The Eevee Expo Game Jam has concluded! 🎉 Head on over to the game jam forum to play through the games.
    Don't forget to come back September 21st to vote for your favorites!
  • Reminder: AI-generated content is not allowed on the forums per the Rules and Regulations. Please contact us if you have any questions!

Make a Trainer Name/Class Blank

Zorquil

Rookie
Member
Joined
May 26, 2023
Posts
3
da5d2b255037505b95769e0e6404bf2c7f0c5649.pnj

I'm trying to just call this trainer "rat", but it keeps saying "Unnamed" or breaking because it won't take a blank input without defaulting or sending an error. I was hoping someone could help me figure out a way to make it blank without messing too much with defaults. Either making the trainer class or the trainer name blank would be appreciated!

Things Tried:
  • I tried making the trainer class "r" and the trainer name "at", but no dice. There was a space.
  • From NoNoNever's suggestion, I tried making the default for the trainer class. Unfortunately, there's still an extra space. Though it did help me find out about the .fullname issue.
Things I Won't Try:
  • Editing Trainer, Line 19 to remove the trainer name. I don't want it on a global scale. I want to have it assignable to certain trainer classes, or even certain trainers through the battle rules. (Though for those emulating Generation 1's "Trainer Class Only" (from Pokémon Red, Blue, Yellow, and Green), editing this script globally would be something useful for that.)
 
Last edited:
in trainer_types

line 103
def initialize(hash)
@id = hash[:id]
@real_name = hash[:real_name] || ""
@gender = hash[:gender] || 2
@base_money = hash[:base_money] || 30
@skill_level = hash[:skill_level] || @base_money
@flags = hash[:flags] || []
@intro_BGM = hash[:intro_BGM]
@battle_BGM = hash[:battle_BGM]
@victory_BGM = hash[:victory_BGM]
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end

simply changed
@real_name = hash[:real_name] || "Unnamed"
to
@real_name = hash[:real_name] || ""
 
in trainer_types

line 103
def initialize(hash)
@id = hash[:id]
@real_name = hash[:real_name] || ""
@gender = hash[:gender] || 2
@base_money = hash[:base_money] || 30
@skill_level = hash[:skill_level] || @base_money
@flags = hash[:flags] || []
@intro_BGM = hash[:intro_BGM]
@battle_BGM = hash[:battle_BGM]
@victory_BGM = hash[:victory_BGM]
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end

simply changed
@real_name = hash[:real_name] || "Unnamed"
to
@real_name = hash[:real_name] || ""
Unfortunately, that doesn't seem to be the correct variable. I made it empty, but it still adds an extra space due to how it's written in Battle_StartAndEnd, Line 187.

Ruby:
Expand Collapse Copy
  def pbStartBattleSendOut(sendOuts)
    # "Want to battle" messages
    if wildBattle?
      foeParty = pbParty(1)
      case foeParty.length
      when 1
        pbDisplayPaused(_INTL("Oh! A wild {1} appeared!", foeParty[0].name))
      when 2
        pbDisplayPaused(_INTL("Oh! A wild {1} and {2} appeared!", foeParty[0].name,
                              foeParty[1].name))
      when 3
        pbDisplayPaused(_INTL("Oh! A wild {1}, {2} and {3} appeared!", foeParty[0].name,
                              foeParty[1].name, foeParty[2].name))
      end
    else   # Trainer battle
      case @opponent.length
      when 1
        pbDisplayPaused(_INTL("You are challenged by {1}!", @opponent[0].full_name))
      when 2
        pbDisplayPaused(_INTL("You are challenged by {1} and {2}!", @opponent[0].full_name,
                              @opponent[1].full_name))
      when 3
        pbDisplayPaused(_INTL("You are challenged by {1}, {2} and {3}!",
                              @opponent[0].full_name, @opponent[1].full_name, @opponent[2].full_name))
      end
    end

So the full_name seems to be the problem. And so looking at Trainer, Line 19...

Code:
Expand Collapse Copy
  def full_name
    return _INTL("{1} {2}", trainer_type_name, @name)
  end

I need to somehow make a special line that can be called by the "rat" class (or specific trainers) that only gets the trainer_type_name and not the @name. I am also trying to figure out how to make it so certain battles doesn't allow item usage, so I wonder how I would go about both of those things... Guess it's time to learn how to make custom code in Pokémon Essentials.
 
Hello, I would Say the best way for you would be to put a spécial token in the PBS for trainer name like BLANK and do _INTL("{1} {2}", trainer_type_name, @ name).gsub(" BLANK", "") inside the full name function
 
Actually I think a clean way to do this is add a "DontShowClass" flag to the trainer definition, then check for the flag in the full_name function and do "return @ name" if the flag exists. This allows your classes to have unique class IDs and still hide the name
 
Back
Top