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

Soft level cap for CFRU?

56
Posts
4
Years
    • He/Him
    • Seen May 3, 2024
    Hello,does anyone know of a way to implement the soft level cap from fire red's modexe or "disable exp gain until certain badge" as it says for CFRU?For example I want pokemon to stop gaining exp as soon as they hit 16 lvl if you have not obtained the first badge yet.Then after you get it pokemon will start gaining exp again till the level cap for the next badge.Thanks in advance.
     
    6
    Posts
    5
    Years
    • Seen Nov 16, 2023
    in exp.c in static
    line 47 :
    Code:
    u32 ExpCalculator(u32 a, u32 t, u32 b, u32 e, u32 L, u32 Lp, u32 p, u32 f, u32 v, u32 s)
    ->
    Code:
    static u32 ExpCalculator(u32 a, u32 t, u32 b, u32 e, u32 L, u32 Lp, u32 p, u32 f, u32 v, u32 s, u32 bb)
    line 473 :
    Code:
    static u32 ExpCalculator(u32 a, u32 t, u32 b, u32 e, u32 L, u32 Lp, u32 p, u32 f, u32 v, u32 s)
    ->
    Code:
    static u32 ExpCalculator(u32 a, u32 t, u32 b, u32 e, u32 L, u32 Lp, u32 p, u32 f, u32 v, u32 s, u32 bb)

    then in the function, before
    Code:
    return MathMin(1640000, calculatedExp);
    adds
    Code:
    calculatedExp *= bb

    when declaring variable on line 150
    Code:
    u32 trainerBonus, tradeBonus, baseExp, eggBoost, defLevel, pokeLevel, passPower, affection, evolutionBoost, divisor;
    become
    Code:
    u32 trainerBonus, tradeBonus, baseExp, eggBoost, defLevel, pokeLevel, passPower, affection, evolutionBoost, divisor, cap;
    in the function, in the part where all the modifier are calculated add:
    Code:
    	u32 cap = 0;
                    if (!FlagGet(FLAG_BADGE01_GET) && pokeLevel >= 14)
    			cap = 0;
    		else if (!FlagGet(FLAG_BADGE02_GET) && pokeLevel >= 19)
    			cap = 0;
    		else if (!FlagGet(FLAG_BADGE03_GET) && pokeLevel >= 24)
    			cap = 0;
    		else if (!FlagGet(FLAG_BADGE04_GET) && pokeLevel >= 29)
    			cap = 0;
    		else if (!FlagGet(FLAG_BADGE05_GET) && pokeLevel >= 36)
    			cap = 0;
    		else if (!FlagGet(FLAG_BADGE06_GET) && pokeLevel >= 43)
    			cap = 0;
    		else if (!FlagGet(FLAG_BADGE07_GET) && pokeLevel >= 47)
    			cap = 0;
    		else if (!FlagGet(FLAG_BADGE08_GET) && pokeLevel >= 50)
    			cap = 0;
    		else 
    			cap = 1;
    changes the number to your needs

    and at last when you see
    Code:
    calculatedExp += ExpCalculator(trainerBonus, tradeBonus, baseExp, eggBoost, defLevel, pokeLevel, passPower, affection, evolutionBoost, 2 * viaExpShare);
    ->
    Code:
    calculatedExp += ExpCalculator(trainerBonus, tradeBonus, baseExp, eggBoost, defLevel, pokeLevel, passPower, affection, evolutionBoost, 2 * viaExpShare, cap)

    i don't know if this is the best solution, but works for me, after reaching the cap, each battle gives you 1xp.
     
    Last edited:
    10
    Posts
    10
    Years
    • Seen Jun 8, 2023
    when the tuction calculate varius modifier for the exp adds something like

    Code:
    u32 cap = 0;
    if (!FlagGet(FLAG_BADGE01_GET) && pokeLevel >= 14)
    cap = 0;
    else if (!FlagGet(FLAG_BADGE02_GET) && pokeLevel >= 19)
    cap = 0;
    else if (!FlagGet(FLAG_BADGE03_GET) && pokeLevel >= 24)
    cap = 0;
    else if (!FlagGet(FLAG_BADGE04_GET) && pokeLevel >= 29)
    cap = 0;
    else if (!FlagGet(FLAG_BADGE05_GET) && pokeLevel >= 36)
    cap = 0;
    else if (!FlagGet(FLAG_BADGE06_GET) && pokeLevel >= 43)
    cap = 0;
    else if (!FlagGet(FLAG_BADGE07_GET) && pokeLevel >= 47)
    cap = 0;
    else if (!FlagGet(FLAG_BADGE08_GET) && pokeLevel >= 50)
    cap = 0;
    else



    I'm really sorry but I don't understand what you mean by this part
    'when the tuction calculate varius modifier for the exp adds something like'
     
    10
    Posts
    10
    Years
    • Seen Jun 8, 2023
    I've tried to compile it and I seem to be getting a few error while following your tutorial.

    Is there anyway you could attach your exp.c file?
     
    6
    Posts
    5
    Years
    • Seen Nov 16, 2023
    just put it under :

    Code:
    //Evolution Boost
    		evolutionBoost = 10;
    		if (CouldHaveEvolvedViaLevelUp(&gPlayerParty[gBattleStruct->expGetterMonId]))
    			evolutionBoost = 12;

    my exp.c have other modifications,
    "when the tuction calculate varius modifier for the exp adds something like"
    sorry i wrote that in a rush, i mean in the *function, in the part *where all the modifier are calculated.
     
    Last edited:
    10
    Posts
    10
    Years
    • Seen Jun 8, 2023
    Okay thank you,

    If I get any errors when I compile can I show you and see what you think may be the problem?
     
    6
    Posts
    5
    Years
    • Seen Nov 16, 2023
    Ye, no problem.
    Add me to Discord if you want. (The username is on my profile page)
     
    10
    Posts
    10
    Years
    • Seen Jun 8, 2023
    Thankyou! I've just added you!

    So before I had errors come up, I'll show you on discord what they were,

    Did a couple of tweaks and now for some reason it's all compiled correctly but still not working. I don't get it haha
     
    3
    Posts
    5
    Years
    • Seen Aug 20, 2023
    I couldn't do your tutorial right, there was an error here, can you help me? this is my Discord: Jean Stars#1438
     
    61
    Posts
    10
    Years
    • Seen Feb 3, 2024
    to anyone who wants to re-enable modexe badge based level cap in cfru,

    we need to restore original atk23_getexp of firered (probably will break cfru introduced exp features)

    find "F9 23 02 08" in a hack with CFRU inserted, the offset right behind it is a pointer to your atk23_getexp ( should be xx xx xx 08 or 09)

    restore it to the original firered atk23_getexp pointer "69 1A 02 08"

    this should allow modexe badge based level cap to work again.

    credits : Meister_anon~Master_o f_None
     
    Back
    Top