Let me give you an short explanation and a link,
ffort Values (also known as EVs) are points that can increase your Pokémon's
stats.
Each Pokémon can have a maximum of 510 EV points. For every 4 EV points you
put into one stat that stat will increase by 1 point at Level 100.
For example: Lets say you have a Lv. 99 Jolteon and you want to raise its
speed, if you fight 4 Rattatas and then give it a Rare Candy your
Jolteon (which will now be at Lv. 100) will gain 1 extra point in
speed than it normally would have.
If trained properly a Pokémon can obtain a total of 127 extra point on its
stats.
There are 2 ways to obtain EVs.
The first way is to use vitamins, each vitamin gives you 10 EV points, but you
can only use 10 of each vitamin. So if you use 10 Calciums, your Pokémon will
gain a total of 100 EV points.
The second way is to fight other Pokémon to obtain the EVs that they give.
Keep in mind that you'll only receive EVs if you obtain Experience points.
You can also speed up the process when fighting Pokémon by giving your Pokémon
a Macho Bracer or if it has Pokerus. Each of these multiply the amount of EVs
gained by 2. So instead of gaining 1 EV for fighting a Rattata you'll get 2
EVs if you have Macho Bracer or Pokerus, but if you have both of these on one
Pokémon you'll get 4 EVs instead of 1.
Although 255 EV points is the maximum for a single stat, you should only put
252 on a stat since 255 is not divisible by 4 and you would be wasteing 3 EVs
that could have gone to a different stat.
There are various restrictions that apply to EVs and they are:
-A maximum of 510 EVs total.
-A maximum of 51 vitamins can be given to one Pokémon.
-A maximum of 10 vitamins for a single stat.
-A maximum of 255 EVs for a single stat.
-EVs must be obtained before Lv. 100.
-Can't obtain EVs in Battle Frontier.
I would suggest that you use vitamins for the stat your planning on growing
first and then fight Pokémon to obtain the rest of the EVs that you need.
Recently I was informed that you can get level 100 Pokémon to gain EVs. To do
so you have to fight Pokémon that you want to get EVs from, after your done
simply deposit the level 100 Pokémon into your PC and take it back out. Its
stats will be recalculated based off the EVs you gained before you deposited
the Pokémon into your PC.
A new addition to the Emerald version is the ability to take away EVs from
your Pokémon by feeding certain berries to them. Here is a list of the berries
that take away EVs.
link to EV FAQ on Gamfaqs were I got my info from
I looked up on IV's = Independent Values and it was waaaay to complex to post up so I put a link instead,
http://db.gamefaqs.com/portable/gbadvance/file/pokemon_emerald_mech.txt
The second link has all the algorithims you'll ever need and more. If you want to implement this then it will (like I said) be hell to script but it's your game and you could simplify it some way...
~RoaringSasuke (the bringer of knowledge)