• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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] Need help programming two new Abilities

  • 3
    Posts
    3
    Years
    Hi! I'm currently working on a Pokémon Essentials fangame, and I wanted help to code two new Abilities.

    The first one is like Illuminate, but instead of making Wild Pokémon more like to appear when the user's at the front of the party, it makes Wild Pokémon more likely to be Shiny when the user's at the front of the party. If possible, I'd also like the Ability to be able to stack with the Shiny Charm, eg. Shiny Charm halves the Shiny odds and the Ability then halves those odds even further.

    The second Ability simply changes the user into a random Type at the end of every turn.

    Thanks in advance! :3
     
    It's likely either version 18.1 or 19.1 but 20.1 has it built in. You can check what version your code is by looking at the very bottom of the Settings script.
     
    Last edited:
    For the first ability, copy the code from the Shiny Charm into a new when statement right after Illuminate in the script Overworld_WildEncounters.
    Code:
            when :ILLUMINATE, :ARENATRAP, :NOGUARD
              encounter_chance *= 2
              min_steps_needed /= 2
            when :SHINYABIL
              2.times do   # 3 times as likely
                break if genwildpoke.shiny?
                genwildpoke.personalID = rand(2**16) | rand(2**16) << 16
              end
            end
    Both copies of the code (Shiny Charm and the new ability) should execute if the Pokémon has both the item and ability.

    As for the second ability, that one can be added into BattleHandlers_Abilities right after Moody.
    Code:
    BattleHandlers::EOREffectAbility.add(:TYPECHANGE,
      proc { |ability,battler,battle|
        types = [] # add between the brackets symbols (:TYPE1) for every type in the game followed by a comma
        battle.pbShowAbilitySplash(battler)
        battler.type1 = types.sample #selects a random element from the types array
        typeName = GameData::Type.get(battler.type1).name
        if battler.effects[PBEffects::Type3] == battler.type1
          battler.effects[PBEffects::Type3] = nil
        end
        battler.type2 = battler.type1
        battle.pbHideAbilitySplash(battler)
        battle.pbDisplay(_INTL("{1} is now a {2} type!",battler.pbThis,typeName))
      }
    )
     
    Back
    Top