- Pokémon Essentials Version
- v21.1 ✅
Simple script to add the ability to nickname Pokémon from the party screen. v20/v21 has a plugin, which can be found here. This script was originally developed in v17, so I've included the older versions here as well.
Code
Paste in a new script section above Main, or download as a plugin here.
Ruby:
MenuHandlers.add(:party_menu, :rename, {
"name" => _INTL("Rename"),
"order" => 55,
"condition" => proc { |screen, party, party_idx| next !party[party_idx].egg? },
"effect" => proc { |screen, party, party_idx|
pkmn = party[party_idx]
name = pbMessageFreeText("#{pkmn.speciesName}'s nickname?",_INTL(""),false,Pokemon::MAX_NAME_SIZE) { screen.pbUpdate }
name=pkmn.speciesName if name ==""
pkmn.name=name
screen.pbDisplay(_INTL("{1} was renamed to {2}.",pkmn.speciesName,pkmn.name))
}
})
I've done this without any restrictions apart from the egg, because I think the trend of not naming Shadow/Foreign Pokemon is dumb. If you want to add that, change
!party[party_idx].egg?
to
(!party[party_idx].egg? && !party[party_idx].foreign? && !party[party_idx].shadowPokemon?)
In UI_Party, find this section:
Add this line:
Renaming actually works just fine without this, except skipping this step results in a crash when hitting Cancel on an egg. If you're getting an error like that, this is probably your fix!
Next, find this section.
After that first end, paste this:
It should look like this now:
Now, locate this section further down:
After the fourth end, add this:
If you'd like to use the cursor naming instead of the keyboard, change this line:
to
I've done this without any restrictions apart from the egg, because I think the trend of not naming Shadow/Foreign Pokemon is dumb. But you could easily implement that by adding a little conditional branch.
Go back to this section:
Before the Rename command, add a conditional if that checks if the Pokemon is foreign or Shadow.
And then just add another "end" after the line:
Ruby:
commands = []
cmdSummary = -1
cmdDebug = -1
cmdMoves = [-1,-1,-1,-1]
cmdSwitch = -1
cmdMail = -1
cmdItem = -1
Ruby:
cmdRename = -1
Next, find this section.
Ruby:
commands[cmdSwitch = commands.length] = _INTL("Switch") if @party.length>1
if !pkmn.egg?
if pkmn.mail
commands[cmdMail = commands.length] = _INTL("Mail")
else
commands[cmdItem = commands.length] = _INTL("Item")
end
end
Ruby:
commands[cmdRename = commands.length] = _INTL("Rename")
Ruby:
commands[cmdSwitch = commands.length] = _INTL("Switch") if @party.length>1
if !pkmn.egg?
if pkmn.mail
commands[cmdMail = commands.length] = _INTL("Mail")
else
commands[cmdItem = commands.length] = _INTL("Item")
end
commands[cmdRename = commands.length] = _INTL("Rename")
end
Now, locate this section further down:
Ruby:
if pbConfirm(_INTL("Would you like to switch the two items?"))
newpkmn.setItem(item)
pkmn.setItem(newitem)
@scene.pbClearSwitching
pbRefresh
pbDisplay(_INTL("{1} was given the {2} to hold.",newpkmn.name,itemname))
pbDisplay(_INTL("{1} was given the {2} to hold.",pkmn.name,newitemname))
break
end
end
end
end
Ruby:
elsif cmdRename>=0 && command==cmdRename
$game_variables[5]=pbMessageFreeText("#{pkmn.speciesName}'s nickname?",_INTL(""),false,Pokemon::MAX_NAME_SIZE)
if pbGet(5)==""
pkmn.name=pkmn.speciesName
pbSet(5,pkmn.name)
end
pkmn.name=pbGet(5)
pbDisplay(_INTL("{1} was renamed to {2}.",pkmn.speciesName,pkmn.name))
If you'd like to use the cursor naming instead of the keyboard, change this line:
Ruby:
$game_variables[5]=pbMessageFreeText("#{pkmn.speciesName}'s nickname?",_INTL(""),false,Pokemon::MAX_NAME_SIZE)
to
Ruby:
$game_variables[5]=pbEnterPokemonName(_INTL("{1}'s nickname?", pkmn.speciesName),
0, Pokemon::MAX_NAME_SIZE, "", pkmn)
I've done this without any restrictions apart from the egg, because I think the trend of not naming Shadow/Foreign Pokemon is dumb. But you could easily implement that by adding a little conditional branch.
Go back to this section:
Ruby:
commands[cmdSwitch = commands.length] = _INTL("Switch") if @party.length>1
if !pkmn.egg?
if pkmn.mail
commands[cmdMail = commands.length] = _INTL("Mail")
else
commands[cmdItem = commands.length] = _INTL("Item")
end
commands[cmdRename = commands.length] = _INTL("Rename")
end
Ruby:
if !pkmn.foreign?($Trainer) && !pkmn.shadowPokemon?
And then just add another "end" after the line:
Ruby:
commands[cmdRename = commands.length] = _INTL("Rename")
You mostly follow the same steps, there's just enough changes in the code that I wanted to have this be a separate section lmao
In UI_Party (PScreen_Party in earlier version), find this section:
Add this line:
Renaming actually works just fine without this, except skipping this step results in a crash when hitting Cancel on an egg. If you're getting an error like that, this is probably your fix!
Next, find this section.
After that first end, paste this:
It should look like this now:
Now, locate this section further down:
After the fourth end, add this:
Note that the 13 is the character limit for the name- you may want to adjust that to your tastes, but remember to keep it an amount that would be legible in gameplay.
Depending on your version, you might be able to delete "Kernel" if you want, but it doesn't hurt to leave it in.
If you'd like to use the cursor naming instead of the keyboard, change this line:
to
With 13 being the max name size.
I've done this without any restrictions apart from the egg, because I think the trend of not naming Shadow/Foreign Pokemon is dumb. But you could easily implement that by adding a little conditional branch.
Go back to this section:
Before the Rename command, add a conditional if that checks if the Pokemon is foreign or Shadow.
And then just add another "end" after the line:
In UI_Party (PScreen_Party in earlier version), find this section:
Ruby:
commands = []
cmdSummary = -1
cmdDebug = -1
cmdMoves = [-1,-1,-1,-1]
cmdSwitch = -1
cmdMail = -1
cmdItem = -1
Ruby:
cmdRename = -1
Next, find this section.
Ruby:
commands[cmdSwitch = commands.length] = _INTL("Switch") if @party.length>1
if !pkmn.egg?
if pkmn.mail
commands[cmdMail = commands.length] = _INTL("Mail")
else
commands[cmdItem = commands.length] = _INTL("Item")
end
end
Ruby:
commands[cmdRename = commands.length] = _INTL("Rename")
Ruby:
commands[cmdSwitch = commands.length] = _INTL("Switch") if @party.length>1
if !pkmn.egg?
if pkmn.mail
commands[cmdMail = commands.length] = _INTL("Mail")
else
commands[cmdItem = commands.length] = _INTL("Item")
end
commands[cmdRename = commands.length] = _INTL("Rename")
end
Now, locate this section further down:
Ruby:
if pbConfirm(_INTL("Would you like to switch the two items?"))
newpkmn.setItem(item)
pkmn.setItem(newitem)
@scene.pbClearSwitching
pbRefresh
pbDisplay(_INTL("{1} was given the {2} to hold.",newpkmn.name,itemname))
pbDisplay(_INTL("{1} was given the {2} to hold.",pkmn.name,newitemname))
break
end
end
end
end
Ruby:
elsif cmdRename>=0 && command==cmdRename
species=PBSpecies.getName(pkmn.species)
$game_variables[5]=Kernel.pbMessageFreeText("#{species}'s nickname?",_INTL(""),false,13)
if pbGet(5)==""
pbSet(5,species)
end
pkmn.name=pbGet(5)
pbDisplay(_INTL("{1} was renamed to {2}.",species,pkmn.name))
Note that the 13 is the character limit for the name- you may want to adjust that to your tastes, but remember to keep it an amount that would be legible in gameplay.
Depending on your version, you might be able to delete "Kernel" if you want, but it doesn't hurt to leave it in.
If you'd like to use the cursor naming instead of the keyboard, change this line:
Ruby:
$game_variables[5]=Kernel.pbMessageFreeText("#{species}'s nickname?",_INTL(""),false,13)
to
Ruby:
$game_variables[5]=pbEnterPokemonName(_INTL("{1}'s nickname?", species),
0, 13, "", pkmn)
I've done this without any restrictions apart from the egg, because I think the trend of not naming Shadow/Foreign Pokemon is dumb. But you could easily implement that by adding a little conditional branch.
Go back to this section:
Ruby:
commands[cmdSwitch = commands.length] = _INTL("Switch") if @party.length>1
if !pkmn.egg?
if pkmn.mail
commands[cmdMail = commands.length] = _INTL("Mail")
else
commands[cmdItem = commands.length] = _INTL("Item")
end
commands[cmdRename = commands.length] = _INTL("Rename")
end
Ruby:
if !pkmn.isForeign?($Trainer) && !pkmn.isShadow?
And then just add another "end" after the line:
Ruby:
commands[cmdRename = commands.length] = _INTL("Rename")
- Credits
- Credits to TechSkylander1518, please!