• 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 Trading Card Game 2 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.

[Script] Creating an ability that adds a third type? [Pokeemerald]

  • 17
    Posts
    3
    Years
    • Seen Dec 14, 2022
    So I'm trying to alter Steelworker, Dhelmise's ability that gives it STAB for Steel type moves, to also give it Steel resists and weaknesses. I know that the battle engine with RH Hideout and Dizzy's upgrades has support for the move Trick or Treat, which does something similar--however, I'm not sure how to apply the .effect = EFFECT_THIRD_TYPE move effect to an ability. Has anyone worked with this before?
     
    I think the answer is going to be "it depends". Do you want the ability to actually add the third type, so a mon with it will be affected by Magnet Pull, or just have it be accounted for in damage calculation, so it'd be bypassed by Mold Breaker and negated by Gastro Acid etc.?
     
    So I'm trying to alter Steelworker, Dhelmise's ability that gives it STAB for Steel type moves, to also give it Steel resists and weaknesses. I know that the battle engine with RH Hideout and Dizzy's upgrades has support for the move Trick or Treat, which does something similar--however, I'm not sure how to apply the .effect = EFFECT_THIRD_TYPE move effect to an ability. Has anyone worked with this before?
    In itself, the concept is simple; what you want is to assign a 3rd type to the Pokémon with this ability, correct?
    My first thought on how to handle it is to add an entry for the ability in the case ABILITYEFFECT_ON_SWITCHIN of AbilityBattleEffects and write something like:
    Code:
            case ABILITY_STEELWORKER
                if (!gSpecialStatuses[battler].switchInAbilityDone)
                {
                    gBattleMons[battler].type3 = TYPE_STEEL;
                    gSpecialStatuses[battler].switchInAbilityDone = TRUE;
                    gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_STEELWORKER
                    BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg);
                    effect++;
                }
                break;

    You'll have to define B_MSG_SWITCHIN_STEELWORKER in include/constants/battle_string_ids.h.
    Then you'll have to add it to the gSwitchInAbilityStringIds array.
    And then you'll have to add a string normally, by defining its STRINGID in include/constants/battle_string_ids.h, then adding it to gBattleStringsTable and then writing the actual text string however you want above that table.

    As a result, when you send in a Pokémon with Steelworker, their 3rd type would become the Steel type, and a battle script that'll show an ability pop up and print a switch-in string would be called.
    [PokeCommunity.com] Creating an ability that adds a third type? [Pokeemerald]


    Of course, you can tweak things around however you'd like.
    You can avoid calling a BattleScript in case ABILITY_STEELWORKER and forget about defining and adding a new text string if you don't want to use neither the ability pop up nor a switch-in string, for example.
     
    Last edited:
    Back
    Top