• 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?".
  • Staff applications for our PokéCommunity Daily and Social Media team are now open! Interested in joining staff? Then click here for more info!
  • 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.

Defining a trade according to catch rate

Schrroms

Pokémon Infinite Fusion dev
  • 335
    Posts
    9
    Years
    Basically I'd like to have a NPC that will trade with the player for any Pokémon that has a catch rate lower than 50.

    But rareness isn't a property defined for a Pokemon. But I know it exists somewhere since it's one of the required fields when defining a species. So my question is, how do I access the rareness attribute of a Pokémon?


    Edit: I figured something out, so I guess this thread is now a tutorial.

    I went into the PokeBattle_Pokemon script and added the following

    attr_accessor(:rareness) # Capture rate
    in the beginning section

    and

    def rareness
    dexdata=pbOpenDexData
    pbDexDataOffset(dexdata,@species,16)
    ret=dexdata.fgetb
    dexdata.close
    return ret
    end


    (Pretty much anywhere should be fine I think. I personally added it between def growthrate and def baseExp, at line 146)

    Then, in the npc event, the script call command to make the player select a Pokémon looks like this


    pbChoosePokemon(1,2,
    proc {|poke|
    !poke.egg? &&
    !(poke.isShadow? rescue false) &&
    poke.rareness<=50
    })

    And that's it!
    Though if someone could come up with a solution that doesn't involve editing the scripts it could be nice.
     
    Last edited:
    Back
    Top