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

Maximum number of trainers in Pokeemerald

  • 23
    Posts
    7
    Years
    • Seen Nov 28, 2023
    Hi all,

    does anyone know whether there is a hard-coded limit for the number of trainers one can include in Pokeemerald? I've been adding new trainers and trainer parties without problems to a total number of 864 (#define TRAINERS_COUNT 864) compared to 855 in default Emerald. However, I can't seem to make any new trainer battle work after hitting this magic number. Upon interaction, the NPCs say their default message as if the battle was already complete although it never happened. I've been trying to understand the gTrainers structure but nothing seems to hint that it should have a limit in size (as far as I understand). As for compilation, make runs without warnings or other issues.

    If anyone has a better understanding of this issue, I would be very grateful for your insights!
     
    Hi all,

    does anyone know whether there is a hard-coded limit for the number of trainers one can include in Pokeemerald? I've been adding new trainers and trainer parties without problems to a total number of 864 (#define TRAINERS_COUNT 864) compared to 855 in default Emerald. However, I can't seem to make any new trainer battle work after hitting this magic number. Upon interaction, the NPCs say their default message as if the battle was already complete although it never happened. I've been trying to understand the gTrainers structure but nothing seems to hint that it should have a limit in size (as far as I understand). As for compilation, make runs without warnings or other issues.

    If anyone has a better understanding of this issue, I would be very grateful for your insights!

    Hey, there's no set limit anywhere, but each normal trainer needs a flag in the save file to work.

    If the trainers are acting like they've already been battled, you probably need more trainer flags. All the flags are defined in include/constants/flags.h. Plenty of them are unused, so you could shuffle them around a bit to make the block of trainer flags bigger, or add a second block of them and figure out how to get the game to access them.
     
    Hey, there's no set limit anywhere, but each normal trainer needs a flag in the save file to work.

    If the trainers are acting like they've already been battled, you probably need more trainer flags. All the flags are defined in include/constants/flags.h. Plenty of them are unused, so you could shuffle them around a bit to make the block of trainer flags bigger, or add a second block of them and figure out how to get the game to access them.

    Hi, thanks for your reply. I'll try to check out the flags. Thank you very much for the advice!
     
    Hey, there's no set limit anywhere, but each normal trainer needs a flag in the save file to work.

    If the trainers are acting like they've already been battled, you probably need more trainer flags. All the flags are defined in include/constants/flags.h. Plenty of them are unused, so you could shuffle them around a bit to make the block of trainer flags bigger, or add a second block of them and figure out how to get the game to access them.

    Hi again,
    I tried increasing TRAINERS_FLAG_NO from 0x356 to 0x3E8 (dec 1000), but it messed up some things. I started a new game just to be sure, and the sprites for Birch's intro Pokémon and starters in the bag selection screen were shiny. Also, after receiving the starter, the Pokémon menu was still not accessible, so I guess that increasing the flags allocated to trainers interferes with the system flags. I don't know why because SYSTEM_FLAGS is defined relative to the offset of trainer flag start and the number of trainer flags. Would you think that this could be related to the sizes of different memory sections?
     
    Hi again,
    I tried increasing TRAINERS_FLAG_NO from 0x356 to 0x3E8 (dec 1000), but it messed up some things. I started a new game just to be sure, and the sprites for Birch's intro Pokémon and starters in the bag selection screen were shiny. Also, after receiving the starter, the Pokémon menu was still not accessible, so I guess that increasing the flags allocated to trainers interferes with the system flags. I don't know why because SYSTEM_FLAGS is defined relative to the offset of trainer flag start and the number of trainer flags. Would you think that this could be related to the sizes of different memory sections?
    I don't know why that would be happening; I've only ever seen that caused by changing the shiny rate. It's possible there's more to adding new flags than just defining new ones, but I haven't tried to do that yet so I can't say for sure.

    You could try removing some unused flags and renumbering all the following ones to make room for more trainer flags, but that's a lot of work and very tedious.
     
    I don't know why that would be happening; I've only ever seen that caused by changing the shiny rate. It's possible there's more to adding new flags than just defining new ones, but I haven't tried to do that yet so I can't say for sure.

    You could try removing some unused flags and renumbering all the following ones to make room for more trainer flags, but that's a lot of work and very tedious.

    Thanks for your insight. I will probably shuffle the unused flags and see if I can use some of them for trainers. Fortunately I can lessen the workload with Python. Again, thank you so much for your help!
     
    Thanks for your insight. I will probably shuffle the unused flags and see if I can use some of them for trainers. Fortunately I can lessen the workload with Python. Again, thank you so much for your help!
    You're welcome! Good luck with this, hope you get it working!
     
    Back
    Top