• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

v21.1 Ability Swapper Script that Displays Pokemon Abilities! 1.69

This resource pertains to version 21.1 of Pokémon Essentials.
Pokémon Essentials Version
v21 ➖
I got sick of grinding for cash to buy overpriced Ability Capsules and breeding/glitching/grinding/save-scumming/save-editing for abilities, but I also got sick of lazily coded NPCs who want me to choose between "Ability 1, Ability 2, and Ability 3", whatever that means to the average end user. Might as well ask the player if he wants his ability value set to 0, 1, or 2. A player can always check the documentation, but you know the UI isn't ideal if the player is forced to use external resources like game documentation to understand the game.



In the name of increased user friendliness, I am releasing this script to the world. Do with it what you will and make your Pokemon games better.

Code:
#Jason Godwyn's Pokeditor Ability Changer
def pbChangeAbilityJason
  commands = []
  ids = []
  $Trainer.party.each do |pokemon|
    next if pokemon.egg?
    commands.push("#{pokemon.name} (Ability: #{ability_name(pokemon.ability)})")
    ids.push(pokemon)
  end
  commands.push(_INTL("[Cancel]"))
  cmd = -1
  loop do
    msg = _INTL("Choose a Pokémon to change its ability.")
    cmd = pbMessage(msg, commands, -1)
    break if cmd < 0 || cmd >= commands.length - 1
    pokemon = ids[cmd]
    ability_commands = []
    ability_ids = []
  
    # Retrieve the list of abilities the Pokémon can learn based on species
    ability_list = pokemon.species_data.abilities
  
    # Append Hidden Ability to the list if available
    hidden_ability = GameData::Ability.get(pokemon.species_data.hidden_abilities[0]) if pokemon.species_data.hidden_abilities.length > 0
    ability_list.push(hidden_ability) if hidden_ability
  
    ability_list.each do |ability_id|
      ability = GameData::Ability.get(ability_id)
      ability_name = ability_name(ability.id)
      next if ability_ids.include?(ability.id)  # Skip duplicate abilities
      ability_commands.push(_INTL("{1}", ability_name))
      ability_ids.push(ability.id)  # Add the ability ID to the array
    end
  
    ability_commands.push(_INTL("[Reset]"))
    ability_commands.push(_INTL("[Back]"))
    loop do
      ability_cmd = pbMessage("Select an ability.", ability_commands, 0)
      break if ability_cmd < 0 || ability_cmd >= ability_commands.length - 1
    
      if ability_cmd >= 0 && ability_cmd < ability_commands.length - 2   # Set ability
        pokemon.ability = ability_ids[ability_cmd]  # Retrieve the ability ID from the array
        pbMessage(_INTL("{1}'s ability is set to {2}.", pokemon.name, ability_name(pokemon.ability)))
        # Update the Pokémon's name and ability in the commands array
        commands[cmd] = "#{pokemon.name} (Ability: #{ability_name(pokemon.ability)})"
        break
      elsif ability_cmd == ability_commands.length - 2   # Reset
        pokemon.ability = nil
        pbMessage(_INTL("{1}'s ability has been reset.", pokemon.name))
        # Update the Pokémon's name and ability in the commands array
        commands[cmd] = "#{pokemon.name} (Ability: #{ability_name(pokemon.ability)})"
        break
      elsif ability_cmd == ability_commands.length - 1   # Back button
        break
      end
    end
  end
end

def ability_name(ability_id)
  return ability_id ? GameData::Ability.get(ability_id).name : "---"
end

Just put this anywhere in your Script Editor, preferably in a newly named window, and get a NPC to run the script "pbChangeAbilityJason"
Credits
SuperSpyroDragon64
Author
SuperSpyroDragon64
Views
1,489
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from SuperSpyroDragon64

Back
Top