Pokemon Catch System by Labox
Release date:January 23, 2011
EDIT: Actually explained the the formulas after the main common event
This event is based off of the Pokemon catching system in popular pokemon games. It requires at least 2 common events, at least 2 switches, and about 14 variables. I probably could have done it in less variables, but that would have added potential errors. In order to catch an enemy, you need an Item to do it, such as this one.
After you create the item and before we start the eventing, we need to define our variables. Mine are not well organized, but they are lined up like this
Ball stands for the type of ball's multiplier, pokeballs being x1, great balls being x2, ultra balls being x3, and master balls being x255.
Shakes stands for the number of shakes the pokeball will shake.
Status is the status multiplier; the more conditions inflicted on the enemy, the easier it is to catch.
A and B are going to be used for a couple of algebra equations that makes what the catch system is. More on that later.
Rand.1 - 4 are random numbers generated every time a ball is thrown.
You also will need one switch for every type of enemy you can catch. I have 4 pokemon in the tutorial so I have 4 switches. You will also need a 'disable catch' switch that makes it impossible to catch the pokemon.
Now that that is out of the way, We need to do a little bit of troop tweaking. Observe the following pictures.
You may be asking what the Enemy switches are for. We will get to that when we are in the main common event. Right now we need to set up a common event that acts like a database for what pokemon you will be adding.
As the comment in the last screen said, you must have actors customized to look like the enemy you are to catch.
And now for the main attraction, the actual catching common event. There are 2 formulas that I will explain after the screenshot. I made it so that no text repeats from shot to shot to reduce confusion.
The two formulas within that event are used to determine whether or not the enemy is caught. It runs variables through a complex formula that doesn't make much sense to me or you. After the first equation is done, it takes that answer and plugs the answer into an equation that requires 4th roots (thanks BigEd for the help on that topic) and other crazy long numbers. When that answer is found, 4 numbers are generated randomly and checked against it to see if the random numbers are less than the equations answer. All of this info can be found on bulbapedia.
EDIT: The following explanation was directly taken from bulbapedia
The exact formula is as follows:
- HPmax is the number of hit points the Pokemon has at full health,
- HPcurrent is the number of hit points the Pokemon has at the moment,
- rate is the catch rate of the Pokemon,
- bonusball is the multiplier for the PokeBall used, and
- bonusstatus is the multiplier for any status ailment the Pokemon has (2 for sleep and freeze, 1.5 for paralyze, poison and burn).
Given this formula, the maximum value for a (if the Pokemon could have 0 HP) would be catch rate x bonusball x bonusstatus. The minimum value for a (for a Pokemon with full health) would be ⅓ x catch rate.
Calculate b as follows:
Then generate 4 random numbers between 0 and 65535, inclusive. For each number, check whether it's less than b; if so, the ball shakes once. If any number is greater than or equal to b, the Pokemon immediately breaks free. If all four of the numbers are less than b, then the Pokemon is caught. Note that if a is 255 or greater, then b is 65535 or greater, and then the Pokemon is guaranteed to be caught.
For every type of ball, you will want to recopy this event to another common event slot and change the ball variable to whatever your heart desires.Demo: MediafireCredit:
I used Celiana's tree graphics in the demo because they are just awesome and they fit the mood of the game perfectly.
All Pokemon graphics were found at the Spriters Resource
Pokemon, Pokeballs, etc. are trademarks of Gamefreak, Nintendo, and probably some other companies.
This post has been edited by labox: Feb 6 2011, 04:42 PM