• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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.

[Discussion] How Pokémon data is defined

Maruno

Lead Dev of Pokémon Essentials
  • 5,286
    Posts
    17
    Years
    • Seen May 3, 2024
    This is a technical discussion about how particular aspects of a Pokémon (in particular, gender, nature, etc.) are defined.

    As we all know (ahem), a Pokémon's personal ID number defines its gender, nature, ability and shininess. And frankly, it's irritating. There's no way to set all four for a Pokémon at the same time. The nearest we've got is something that sets gender plus nature, and abilityflag which means it doesn't need to be worried about quite as much. There's still shininess, though.

    As mentioned, abilityflag exists, which is an override for the ability. It's very convenient.

    What I was wondering is this: Could/should Essentials have similar override flags for gender, nature and shininess?

    Pros:
    # It'd be easy to change one flag without affecting the other things that depend on the personal ID number, thus making many lives easier.
    # abilityflag already does it, and no one's complaining (I don't think such a thing exists in the official games).
    # Considering trading and all that, compatibility isn't a problem, because a game will tend to only be compatible with itself.

    Cons:
    # It's not how the official games do it.
    # There are still other things that depend on the personal ID number (e.g. Hidden Power), so it can't just be removed.
    # If for some strange reason the flags are ignored, things go screwy (but why would they be ignored?).

    Taking the flag idea to the extreme, they could even replace the personal ID-based calculations, i.e. have nature be rand(25) when the Pokémon is generated, nothing more. As mentioned, the personal ID couldn't be removed completely, but what it is used for could at least be lessened to make lives easier (because who really cares about setting a Pokémon's Hidden Power?).

    Whether it's left as it is, or more flags are added (to whatever extent), Pokémon would look just the same to the player. It's just a matter of how it works in the background.

    Basically, it's a question of convenience versus keeping things working like the official games.

    Thoughts?
     
    Could/should Essentials have similar override flags for gender, nature and shininess?


    pokemon.nature = setNature(nature)
    pokemon.abilityflag = ability
    pokemon.makeShiny
    pokemon.gender = gender

    yet for some reason the pIDs are different,
    you can write a pokemon's internal data by doing this:
    define the pokemon, then do this:

    p pokemon

    It'll print you a fixnum of the pokemon which can be converted to a string by putting it into a ".txt" file and from a string to fixnum and added again by using "pokemon.flatten!"

    Not sure if this is really what you meant by other ways to define pokemon, but here's a small thing for ya.

    EDIT:
    Setting the pID then the other stats would be a high chance of the same pID, I'm not sure that's why I used "high chance"
    and not will

    EDIT2:
    No, I just tested it....

    EDIT3:
    How does this small code skip the process of changing the pID?:
    Code:
      def abilityflag
        return @abilityflag if @abilityflag
        dexdata=pbOpenDexData
        pbDexDataOffset(dexdata,@species,29)
        ret1=dexdata.fgetb
        ret2=dexdata.fgetb
        dexdata.close
        if ret1==ret2 || ret2==0
          return 0
        end
        return (@personalID&1)
      end
     
    Last edited:
    pokemon.nature = setNature(nature)
    pokemon.abilityflag = ability
    pokemon.makeShiny
    pokemon.gender = gender

    yet for some reason the pIDs are different,
    you can write a pokemon's internal data by doing this:
    define the pokemon, then do this:

    p pokemon

    It'll print you a fixnum of the pokemon which can be converted to a string by putting it into a ".txt" file and from a string to fixnum and added again by using "pokemon.flatten!"

    Not sure if this is really what you meant by other ways to define pokemon, but here's a small thing for ya.

    EDIT:
    Setting the pID then the other stats would be a high chance of the same pID, I'm not sure that's why I used "high chance"
    and not will

    EDIT2:
    No, I just tested it....

    EDIT3:
    How does this small code skip the process of changing the pID?:
    Code:
      def abilityflag
        [COLOR=Red]return @abilityflag if @abilityflag[/COLOR]
        dexdata=pbOpenDexData
        pbDexDataOffset(dexdata,@species,29)
        ret1=dexdata.fgetb
        ret2=dexdata.fgetb
        dexdata.close
        if ret1==ret2 || ret2==0
          return 0
        end
        return (@personalID&1)
      end
    I don't think you get what I'm on about. Incidentally, the nature and gender lines at the top of your post are wrong - they simply can't be defined like that (although the point of this thread is to ask: why not?).

    If you change a Pokémon's gender, what it actually does is change the personal ID until it comes up with one that's the required gender. Changing the personal ID will also affect nature, ability and shininess, since they all depend on it.

    The line I put in red is what skips the personal ID when looking at the ability. It's pretty simple code, compared to what you've been churning out recently.
     
    I don't think you get what I'm on about. Incidentally, the nature and gender lines at the top of your post are wrong - they simply can't be defined like that (although the point of this thread is to ask: why not?).

    If you change a Pokémon's gender, what it actually does is change the personal ID until it comes up with one that's the required gender. Changing the personal ID will also affect nature, ability and shininess, since they all depend on it.

    The line I put in red is what skips the personal ID when looking at the ability. It's pretty simple code, compared to what you've been churning out recently.


    Why not remove it, oh yeah the hidden power....

    Why not make the hidden power reliable on something else, or atleast remove the shininess/gender/nature from it.... really it doesn't bother me rightnow, but if you think you should then.... why not just make hidden power based of another atribute.....

    EDIT:
    Yeah sorry 'bout the error, I was getting tired....
     
    In addition to the four properties I've mentioned, the personal ID also determines where Spinda's spots are, how Wurmple evolves and Unown's form. Interestingly, in Gen 4 and 5, Unown's form is just another variable, and doesn't depend on the personal ID. Oh, it turns out I was wrong about Hidden Power - it depends on IVs instead.

    I could change the system in an afternoon; that's not the problem. My question is whether I should. I know people like Essentials to work just like the official games, which makes sense for things that the player actually sees, but this is solely the background system. Would people care if it was changed?
     
    In addition to the four properties I've mentioned, the personal ID also determines where Spinda's spots are, how Wurmple evolves and Unown's form. Interestingly, in Gen 4 and 5, Unown's form is just another variable, and doesn't depend on the personal ID. Oh, it turns out I was wrong about Hidden Power - it depends on IVs instead.

    I could change the system in an afternoon; that's not the problem. My question is whether I should. I know people like Essentials to work just like the official games, which makes sense for things that the player actually sees, but this is solely the background system. Would people care if it was changed?


    You can change the unown forms easily by using the form function right?

    Spinda spots I knew was random but.... WHO REALLY CARES ABOUT EM!?!?! Ok, that's good that hidden power doesn't rely on the pID, so.... er yeah, I guess I answered the other 2 things right?
     
    took me a few posts to get it.

    So you can't change any personal ID attributes without generating a whole new ID, thus screwing up the other attributes. In that case; yeah, make overrides for all.

    You don't have to remove the PID, just make it give the defaut attributes, then have the overrides if you want something else. thus it won't effect hidden power and spinda and whatnot.
     
    I say go for it; Essentials doesn't operate exactly like the base game as it is, and I'm all for convenience Vs. Accuracy.
     
    I don't think thats this is necessary because you can use this:
    (is an example, don't try to execute)
    Code:
    while(true)
     pokemon.generate
     break if (pokemon.nature==nature && pokemon.gender==gender && pokemon.isShiny)
    end
    This can be only interesting if you think of changing the nature of a player pokémon.
     
    Back
    Top