• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Cyndy, May, Hero (Conquest), or Wes - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

[Script✓] SOLVED [FireRed] Questions: Comparing & National Dex

  • 75
    Posts
    10
    Years
    • UK
    • Seen Aug 26, 2020
    I am trying to make a script:
    Check if the player has seen at least 10 PKMN in the national dex.
    Then if they have, give them an Old Rod.
    It seems to work.

    Script:
    Spoiler:


    Two things I am not 100% sure about:

    -Is this the right way to check if it is 10 or greater?
    Or will this only allow it if it is exactly 10?
    So there is another way to compare to 10 or greater than 10?

    -Secondly, I had a bug in one test where even if I had seen 10, it did not work.
    Am I correctly checking the 8005 variable?
    I think special D4 writes national dex seen PKMN data there?
    Is it affected by something else?

    Thanks. :)
     
    Last edited:
    -Is this the right way to check if it is 10 or greater?
    Or will this only allow it if it is exactly 10?
    So there is another way to compare to 10 or greater than 10?

    The 'if' command has a number of mathematical operations it can use when comparing a variables value. diegoisawesome's XSE tutorial lists them so I'll quote them here:

    Code:
    Lower Than (0x0)
    Equals (0x1)
    Greater Than (0x2)
    Lower than or Equal to (0x3)
    Greater than or Equal to (0x4)
    Not exactly equal to (0x5)

    So while you used 'if 0x0' correctly in your script, there are other ways to achieve the same result if you have the syntax right.

    Secondly, I had a bug in one test where even if I had seen 10, it did not work.
    Am I correctly checking the 8005 variable?
    I think special D4 writes national dex seen PKMN data there?
    Is it affected by something else?

    Yep, you're checking 0x8005 correctly. Special 0xD4 doesn't automatically check the National Dex though. If 0x8004 is equal to 0x0 it will check the Regional Dex, if it is any other value it will check the National Dex.

    I'm pretty sure that line nine of your script (setvar 0x8005 0x1) is meant to be altering 0x8004 to check the National Dex instead. Perhaps that's why it didn't work one time? You saw too many post-151 Pokemon so you didn't see 10 in the regional Dex.

    As an aside, as you're hacking FR, you're using some pretty dangerous flags. Flags above 0x900 start interferring with variables and that can cause a lot of problems. I'd strongly suggest reading this thread to learn which flags you should be using.
     

    Thankyou, this is very helpful.
    I had read about the flags, but forgot, there is a lot for me to take in the last couple of weeks of learning. :)
    All questions answered really great!
     
    Last edited:
    Back
    Top