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

Help with adding TMs 50-100 to Item Expansion

  • 21
    Posts
    7
    Years
    • Seen Nov 3, 2021
    I'm trying to add new TMs like this:

    src/data/items.h
    "I add the new item (TM51) directly under the entry for TM50"
    [ITEM_TM51_OVERHEAT] =
    {
    .name = _("TM51"),
    .itemId = ITEM_TM51_OVERHEAT,
    .price = 0,
    .description = sTM51Desc,
    .importance = 1,
    .pocket = POCKET_TM_HM,
    .type = 1,
    .fieldUseFunc = ItemUseOutOfBattle_TMHM,
    .secondaryId = 0,
    },

    src/data/party_menu.h
    "I add the move to the TM/HM list in party_menu.h"
    static const u16 sTMHMMoves[] =
    {
    ...
    MOVE_SNATCH,
    MOVE_OVERHEAT,
    MOVE_OVERHEAT,
    MOVE_CUT,
    MOVE_FLY,
    ...
    }

    include/constants/items.h
    "I change the number of TMs from 50 to 51"
    ...
    #define NUM_TECHNICAL_MACHINES 51
    #define NUM_HIDDEN_MACHINES 8
    ...

    src/data/texyt/item_descriptions.h
    "I'm adding TM51s item description""

    ...
    static const u8 sTM50Desc[] = _(
    "Enables full-power\n"
    "attack, but sharply\n"
    "lowers SP. ATK.");

    static const u8 sTM51Desc[] = _(
    "Enables full-power\n"
    "attack, but sharply\n"
    "lowers SP. ATK.");


    static const u8 sHM01Desc[] = _(
    "Attacks the foe\n"
    "with sharp blades\n"
    "or claws.");
    ...



    Everytime I do that though it doesn't work and I get all kinds of error messages when compiling...

    The TMs 50 to 100 are already defined in include/constants/items.h by the item_expansion...
    I just don't get how to implement them into the game.
    I'd really appreciate the help!
     
    Well, one comment I would make is that it appears you are duplicating TM50 for TM51. I'm not sure how much bearing this has on any compilation errors, but try editing TM51 to the correct TM to start. After that, show a couple of the error messages that you get in a screenshot or copy-paste them.
     
    Okay I changed the move to Ice Punch now and added my compile log below.

    CHANGES TO:
    src/data/items.h
    Spoiler:


    CHANGES TO:
    src/data/party_menu.h
    Spoiler:


    CHANGES TO:
    include/constants/items.h
    Spoiler:


    CHANGES TO:
    src/data/text/item_descriptions.h
    Spoiler:



    This is my compilation log:
    Spoiler:
     
    Last edited:
    I'll come back to help later but what I gather from your log is that there isn't anything wrong with the additions listed, but something else, towards the end of the gItems array in src/data/items.h

    It appears you have multiple entries with the same name somehow. I would go to the specified line (4713) in that file, and check out which entry is there, then search the file to see if you somehow have it in another place. If you could post the file that would be helpful.
     
    ...
    .importance = 1,
    .pocket = POCKET_TM_HM,
    .type = 1,
    .fieldUseFunc = ItemUseOutOfBattle_TMHM,
    .secondaryId = 0,
    }, <-------- This is line 4713

    [ITEM_HM02_FLY] =
    {
    .name = _("HM02"),
    .itemId = ITEM_HM02_FLY,
    .price = 0,
    .description = sHM02Desc,
    .importance = 1,
    ...


    The weird thing is I get a clean, error-free log before adding TM51.
    I haven't changed anything else since, and when I roll back to my last backup (which was exactly before adding the TM) it works fine.
     
    Delete the item defines in include/constants/battle_config.h. It seems like that's your error.
     
    Thx so much for the tipp...
    I remember now that I did delete those entries when setting up my first repo and merging with dizzy's item expansion
    This time I made alot of changes and only recently merged my repo with it...so I just forgot.

    The problem is now I still get this error about a "duplicate initializer"?
    Here is my compile log:
    Spoiler:



    4713 is this line here:
    Spoiler:
     
    Last edited:
    I figured out the issue but the solution I've come up with thus far has far reaching implications, so I'm trying some other things out. Essentially the issue is that in include/constants/items.h, the HMs have the same ID assigned to them as the TMs in the 51-58 range. However, simply changing the HM IDs or TM IDs will affect learnsets. So, I'm not too sure the best way on how to tackle this problem.

    EDIT: Actually, you will likely need to edit the learnsets to add TMs in the 51-100 range for this project as well... So a large amount of edits to the learnsets file will be needed either way.
     
    Last edited:
    do you mean?
    /src/data/pokemon/tmhm_learnsets.h

    Anyways... thx for all your help!
    I'll play around with learnsets tomorrow and see if I can fix it that way.
     
    Last edited:
    do you mean?


    Anyways... thx for all your help!
    I'll play around with learnsets tomorrow and see if I can fix it that way.

    Yes, that one. If you look in that file, no TMs from 51 onwards are included. Additionally, changing HMs to 582-589 (which aren't taken) causes some weird issue with bitshifts in that file when compiling. I'm not super comfortable in that realm just yet, so I can't quite pinpoint where it goes wrong.
     
    Hmn...could you repoint the TM Table somehow to get rid of that problem?
    I remember doing stuff like this on vanilla firered through hex editing but I'm still very new to Decomps/Pokeemerald...
     
    Last edited:
    you should look at DizzyEgg's item_expansion branch, as it already has gone through the trouble of doing basically all of the hard parts of this.
     
    you should look at DizzyEgg's item_expansion branch, as it already has gone through the trouble of doing basically all of the hard parts of this.
    As far as I can tell, that is not really the case. Egg seems to have defined the TMs 51 to 100, but that's it.
    The actual data for the TMs is not present.

    Speaking of which, I haven't seen it mentioned in this thread yet, but TMs 51 to 58 have the same Item ID number as the HMs 01 to 08, which shouldn't be the case as each item must have their own individual number ID, so you guys have to make sure to adjust those accordingly.
     
    ...the HMs have the same ID assigned to them as the TMs in the 51-58 range...
    ...changing HMs to 582-589 (which aren't taken) causes some weird issue with bitshifts in that file when compiling
    Zafnok did mention that and I tried it myself aswell.

    The problem is that if I change the tm/hm numbers I run against another wall and get errors coming from the "tmhm_learnset.h" file for which I haven't yet found a solution aswell.
    There must be some file/change I'm missing cause otherwise it wouldn't screw up everything when you just change the ID of the TM/HM.
    Before that everything runs smoothly...
     
    As far as I can tell, that is not really the case. Egg seems to have defined the TMs 51 to 100, but that's it.
    The actual data for the TMs is not present.

    Speaking of which, I haven't seen it mentioned in this thread yet, but TMs 51 to 58 have the same Item ID number as the HMs 01 to 08, which shouldn't be the case as each item must have their own individual number ID, so you guys have to make sure to adjust those accordingly.

    True, but he handled allocating the memory necessary, which they'd been having trouble with up til that point iirc.

    Also, from what I've seen, it's set that way because there's no data included for the TMs 51-100. When I added 36 custom TMs the HMs wouldn't display in bag correctly until I set the item Ids equal to TMs 87-94.
     
    True, but he handled allocating the memory necessary, which they'd been having trouble with up til that point iirc.

    Also, from what I've seen, it's set that way because there's no data included for the TMs 51-100. When I added 36 custom TMs the HMs wouldn't display in bag correctly until I set the item Ids equal to TMs 87-94.

    Thats interesting... so would they work correctly if I change all new TMs IDs (from 51 on upwards) starting with the ones from 87?
    87 would be '568'
    So I'd be going like this:
    51 = 568
    52 = 569
    53 = 570
    54 = 571
    (and so on...)

    EDIT: Now that I think about it... What I said doesn't make much sense... As there are other item ids after the tm block...

    I tried giving TM51-100 IDs starting AFTER the last items but that didn't work either...
     
    Last edited:
    Well for now I'll put this problem away and work on some other stuff I wanted to do with my hack...I'll be returning to it once in a while and see if I can get it to work.

    Really looking forward to a fix. It'd be so nice to have 100 TM instead of only 50.
     
    Back
    Top