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

What do you think of my basic level up system?

TehSquidly

. . .
103
Posts
15
Years
  • About this engine
    This was made in Flash CS3 using AS2, I was experimenting with arrays if you dont know what those are. They hold tons of data using unique names,numbers and variables anyway.

    I made this for my upcoming game I've been working on for awhile I decided to make to start over and make this. It's not exactally like the original as you can tell and I didnt include evolution because I would just be recycling old formulas and a waste of time for this test.

    How it works
    So the basic things this engine does is hold information on pokemon you've caught with variables like : Name,Type etc.

    As you level up it replaces stored moves with newer ones just like in the original along with the type of the move using this array
    var Zubatb:Object = {lv:2,gender:"male",type:"Flying/Poison",named:"Zubat",hp:40,atk:45,def:35,spc:40,spe:55,moves:"Leech Life",move:"Bug",move1:"-----",move2:"-----",move3:"-----",moves1:"-----",moves2:"-----",moves3:"-----",notype:"-----"};

    And the current way I'm having the pokemon gain stats is by having a random number depending on what there best at
    _root.Zubatb.lv ++;_root.gogogo.gotoAndStop(1);
    hp = Math.round(Math.random()*3)
    atk = Math.round(Math.random()*4)
    def = Math.round(Math.random()*2)
    spc = Math.round(Math.random()*3)
    spe = Math.round(Math.random()*5)
    _root.Zubatb.hp += hp;
    _root.Zubatb.atk += atk;
    _root.Zubatb.def += def;
    _root.Zubatb.spc += spc;
    _root.Zubatb.spe += spe;

    I dont really like that idea for increasing stats. Do you have any tips on how I can make this better? Thanks.

    Preview

     

    rm2kdude

    Advanced Pixel-Artist
    358
    Posts
    19
    Years
    • Age 35
    • usa
    • Seen Oct 30, 2022
    That's not bad at all, that's generally how it's done. Of course each RPG uses it's own formula.
     
    2,048
    Posts
    16
    Years
    • Seen Sep 7, 2023
    Firstly, isn't ActionScript 2 an object-oriented language? If it is, you'll want to make a Pokemon class with instance variables rather than simply lumping everything in an array. This will make it much easier to create new Pokemon objects, and let you have instance methods/functions (such as a calculateStats function, which would be called when it levels up, is placed in the PC, or has a vitamin used on it).

    Anyway, for the stats, you want to use the Pokémon stat formula; it's pretty simple. You'll need to first load the Pokémon's base stats (for Zubat, it's 40/45/35/30/40/55); I recommend doing this from a file if possible.
    To get the Pokémon's stats (other than HP), take the base stat and double it. Then, add its IV (genes). Add a quarter of the EVs (effort values, rounded down). Multiply by the Pokémon's level, then divide by 100 (rounding down). Add 5 (the basic stat; what it would have at level 0). Finally, if the Pokémon has an advantageous nature (e.g. Hasty boosts Speed), multiply the stat by 1.1; if it has a disadvantageous nature (e.g. Relaxed nature lowers Speed), multiply it by 0.9.
    HP is similar; however, after adding IVs and EVs, add 100 extra (so the Pokémon's HP is always higher than its level), and instead of adding 5 for its level 0 stat, add 10. There are no natures that influence HP, so you can ignore that part.
    If you don't know how IVs and EVs work, they're a set of values for each stat (Each stat has separate IVs and EVs). IVs are set to a random number between 0 and 31 when the Pokémon is created (this gets a bit more complicated when you breed, as there's an inheritance system); they never change after that. EVs start at 0, and are increased every time you KO a Pokémon and gain Exp. There's a limit of 255 per stat, and 510 total (so you can only max out two stats, or get an average of 85 in each stat). You don't have to include them; they simply mean two Pokémon of the same level and species still have individual stats (this basically achieves what your rand functions did).
    It might also be useful to have all the stats in an array rather than as separate elements, so you can iterate through them. In pseudocode, the calculateStats function would be:
    Code:
    FUNCTION calculateStats
     INT[6] baseStats = loadBaseStats(species)
     INT natureBoost = 10 // we'll use 9 for lowering, 10 for unaffected, and 11 for increasing
     IF baseStats[0] == 1 THEN // Shedinja always has 1 HP
      stats[0] = 1
     ELSE
      stats[0] = (((baseStats[0] * 2) + iv[0] + (ev[0] / 4) + 100) * level) / 100 + 10 // if using integer variables, rounding down should be done automatically; otherwise, use the Math.floor function
     END IF
     FOR INT i = 1 TO 6
      natureBoost = getNatureBoost(nature, i)
      stats[i] = (((((baseStats[0] * 2) + iv[0] + (ev[0] / 4)) * level) / 100 + 5) * natureBoost) / 10
     NEXT i
    END FUNCTION

    Also, using strings for things like species, type and moves is wasteful; you can have an integer variable instead, and when you need to display the move/species name, load it from a list. For example, instead of having its species as "Zubat" (6 bytes), it could just be 41 (1 byte). To store any Pokémon name, you'd need 11 bytes (10 characters plus a terminator); to store its species number, you only need 2. It also lets you reference data arrays easily (such as a base stats table or a level up moves table); if you stored the whole species name, you'd have to first find out what number it is, and only then could you reference the table.

    Hope this helps!

    EDIT: The way I described IVs and EVs is for 3rd gen and above; looking again, I noticed your system seems to be similar to the 1st generation (no separation of Sp. Atk and Sp. Def). The basic formula is still very similar, though. Try searching it on Google or something.
     
    Back
    Top