• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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
12
Years
  • Seen Jun 1, 2018
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!
 

Worldslayer608

ಥдಥ
894
Posts
16
Years
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:
401
Posts
19
Years
  • Age 29
  • Seen Dec 4, 2016
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.
 

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
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
 
11
Posts
12
Years
  • Seen Jun 1, 2018
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!
 

Worldslayer608

ಥдಥ
894
Posts
16
Years
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