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

checking which pokemon have been caught

124
Posts
8
Years
    • Seen Apr 5, 2024
    how would a script look like if I wanna check if the player has caught a certain pokemon. Like for example if a player hasnt caught a charmander, I would like to give the player a charmander, but only if they dont have one, poor example i know, but I have big plans for a script with similar features. I dont want it to be needed to have the pokemon in the party, just caught in the pokedex. Thanks
     
    222
    Posts
    6
    Years
    • Seen Nov 18, 2023
    The ability to check specific dex flags is not present in the scripting system. The closest I could find was a special that checked the total amount of Pokémon caught, but there's no scripting command or special that lets you access dex flags directly. So you will need to make a new special or command that does that.

    How are you making your hack? Binary or Decomp?
    If you're using binary, this would require writing a custom asm routine, but I don't personally know asm and there's not a lot of knowledgeable people around who bother with binary anymore.
    If you happen to be using decomp, it is quite easier and I can help you more. (Since now you've gotten me thinking about implementing that, lol).
     
    990
    Posts
    4
    Years
  • how would a script look like if I wanna check if the player has caught a certain pokemon. Like for example if a player hasnt caught a charmander, I would like to give the player a charmander, but only if they dont have one, poor example i know, but I have big plans for a script with similar features. I dont want it to be needed to have the pokemon in the party, just caught in the pokedex. Thanks

    The ability to check specific dex flags is not present in the scripting system. The closest I could find was a special that checked the total amount of Pokémon caught, but there's no scripting command or special that lets you access dex flags directly. So you will need to make a new special or command that does that.

    How are you making your hack? Binary or Decomp?
    If you're using binary, this would require writing a custom asm routine, but I don't personally know asm and there's not a lot of knowledgeable people around who bother with binary anymore.
    If you happen to be using decomp, it is quite easier and I can help you more. (Since now you've gotten me thinking about implementing that, lol).


    Quoting Asith here:
    I'm super surprised at how many people don't know the in-built way to check for party pokemon given how useful it is. I've seen 3 people ask about it in the last month.

    special2 0x8001 0x147 will scan a party slot (0-5) held in variable 0x8004 and return that species ID to variable 0x8001. You can use whatever variable you want in place of 0x8001 in the command. This is useful for when you know the party slot the expected pokemon should be in, say in the first slot. After that, just use a compare command with 0x8001 and the species ID you were checking for.
    You can make it even better using special 0x9F, which opens up the party menu so the player can pick whatever slot they want. This special will store the selected slot in 0x8004, making it instantly ready to follow up with special2 0x8001 0x147.
    Combining these two makes a super easy checkpokemon function:

    Code:
    special 0x9F '"Party screen"
    waitstate
    special2 0x8001 0x147 '"Convert selected slot to species ID in 0x8001"
    compare 0x8001 0x2 '"Compare 0x8001 to the species ID you want"
    if 0x1 goto @success
    ...(fail)


    That code brings up the party screen, lets the player select whatever pokemon they want, and then checks whether that species is 0x2 (ivysaur). If yes, go to @success. Otherwise, say it failed.
    I'm sure you can figure out how to run that code 3 times for your purposes

    Whether binary or decomp, there's no need to get any simpler than that
     
    124
    Posts
    8
    Years
    • Seen Apr 5, 2024
    Im hacking this game purely using amap, and pksvu, creating a more difficult game without implementing hard to code scripts, but i have used many asm routines taken from the smart heads on this forum, i gotta say im very proud of the many scripts i have come up with to add great features to this already great game. I already came up with a feature that allows the player to choose a pokemon from the party that will have the player battle the most basic version of that pokemon at a chance of it being shiny, and top IV's as a reward for beating the story, very lengthy 1000 line script but so worth it.

    But anyway, back to the OP, yes I knew there wasnt a specific command for what i was asking for, I just thought maybe somebody had made an asm routine for it somewhere on here and i just couldnt find it, but yeah, to reiterate, I would like a way, to give the player a pokemon that he hasnt caught as a reward for beating the game, like if i fainted the mewtwo and didnt successfully catch him, the npc with this script i would like to learn to do, would give me the mewtwo but not mewtwo specifically (because I know that would be as easy as just givepokemon command) but any other pokemon not caught, and i dont want to give pokemon to the player that he already caught. Hope that helps and thank you for your time guys!

    PS

    HJK321, u mentioned a flag/command that checks how many pokemon have been caught, which one is that again and elaborate a little bit on it please, thanks
     
    Last edited:
    222
    Posts
    6
    Years
    • Seen Nov 18, 2023
    HJK321, u mentioned a flag/command that checks how many pokemon have been caught, which one is that again and elaborate a little bit on it please, thanks

    I am assuming you are using firered, if using emerald please tell me and don't use the below info
    The command is as follows:

    Code:
    special 0xd4

    Firstly, if variable 0x8004 is zero, it'll be using Kanto Pokédex numbers, but if that variable is anything except zero, it will use national dex numbers instead. Make sure to set it before running the special.

    Basically, it puts the number of seen Pokémon in variable 0x8005, and the number of caught Pokémon in variable 0x8006.

    You can use these variables as normal in if statements or whatever, but if you want to print the number in a message box, you can put one of the numbers into one of the string buffers like so:
    Code:
    buffernumber 0 0x8006

    Hope this helps.
     
    124
    Posts
    8
    Years
    • Seen Apr 5, 2024
    oh ok, i do remember seeing that command within oak's scripts, thought u meant there was another one, yes fire red not emerald. Thanks for all your help guys, I kind of wish there was a pokemon maker game like mario maker to make all these edits easy, am I right?
     
    Back
    Top