• 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✓] Manually Setting Trainer Flags

Skelatox

Bones Full o' Ooze
  • 7
    Posts
    11
    Years
    tldr: How do you manually flag a trainer as having been beaten, without fighting them?

    So, I'm trying to change the gym leaders so that, when you challenge them, the gym leader's team has the exact same number of pokémon as you. Currently, I'm doing that by having six versions of Roxanne, and having the game check your party size when you fight her, then putting you into a different fight depending on the result.

    My issue is that only the one version of Roxanne which you fight gets flagged as having been beaten. Currently, if you beat Roxanne with three pokémon, deposit a pokémon in the PC, and talk to her again, she'll challenge you again with two pokémon. (Then, when you leave the gym, the cutscene for the Devon theft will play again, as a treat.) I tried to have it manually set all of the trainer flags after battle, but it uh... just doesn't work. I've been digging for a week or so, but in so far as I can tell, there are no tutorials or anything covering how to do this. So if anyone here could point me in the right direction, it'd be greatly appreciated.

    Here's the code I currently have, for reference.

    (Alternatively, if there's a way to change trainers.h so that it situationally pulls one of multiple parties for a single trainer, that would be even better. That way I wouldn't need six copies of Roxanne, and it would end up freeing about 40 slots on the list of trainer flags. Which I could use for, I dunno, some sort of postgame area. Maybe something like Nugget Bridge 2: Electric Nugaloo.)
     
    Last edited:
    tldr: How do you manually flag a trainer as having been beaten, without fighting them?

    So, I'm trying to change the gym leaders so that, when you challenge them, the gym leader's team has the exact same number of pokémon as you. Currently, I'm doing that by having six versions of Roxanne, and having the game check your party size when you fight her, then putting you into a different fight depending on the result.

    My issue is that only the one version of Roxanne which you fight gets flagged as having been beaten. Currently, if you beat Roxanne with three pokémon, deposit a pokémon in the PC, and talk to her again, she'll challenge you again with two pokémon. (Then, when you leave the gym, the cutscene for the Devon theft will play again, as a treat.) I tried to have it manually set all of the trainer flags after battle, but it uh... just doesn't work. I've been digging for a week or so, but in so far as I can tell, there are no tutorials or anything covering how to do this. So if anyone here could point me in the right direction, it'd be greatly appreciated.

    Here's the code I currently have, for reference.

    (Alternatively, if there's a way to change trainers.h so that it situationally pulls one of multiple parties for a single trainer, that would be even better. That way I wouldn't need six copies of Roxanne, and it would end up freeing about 40 slots on the list of trainer flags. Which I could use for, I dunno, some sort of postgame area. Maybe something like Nugget Bridge 2: Electric Nugaloo.)
    To set a trainer's flag manually you can either use settrainerflag INSERT_TRAINER_CONSTANT_HERE, or setflag TRAINER_FLAGS_START + INSERT_TRAINER_CONSTANT_HERE.
    Things like setflag TRAINER_ROXANNE_1 are incorrect. That would simply end up setting the flag with the same value as TRAINER_ROXANNE_1, in other words, the flag 0x109.
     
    To set a trainer's flag manually you can either use settrainerflag INSERT_TRAINER_CONSTANT_HERE, or setflag TRAINER_FLAGS_START + INSERT_TRAINER_CONSTANT_HERE.
    Things like setflag TRAINER_ROXANNE_1 are incorrect. That would simply end up setting the flag with the same value as TRAINER_ROXANNE_1, in other words, the flag 0x109.

    Okay, so, to continue the TRAINER_ROXANNE_1 example, would I use settrainerflag TRAINER_ROXANNE_1 or settrainerflag 0x109, or settrainerflag 265?
     
    Back
    Top