• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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
6
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.
     

    Ego13

    hollow_ego
    311
    Posts
    6
    Years
  • 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
     

    Gyro Zeppeli

    The Best Zeppeli
    10
    Posts
    6
    Years
    • Seen Aug 11, 2018
    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!
     

    Gyro Zeppeli

    The Best Zeppeli
    10
    Posts
    6
    Years
    • Seen Aug 11, 2018
    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:

    Ego13

    hollow_ego
    311
    Posts
    6
    Years
  • 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
     

    Gyro Zeppeli

    The Best Zeppeli
    10
    Posts
    6
    Years
    • Seen Aug 11, 2018
    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.
     

    Ego13

    hollow_ego
    311
    Posts
    6
    Years
  • 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