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

EV trainer's pokémon Formula

44
Posts
6
Years
  • Hello everyone!
    Today I will treat an important feature of Pokemon Fan games: EVs of Trainers' Pokémon.
    For those who doesn't know, the formula provided by the standard Essentials engine lacks of flexibility due to the fact that it must be applied to every pokémon and it's not easy to adapt different EV builds based on the specific species. It already exists a script to manually build the EVs of each pokémon. It can be a bit tedious but it provides an useful feature. For those interested, I will link it at the bottom of the post.

    Now I will describe the features of the formula:
    • Applies AUTOMATICALLY to every trainer's pokémon to set EVs (and IVs) based on the Base Stats of the pokémon;
    • The levelcap parameter denotes the level from where all the 510 EVs will be distributed and all IVs will be equal to 31; The use of a quadratic ratio helps to smooth the proportion of the total 510 in the level below levelcap. Note: that levelcap is set at level 50 now, you can change as you prefer, basing your choice on the difficulty curve you desire for your game.
      e.g. Consider a pokémon at level 10 with levelcap=50. Then the total EVs that will be distributed among the stats will be: 510*(10/50)^2=20;
      Other examples:
      level 20 and levelcap=50 -> Total Evs=82
      level 30 and levelcap=50 -> Total Evs=184
      level 40 and levelcap=50 -> Total Evs=326
      level 50 and levelcap=50 -> Total Evs=510
      level 60 and levelcap=50 -> Total Evs=510
      (changing the levelcap we could have:
      level 65 and levelcap=70 -> Total EVs= 440)
    • There is the possibility to have builds with EVs more concentrated in less Stats ( think about a sweeper with most EVs on Attack and Speed). To use this feature, just set to true a game switch XXX and use the number of the switch that you prefer and insert that number in the appropriate spot inside the formula instead of XXX. In the formula the exact place is :if $game_switches[XXX]==true
    • In case your game features EVs greater than 510 ( the standard value of every pokémon series), change the parameter remaining_ev

    Installation:
    Find in PTrainer_NPCTrainers the following code (around line 82, right after pokemon.setNature(poke[TPNATURE]) )
    Code:
    iv=poke[TPIV]
          for i in 0...6
            pokemon.iv[i]=iv&0x1F
            pokemon.ev[i]=[85,level*3/2].min
          end

    And replace it with:
    Code:
    #EV IV Formula by Rekman. Credit Pokémon Desiderium ONLY if you want. 
    #No credit needed. Enjoy :)
    bs=pokemon.baseStats
    levelcap=50
    levelperc=[100*pokemon.level**2/levelcap**2,100].min
    bsmin=bs.min
    remaining_ev=510            
    for i in 0...6
        bs[i]-=bsmin-1
    end      
    if $game_switches[XXX]==true    #insert here the number of the switch instead of XXX
            if bs[1]> 2*bs[4]
              bs[1]+=bs[4]-1
              bs[4]=1
            elsif bs[4]> 2*bs[1]
            bs[4]+=bs[1]-1
            bs[1]=1
            end
            if bs[0]> 2*bs[3]
              bs[0]+=bs[3]-1
              bs[3]=1
            else           #elsif bs[3]> 2*bs[0]
              bs[3]+=bs[0]-1
              bs[0]=1
            end
    end      
    sumbs=0
    reserve_ev=0
    for i in 0...6
          sumbs+=bs[i]
    end            
    for i in 0...6
            pokemon.iv[i]=31*levelperc/100
            pokemon.ev[i]=[levelperc*remaining_ev*bs[i]/(100*sumbs),252].min  
            remaining_ev-=pokemon.ev[i]
            sumbs-=bs[i]
            reserve_ev+=pokemon.ev[i] % 4
            pokemon.ev[i]-=pokemon.ev[i] % 4
            if pokemon.ev[i]==4
               reserve_ev+=pokemon.ev[i]
               pokemon.ev[i]-=pokemon.ev[i]
            end
    end
    pokemon.ev[pokemon.ev.index(pokemon.ev.max)]=[252,pokemon.ev[pokemon.ev.index(pokemon.ev.max)]+reserve_ev].min

    So, everything nice, but how does it actually work? Let's see some examples: (results will be proportionated based on level and levelcap, but for sake of simplicity and comparability matters, all of the following example will be at level equal or greater than levelcap, and with the dedicated Switch set to TRUE)
    • Starmie, level 50 or more with levelcap=50: (Special attacker)
      EV: hp=0,atk=0,def=76,speed=182,sp.atk=172,sp.def=80 (IVs= all 31)
    • Excadrill (Physical attacker)
      EV: hp=0,atk=204,def=24,speed=246,sp.atk=0,sp.def=36
    • Salamence (Mixed attacker)
      EV: hp=0,atk=242,def=0,speed=144,sp.atk=124,sp.def=0
    • Shuckle (Defensive)
      EV: hp=16,atk=0,def=252,speed=0,sp.atk=0,sp.def=240
    • Nidoqueen (all stats are similar)
      EV: hp=140,atk=154,def=108,speed=8,sp.atk=8,sp.def=92

    I hope everything is alright, let me know and report potential errors!
    COMPATIBLE WITH 17.2! (can't ensure it works for other versions)
    Thanks to mgriffin and WolfPP for the support :)
    __________
    The MANUAL alternative to this script by
    DoesntKnowHowToPlay:
    https://www.pokecommunity.com/showthread.php?t=359588
    P.S. If someone is enough able with coding, a great idea would be using my formula to set EVs and IVs in case the parameter of DoesntKnowHowToPlay's Script are not specified. (I am not that able ahaha)
     
    Last edited:

    Juno and Ice

    Developer of Pokémon Floral Tempus
    150
    Posts
    5
    Years
    • Seen Apr 30, 2024
    How does it know what EV's to distribute where. Is that dependent on the Pokémon? For example how would it differentiate a physical sweeping Mega Altaria, from a Special sweeping one.
     
    Last edited:
    44
    Posts
    6
    Years
  • How does it know what EV's to distribute where. Is that dependent on the Pokémon? For example how would it differentiate a physical sweeping Mega Altaria, from a Special sweeping one.

    As described in the post, the formula applies to the base stats of the pokemon. It applies automatically, without any input by the game developer. So, if you take for example "mega altaria", the formula obviously will consider Altaria (and not th Mega, since the mega evolution occurs later during the battle). So, let's take altaria base stats:
    HP 75
    ATK 70
    DEF 90
    SP.ATK 70
    SP.DEF 105
    SPEED 80

    As you see, the formula will assign the same EVs to both Atk and Sp.Atk since they are both 70. Note that for the formulation inside the formula, 0 Evs will be attributed to both stats since they are the lowest stats retained by Altaria.
    The basic concept is: don't pretend that the formula is somehow magic. In my opinion, with 80% of pokemon or more, it builds up a good balanced build that focuses on strenghten up the strong point of the pokemon itself. Altaria is basically a defensive pokemon, so the formula will end up in building altaria as one. See my formula as a very valid alternative to the one provided by Vanilla Essentials, that attributes 1/6 of total EV to each stat.
    IF you are interested in having a specific hand-written EV build for only few specific trainers (maybe a gym leader or boss) but you are also interested in this formula, I suggest you to modify a bit my formula to implement the "DoesntKnowHowToPlay" manual alternative. Now that I am more expirienced on ruby language I could even do it, but at the moment I have other priorities (maybe later on I will update it, but this formula doesn't seem interesting to the community).
    If you want to give a try, it would be very appreciated.

    I hope to have solved your doubts :) you are welcome
     
    Back
    Top