• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Cyndy, May, Hero (Conquest), or Wes - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] An item that can be used to change a Pokemon's nickname?

Gyro Zeppeli

The Best Zeppeli
  • 10
    Posts
    7
    Years
    • Seen Aug 11, 2018
    I've never liked the fact that you have to go out of your way to visit someone in order to rename your Pokemon. I'd really like to add a key item that could be used to change a Pokemon's nickname, but I'm still somewhat new to Pokemon Essentials and I'm not sure how to code such an item.

    I'm on V17.2, by the way.
     
    I think the easiest way would be to look at the code/event for the name rater and find the line used to choose and rename pkm. And then just make an item out of it
     
    I think the easiest way would be to look at the code/event for the name rater and find the line used to choose and rename pkm. And then just make an item out of it

    I'll give it a try sometime. Thanks!
     
    If you get stuck, feel free to contact me

    I've given it a try, but I'm quite inexperienced with coding. Could you give me a hand by writing some code for the item I'm trying to make?
     
    Absolutely nothing, to be honest. I should've established before that I have essentially no experience coding. I hope it's not too much to ask for some code pro bono. If it is, though, it's perfectly fine.
     
    Last edited:
    First define an Item like this

    605,POKEID,Poke ID,Poke IDs,8,0,"Rename your Pokemon",5,0,6,
    then in the script section PItem_ItemEffects at the end of the section
    Code:
    #===============================================================================
    # UseOnPokemon handlers
    #===============================================================================
    add this
    Code:
    #Poke ID
    ItemHandlers::UseOnPokemon.add(:POKEID,proc{|item,pokemon,scene|
      loop do
          cmds = [_INTL("Give Nickname"),_INTL("Remove Nickname"),_INTL("Cancel")]
          cmd=Kernel.pbMessage(_INTL("What do you want to do?"),cmds,-1)
       
          if cmd==0 # Give Nickname
            pbNickname(pokemon)
          return
          
          elsif cmd==1 # Remove Nickname
            pokemon.name=PBSpecies.getName(pokemon.species)
           return 
          elsif cmd==2 || cmd==-1 #Cancel
            return
          end
        end
    })

    I just added the option to simply remove the nickname. Just in case
     
    First define an Item like this


    then in the script section PItem_ItemEffects at the end of the section
    Code:
    #===============================================================================
    # UseOnPokemon handlers
    #===============================================================================
    add this
    Code:
    #Poke ID
    ItemHandlers::UseOnPokemon.add(:POKEID,proc{|item,pokemon,scene|
      loop do
          cmds = [_INTL("Give Nickname"),_INTL("Remove Nickname"),_INTL("Cancel")]
          cmd=Kernel.pbMessage(_INTL("What do you want to do?"),cmds,-1)
       
          if cmd==0 # Give Nickname
            pbNickname(pokemon)
          return
          
          elsif cmd==1 # Remove Nickname
            pokemon.name=PBSpecies.getName(pokemon.species)
           return 
          elsif cmd==2 || cmd==-1 #Cancel
            return
          end
        end
    })

    I just added the option to simply remove the nickname. Just in case

    It worked perfectly! Thank you so much for the help. Seriously, I won't forget this.
     
    I've never liked the fact that you have to go out of your way to visit someone in order to rename your Pokemon. I'd really like to add a key item that could be used to change a Pokemon's nickname, but I'm still somewhat new to Pokemon Essentials and I'm not sure how to code such an item.

    I'm on V17.2, by the way.

    I improved this item and put it out for everyone to use. You can find it here.
     
    Back
    Top