Rinkoou
Awful-Pun Master
- 54
- Posts
- 8
- Years
- the Internet
- Seen Jul 27, 2018
Hello! I've been trying to add a feature which I've been wanting for a while, which is renaming your Pokemon within the party screen. Using Ego13's PokeID script as a base, I've made this abomination:
Not surprisingly, it doesn't work. If anybody could help with it, I'd greatly appreciate it!
Code:
module PokemonRename
def pbPokemonRenameCommand
commands.add("main","rename",_INTL("Rename"))
return commands
end
def pbPokemonRenameAction(command,pkmn,pkmnid,heldpoke=nil)
case command
when "rename"
cmd = 0
loop do
speciesname = PBSpecies.getName(pkmn.species)
msg = [_INTL("{1} has the nickname {2}.",speciesname,pkmn.name),
_INTL("{1} has no nickname.",speciesname)][pkmn.name==speciesname ? 1 : 0]
cmd = scene.pbShowCommands(msg,[
_INTL("Rename"),
_INTL("Erase name")],cmd)
break if cmd<0
case cmd
when 0 # Rename
oldname = (pkmn.name && pkmn.name!=speciesname) ? pkmn.name : ""
oldname = speciesname if oldname==""
newname = pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname),
0,PokeBattle_Pokemon::NAMELIMIT,oldname,pkmn)
if newname && newname!="" && !pokemon.isForeign?($Trainer)
pkmn.name = newname
scene.pbRefresh
elsif newname && newname!="" && pokemon.isForeign?($Trainer)
scene.pbDisplay(_INTL("#{newname} doesn't seem to react to its new name. You quickly went back to calling it #{oldname}."))
pokemon.name=oldname
scene.pbRefresh
end
when 1 # Erase name
oldname = (pkmn.name && pkmn.name!=speciesname) ? pkmn.name : ""
if !pokemon.isForeign?($Trainer)
pkmn.name = speciesname
scene.pbRefresh
elsif pokemon.isForeign?($Trainer) && oldname!=""
scene.pbDisplay(_INTL("#{speciesname} doesn't seem to react. You quickly went back to calling it #{oldname}."))
scene.pbRefresh
elsif oldname==""
scene.pbDisplay(_INTL("#{speciesname} doesn't have a nickname."))
end
end
end
end
end
Not surprisingly, it doesn't work. If anybody could help with it, I'd greatly appreciate it!