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

Need Help Guaranteeing Critical Hits in Pokemon Fire Red

  • 1
    Posts
    143
    Days
    • Seen Dec 22, 2024
    I am unsure where I would ask a question like this since I just found out about this site a few minutes ago but I have a problem. I want to do a video on the premise of doing a playthrough of Fire Red with the minimum amount of turns possible and to do this I need the ability to guarantee critical hits. Of course, it would be better to have the ability to toggle a critical hit when I need one for the challenge but that may be unfeasible. I am a complete noob when it comes to looking at any video game addresses and code so it has been a wild ride with the only assistance coming from ChatGPT. Using Cheat Engine I was able to track down a memory address containing the flag for the critical hit text box and I tried to trace it back to the critical hit calculation address to no avail. I am looking for any help at all for this problem, I am willing to learn and it has been a fun and frustrating ride trying to get this to work. I appreciate any advice y'all could give me!
     
    Of course, it would be better to have the ability to toggle a critical hit when I need one for the challenge but that may be unfeasible.
    Nothing is unfeasible so long as what you want to do stays within the confines of the GBA hardware. Perks of having the entire source code that composes the games right in front of us.
    You can check for the value of a flag or a var by calling either FlagGet or VarGet if you need to toggle critical hits for entire battles.
    There's also functions of code where you can check if a button is pressed or being held in battle, like HandleInputChooseAction, so you could alternatively make it so a critical hit happens whenever you press the A button to pick a move while holding Start if you needed something easier to control on a turn-by-turn basis.
    Being able to read and write code in C89 is essential to achieve something like this, and moreover you need to familiarize yourself with the labels that the codebase uses.

    I tried to trace it back to the critical hit calculation address to no avail.
    You might have found it faster if you searched relevant keywords such as "critical" or if you searched words related to known item or move effects that increase the chances of dealing a critical hit via git grep, or Visual Studio Code's Search function, or any other equivalents to them.

    Critical hits are calculated by a function called Cmd_critcalc located at src/battle_script_commands.c.
    It's called for each move individually in their move effect's battle script through a macro called critcalc.
    The function sets the value of a global variable called gCritMultiplier based on different sets of conditions.
    When those conditions are met the variable is set to 2, and that's when a critical hit happens.
     
    Back
    Top