• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • 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] Hidden abilities in the wild

Guest123123

Guest
  • 0
    Posts
    I was just made aware of an issue in my game where Pokemon with two abilities (including the hidden one) can be found in the wild with either their natural or hidden ability, but ones with three possible abilities will only have the two natural ones.

    I had copied the ability data from Reborn's PBS file pokemon.txt. I thought it was strange that Pokemon with three abilities were still listed as having one hidden, but since it works in Reborn with no issues, I assumed that was how it was done, but then I learned the ability data there for that just relates to the chances of a Pokemon having a certain ability. I asked Ame, Reborn's creator, what else needs to be done, but upon copying the ability script in Reborn I got an error with the base stat section in Pokemon_MultipleForms. Ame said it could possibly be an issue with changed code since then as Reborn uses an older version of Essentials.

    So basically, does anyone know what I would need to do with the ability script in PokeBattle_Pokemon in order to enable hidden abilities in v16.2? Note that I'm not trying to force a specific event Pokemon to have an HA (the Essentials wiki already mentions how to do that), I'm trying to make hidden abilities appear on wild Pokemon just like their natural abilities do.
     
    Last edited by a moderator:
    Code:
    Events.onWildPokemonCreate+=proc {|sender,e|
       abil=pokemon.getAbilityList
       if abil[abil.length-1][1] >= 2 && rand(100)<[COLOR="Red"]10[/COLOR]
         hiddenabil=[]
         for i in abil
           hiddenabil.push(i) if i[1] >= 2
         end
         pokemon.setAbility(hiddenabil[rand(hiddenabil.length)][1])
       end
    }

    This gives wild Pokemon a 10% chance of having a Hidden Ability. If you give the species more than one HA, it'll still be a 10% chance combined, but which one it will be is random.

    Put it in PField_EncounterModifiers.
     
    Code:
    Events.onWildPokemonCreate+=proc {|sender,e|
       abil=pokemon.getAbilityList
       if abil[abil.length-1][1] >= 2 && rand(100)<[COLOR="Red"]10[/COLOR]
         hiddenabil=[]
         for i in abil
           hiddenabil.push(i) if i[1] >= 2
         end
         pokemon.setAbility(hiddenabil[rand(hiddenabil.length)][1])
       end
    }

    This gives wild Pokemon a 10% chance of having a Hidden Ability. If you give the species more than one HA, it'll still be a 10% chance combined, but which one it will be is random.

    Put it in PField_EncounterModifiers.
    Thank you for the code. However, when I inserted this into the game, it caused a crash for people whenever they encountered a wild Pokemon. I had the thread in printable version as recommended whenever copying code, so it wasn't the forum breaking it. Is it possible that I had it under the wrong section (I put it at the bottom under the random dungeon script), or that something else in the script conflicted with the code?
     
    Thank you for the code. However, when I inserted this into the game, it caused a crash for people whenever they encountered a wild Pokemon. I had the thread in printable version as recommended whenever copying code, so it wasn't the forum breaking it. Is it possible that I had it under the wrong section (I put it at the bottom under the random dungeon script), or that something else in the script conflicted with the code?

    I'm checking in v16.2, and it looks like it should be compatible. I don't know why it isn't. Will check in a clean version of v16.2

    EDIT found the problem.

    Code:
    Events.onWildPokemonCreate+=proc {|sender,e|
       [COLOR="Blue"]pokemon=e[0][/COLOR]
       abil=pokemon.getAbilityList
       if abil[abil.length-1][1] >= 2 && rand(100)<10
         hiddenabil=[]
         for i in abil
           hiddenabil.push(i) if i[1] >= 2
         end
         pokemon.setAbility(hiddenabil[rand(hiddenabil.length)][1])
       end
    }

    I forgot the blue line.
     
    Last edited:
    I'm checking in v16.2, and it looks like it should be compatible. I don't know why it isn't. Will check in a clean version of v16.2

    EDIT found the problem.

    Code:
    Events.onWildPokemonCreate+=proc {|sender,e|
       [COLOR="Blue"]pokemon=e[0][/COLOR]
       abil=pokemon.getAbilityList
       if abil[abil.length-1][1] >= 2 && rand(100)<10
         hiddenabil=[]
         for i in abil
           hiddenabil.push(i) if i[1] >= 2
         end
         pokemon.setAbility(hiddenabil[rand(hiddenabil.length)][1])
       end
    }

    I forgot the blue line.
    It works now. Thank you again for the code.
     
    I would like to know how to make the first method work in pokemon essentials v20?
     
    Back
    Top