• 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.

Pokeballs that work with the pokemon color.

  • 11
    Posts
    13
    Years
    • Seen Mar 13, 2025
    Hi people! I want to make a pokeball that modifies the catch rate, based on the color of the pokemon.
    I tried making something like this:

    BallHandlers::ModifyCatchRate.add(:SANLBALL,proc{|ball,catchRate,battle,battler|
    catchRate*=3 if battler.pbHasColor?(:Blue) || battler.pbHasColor?(:Red)
    next catchRate

    But it doesn't work, any ideas?
    Thanks in advance!
     
    Try changing battler.pbHasColor to pokemon.pbHasColor. You want it to look at the pokemon itself, not the battler as the battler does not actually have any color.
     
    Last edited:
    Hi people! I want to make a pokeball that modifies the catch rate, based on the color of the pokemon.
    I tried making something like this:

    BallHandlers::ModifyCatchRate.add(:SANLBALL,proc{|ball,catchRate,battle,battler|
    catchRate*=3 if battler.pbHasColor?(:Blue) || battler.pbHasColor?(:Red)
    next catchRate

    But it doesn't work, any ideas?
    Thanks in advance!
    There is no method pbHasColor? in essentials, you'll have to extend that functionality yourself. To me its not a very easy functionality to implement. You'd have to run an algorithm to find the hex/rgb code of the average colour of the pokemon and then group codes into primary colour groups. That would give you functionality close to what you desire.

    Alternatively, you could define a colour variable on the pokemon class and give each pokemon a colour but that would be a tedious task.
     
    You can get the colour of the Pokémon being captured, as defined in pokemon.txt for its species, with the following code:
    Code:
    dexdata=pbOpenDexData
    pbDexDataOffset(dexdata,battler.pokemon.species,6)
    [COLOR=Red]color[/COLOR]=dexdata.fgetb
    dexdata.close
    color will be a number, so you'll need to compare it with another number. The numbers are as follows (by default):

    0 = Red
    1 = Blue
    2 = Yellow
    3 = Green
    4 = Black
    5 = Brown
    6 = Purple
    7 = Gray
    8 = White
    9 = Pink
     
    You can get the colour of the Pokémon being captured, as defined in pokemon.txt for its species, with the following code:
    Code:
    dexdata=pbOpenDexData
    pbDexDataOffset(dexdata,battler.pokemon.species,6)
    [COLOR=Red]color[/COLOR]=dexdata.fgetb
    dexdata.close
    color will be a number, so you'll need to compare it with another number. The numbers are as follows (by default):

    0 = Red
    1 = Blue
    2 = Yellow
    3 = Green
    4 = Black
    5 = Brown
    6 = Purple
    7 = Gray
    8 = White
    9 = Pink

    Excellent! Thanks Maruno!
     
    There is no method pbHasColor? in essentials, you'll have to extend that functionality yourself. To me its not a very easy functionality to implement. You'd have to run an algorithm to find the hex/rgb code of the average colour of the pokemon and then group codes into primary colour groups. That would give you functionality close to what you desire.

    Alternatively, you could define a colour variable on the pokemon class and give each pokemon a colour but that would be a tedious task.

    I made the assumption that they already must have defined it somewhere and then on my way to work it dawned on me that it probably was not defined. I felt bad leaving before getting a chance to edit my post. So I am glad you got to saying it in the meantime :P

    You can get the colour of the Pokémon being captured, as defined in pokemon.txt for its species, with the following code:
    Code:
    dexdata=pbOpenDexData
    pbDexDataOffset(dexdata,battler.pokemon.species,6)
    [COLOR=Red]color[/COLOR]=dexdata.fgetb
    dexdata.close
    color will be a number, so you'll need to compare it with another number. The numbers are as follows (by default):

    0 = Red
    1 = Blue
    2 = Yellow
    3 = Green
    4 = Black
    5 = Brown
    6 = Purple
    7 = Gray
    8 = White
    9 = Pink

    This is actually pretty awesome. I am glad that this question was asked because when I was thinking about this kind of ball the other day I dismissed it because I did not want to have to define anything to get it working... because I am terrible with writing anything haha. This actually saves me a lot of heartache so I can revisit the idea of these kind of balls.
     
    Back
    Top