Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Pokémon Essentials

Notices
For all updates, view the main page.

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.



Reply
Click here to go to the first staff post in this thread.  
Thread Tools
  #1    
Old December 12th, 2013 (12:28 PM).
Cuflock's Avatar
Cuflock
 
Join Date: Mar 2012
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(ANLBALL,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!
Reply With Quote
  #2    
Old December 12th, 2013 (12:37 PM). Edited December 12th, 2013 by Worldslayer608.
Worldslayer608's Avatar
Worldslayer608
ಥдಥ
Community Supporter
 
Join Date: Mar 2008
Location: San Diego
Age: 25
Gender: Male
Nature: Calm
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.
__________________


Pokemon Pillars of Destiny - Starters
To vanquish without peril is to triumph without glory...

Voted Best Game Designer 2011 on PC
Reply With Quote
  #3    
Old December 12th, 2013 (12:52 PM).
Cuflock's Avatar
Cuflock
 
Join Date: Mar 2012
I tried, still doesn't work
Reply With Quote
  #4    
Old December 12th, 2013 (02:38 PM).
Alexandre's Avatar
Alexandre
 
Join Date: Mar 2005
Age: 20
Nature: Lonely
Quote originally posted by Cuflock:
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(ANLBALL,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.
Reply With Quote
  #5    
Old December 12th, 2013 (03:07 PM).
Maruno's Avatar
Maruno
Lead Dev of Pokémon Essentials
 
Join Date: Jan 2008
Location: England
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=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
__________________
Reply With Quote
  #6    
Old December 12th, 2013 (03:40 PM).
Cuflock's Avatar
Cuflock
 
Join Date: Mar 2012
Quote originally posted by Maruno:
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=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!
Reply With Quote
  #7    
Old December 12th, 2013 (03:47 PM).
Worldslayer608's Avatar
Worldslayer608
ಥдಥ
Community Supporter
 
Join Date: Mar 2008
Location: San Diego
Age: 25
Gender: Male
Nature: Calm
Quote originally posted by Alexandre:
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

Quote originally posted by Maruno:
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=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.
__________________


Pokemon Pillars of Destiny - Starters
To vanquish without peril is to triumph without glory...

Voted Best Game Designer 2011 on PC
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 11:09 PM.