- Pokémon Essentials Version
- v20.1 ➖
This code will open a menu with all the Pokemon in your party, allow you to select a Pokemon in your party, show you a list of all Natures in your game with their positive/negative effect displayed, and allow the player to select a nature to instantly apply to his Pokemon.
No Mints, no Price, no immersion-breaking shenanigans, no "my nature is x but a mint overwrites some of it to y". This Nature Changer... It just works.
Simply copypaste the following code anywhere you want into your Script Editor (I recommend making a new page for this) and then give any NPC or Key Item (or even a NPC you can phone!) a Script line with the code "pbChangeNature".
No Mints, no Price, no immersion-breaking shenanigans, no "my nature is x but a mint overwrites some of it to y". This Nature Changer... It just works.
Simply copypaste the following code anywhere you want into your Script Editor (I recommend making a new page for this) and then give any NPC or Key Item (or even a NPC you can phone!) a Script line with the code "pbChangeNature".
Code:
def pbChangeNature
commands = []
ids = []
$Trainer.party.each do |pokemon|
next if pokemon.egg?
commands.push("#{pokemon.name} (#{GameData::Nature.get(pokemon.nature).real_name})")
ids.push(pokemon)
end
commands.push(_INTL("[Cancel]"))
cmd = -1
loop do
msg = _INTL("Choose a Pokémon to change its nature.")
cmd = pbMessage(msg, commands, -1)
break if cmd < 0 || cmd >= commands.length - 1
pokemon = ids[cmd]
nature_commands = []
nature_ids = []
GameData::Nature.each do |nature|
if nature.stat_changes.empty?
nature_commands.push(_INTL("{1} (---)", nature.real_name))
else
plus_text = ""
minus_text = ""
nature.stat_changes.each do |change|
if change[1] > 0
plus_text += "/" if !plus_text.empty?
plus_text += GameData::Stat.get(change[0]).name_brief
elsif change[1] < 0
minus_text += "/" if !minus_text.empty?
minus_text += GameData::Stat.get(change[0]).name_brief
end
end
nature_commands.push(_INTL("{1} (+{2}, -{3})", nature.real_name, plus_text, minus_text))
end
nature_ids.push(nature.id)
end
nature_commands.push(_INTL("[Reset]"))
nature_commands.push(_INTL("[Back]"))
loop do
nature_cmd = pbMessage("Select a nature", nature_commands, 0)
break if cmd < 0 || cmd >= commands.length - 1
if nature_cmd >= 0 && nature_cmd < nature_commands.length - 2 # Set nature
pokemon.nature = nature_ids[nature_cmd]
pbMessage(_INTL("{1}'s nature is set to {2}.", pokemon.name, GameData::Nature.get(pokemon.nature).real_name))
# Update the Pokémon's name and nature in the commands array
commands[cmd] = "#{pokemon.name} (#{GameData::Nature.get(pokemon.nature).real_name})"
break
elsif nature_cmd == nature_commands.length - 2 # Reset
pokemon.nature = nil
pbMessage(_INTL("{1}'s nature has been reset.", pokemon.name))
# Update the Pokémon's name and nature in the commands array
commands[cmd] = "#{pokemon.name} (#{GameData::Nature.get(pokemon.nature).real_name})"
break
elsif nature_cmd == nature_commands.length - 1 # Back button
break
end
end
end
end
- Credits
- Me
I learned how to make this by looking at the Pokemon Essentials Debug code for changing a Pokemon's Nature. So Credit also goes to whoever wrote that in Pokemon Essentials.