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

[Battle] [FireRed} Changing the escape from wild battle chances?

2
Posts
3
Years
    • Seen May 4, 2024
    Hey yall, I know bulbapedia and other sites list a formula for the player's chances of running away from a wild encounter if your pokemon is slower than the wild. If I wanted to change this so the player can always run from a wild encounter, no matter the speed, or make it so that the player was guaranteed to run away after 2 failed attempts in a row, which file in the decomp would I be looking for, and how should I change it?
     
    247
    Posts
    6
    Years
    • Seen May 2, 2024
    Hey yall, I know bulbapedia and other sites list a formula for the player's chances of running away from a wild encounter if your pokemon is slower than the wild. If I wanted to change this so the player can always run from a wild encounter, no matter the speed, or make it so that the player was guaranteed to run away after 2 failed attempts in a row, which file in the decomp would I be looking for, and how should I change it?

    It looks like src/battle_main.c is what you're looking for. There's a function titled TryRunFromBattle, where it does a bunch of checks for hold items and abilities that affect running, as well as handles the speed comparison and the random element to see if fleeing was successful.

    If you just wanted the player to always be able to flee, make the function just be this:
    Code:
    bool8 TryRunFromBattle(u8 battler)
    {
        gCurrentTurnActionNumber = gBattlersCount;
        gBattleOutcome = B_OUTCOME_RAN;
        return TRUE;
    }
    If you want the running away mechanics to be normal, except the player has a guaranteed success on their third flee attempt, keep everything the same in the original function except this:
    Code:
    ................
    if (effect != 0 || gBattleStruct->runTries > 2) ← ← ← ← ← Add the second condition
    {
        gCurrentTurnActionNumber = gBattlersCount;
        gBattleOutcome = B_OUTCOME_RAN;
        effect = TRUE; ← ← ← ← ← ← Add this to make sure effect is not 0/FALSE when this function returns if this is the third run attempt
    }
    return effect;
    Hope that helps!
     
    Back
    Top