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

[Other] [Pokeemerald] Adding ONLY Hidden Abilities from Pokemon Expansion

Kobazco

Gex Fan
39
Posts
12
Years
    • they/she
    • Seen Nov 21, 2023
    As the title says, the project I'm currently working on doesn't need the Pokemon expansion, but I want to be able to use hidden abilities. Would someone be able to point me in the right directions either for what files in the Pokemon expansion add in hidden ability support, or a separate method of adding them in? For Pokeemerald btw.

    I have the Battle engine upgrade v2 and item expansion in this decomp project if that information helps in anyway.
     

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • As the title says, the project I'm currently working on doesn't need the Pokemon expansion, but I want to be able to use hidden abilities. Would someone be able to point me in the right directions either for what files in the Pokemon expansion add in hidden ability support, or a separate method of adding them in? For Pokeemerald btw.

    I have the Battle engine upgrade v2 and item expansion in this decomp project if that information helps in anyway.
    This is about all you need.
    https://github.com/rh-hideout/pokeemerald-expansion/pull/1464/files
     

    Kobazco

    Gex Fan
    39
    Posts
    12
    Years
    • they/she
    • Seen Nov 21, 2023

    Unfortunately, it seems like I need additional assistance. It seems like I've managed to get it all working (hidden abilities are appearing in my dev menu implying they are properly being assigned), but attempts to use SetMonData to alter the ability to be the Hidden one don't work and default to Ability 00 for some reason.

    As an example, this is the command I have been trying to use: SetMonData(&gPlayerParty[tMonId], MON_DATA_ABILITY_NUM, &tAbilityNum); with tAbilityNum being set to 2
     

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • Unfortunately, it seems like I need additional assistance. It seems like I've managed to get it all working (hidden abilities are appearing in my dev menu implying they are properly being assigned), but attempts to use SetMonData to alter the ability to be the Hidden one don't work and default to Ability 00 for some reason.

    As an example, this is the command I have been trying to use: SetMonData(&gPlayerParty[tMonId], MON_DATA_ABILITY_NUM, &tAbilityNum); with tAbilityNum being set to 2
    For your information, that's not a command, it's a function call. You're calling the function SetMonData and passing specific parameters through it.

    Anyway, where exactly did you do this?
    Ideally, hidden abilities should be set in the function where all the basic data of a Pokémon is created, CreateBoxMon.

    As you can see right here, in CreateBoxMon a Pokémon is given its 1st or 2nd ability based on their personality, if they do have a 2nd ability at all.
    There's many ways you can make hidden abilities (that is 3rd abilities) usable and it solely depends on your own tastes.

    Here's a quick example. I slightly modified the if statement I linked above.
    This would make it so there's a 50% chance that a Pokémon is generated with its hidden ability if they have one:
    Code:
        if (gBaseStats[species].abilities[2] && (Random() % 100) <= 50)
        {
            value = 2;
            SetBoxMonData(boxMon, MON_DATA_ABILITY_NUM, &value);
        }
        else if (gBaseStats[species].abilities[1])
        {
            value = personality & 1;
            SetBoxMonData(boxMon, MON_DATA_ABILITY_NUM, &value);
        }
    EDIT (05/05/2023): It's actually 51% because Random() starts to count from 0 and I used <= instead of <, lel.
     
    Last edited:

    Kobazco

    Gex Fan
    39
    Posts
    12
    Years
    • they/she
    • Seen Nov 21, 2023
    For your information, that's not a command, it's a function call. You're calling the function SetMonData and passing specific parameters through it.

    Anyway, where exactly did you do this?
    Ideally, hidden abilities should be set in the function where all the basic data of a Pokémon is created, CreateBoxMon.

    As you can see right here, in CreateBoxMon a Pokémon is given its 1st or 2nd ability based on their personality, if they do have a 2nd ability at all.
    There's many ways you can make hidden abilities (that is 3rd abilities) usable and it solely depends on your own tastes.

    Here's a quick example. I slightly modified the if statement I linked above.
    This would make it so there's a 50% chance that a Pokémon is generated with its hidden ability if they have one:
    Code:
        if (gBaseStats[species].abilities[2] && (Random() % 100) <= 50)
        {
            value = 2;
            SetBoxMonData(boxMon, MON_DATA_ABILITY_NUM, &value);
        }
        else if (gBaseStats[species].abilities[1])
        {
            value = personality & 1;
            SetBoxMonData(boxMon, MON_DATA_ABILITY_NUM, &value);
        }

    The function SetMonData is being used in the debug menu I got from here: https://github.com/TheXaman/pokeemerald/tree/tx_debug_system

    It just feels a little odd, since it recognizes it as ability 02 but still gives ability 00 after the mon is given
    Spoiler:


    Code:
    //Ability
        if (abilityNum == 0xFF || GetAbilityBySpecies(species, abilityNum) == 0)
        {
            do {
                abilityNum = Random() % 3;  // includes hidden abilities
            } while (GetAbilityBySpecies(species, abilityNum) == 0);
        }
    
        SetMonData(&mon, MON_DATA_ABILITY_NUM, &abilityNum);

    So can I just not use SetMonData to set the hidden ability? I was going to try and make an item to change the pokemon's ability to (hidden) but the method I was going to try was also using SetMonData
     

    Kobazco

    Gex Fan
    39
    Posts
    12
    Years
    • they/she
    • Seen Nov 21, 2023
    Well... never mind in all this. It seems the issue was that /* 0x07 */ u32 abilityNum:2; was set to be 1 instead of 2 inside of include\pokemon.h

    Thanks for your help!
     
    54
    Posts
    1
    Years
    • Seen Apr 14, 2024
    For your information, that's not a command, it's a function call. You're calling the function SetMonData and passing specific parameters through it.

    Here's a quick example. I slightly modified the if statement I linked above.
    This would make it so there's a 50% chance that a Pokémon is generated with its hidden ability if they have one:
    Code:
        if (gBaseStats[species].abilities[2] && (Random() % 100) <= 50)
        {
            value = 2;
            SetBoxMonData(boxMon, MON_DATA_ABILITY_NUM, &value);
        }
        else if (gBaseStats[species].abilities[1])
        {
            value = personality & 1;
            SetBoxMonData(boxMon, MON_DATA_ABILITY_NUM, &value);
        }

    Thanks for this, I got it working in my own version.

    Is there a way to give a visual effect of some kind when a Pokemon with a Hidden Ability appears?
     
    Back
    Top