• 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!
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

[pokefirered] how to change rival starter

  • 9
    Posts
    14
    Days
    • Seen today
    Thanks to a previous post I was able to randomize the starter options offered to the player, but the rival still gets the traditional starter strong against the type you chose. How would I go about changing the Pokemon your rival ends up with? I imagine I'll probably have to change the team for each rival battle, but correct me if I'm wrong.
     
    how to change rival starter
    It doesn't look like you made an effort to read Oak's Lab's scripts.inc file, huh.
    Just like there's a temporary variable that is used to store the Player's starter before giving it to them (VAR_TEMP_2 which uses PLAYER_STARTER_SPECIES as a local label), there's a variable used to control the Rival's, VAR_TEMP_3 via the local label RIVAL_STARTER_SPECIES. Like I said in the other thread, both of these are located near the top of the scripts.inc file.
    You're gonna have to modify its value in a similar way than you modified the value of VAR_TEMP_2/PLAYER_STARTER_SPECIES.

    I imagine I'll probably have to change the team for each rival battle, but correct me if I'm wrong.
    You're correct, yes. Each rival battle uses a separate opponent ID with their own parties. All the relevant data is in src/data/trainers.h and src/data/trainer_parties.h.
     
    So, I have the special I set in field_specials also set VAR_TEMP_3, for the rival, which I assume is copied to RIVAL_STARTER_SPECIES.
    In the trainer_parties.h I'm trying to read that variable to run a switch/case to build rival's team for each encounter, and am at a loss. I tried doing VarGet, as I use VarSet in the special function, but that doesn't seem to be it unless I'm doing it wrong. I have the following:
    Code:
    u16 rivalspecies = VarGet(RIVAL_STARTER_SPECIES);
    Then I'd do a switch on rivalspecies and have a different party roster for each case. I get an error that 'RIVAL_STARTER_SPECIES' is undeclared here, so I can only assume I'm doing something wrong.
     
    So, I have the special I set in field_specials also set VAR_TEMP_3, for the rival, which I assume is copied to RIVAL_STARTER_SPECIES.
    In the trainer_parties.h I'm trying to read that variable to run a switch/case to build rival's team for each encounter, and am at a loss. I tried doing VarGet, as I use VarSet in the special function, but that doesn't seem to be it unless I'm doing it wrong. I have the following:
    Code:
    u16 rivalspecies = VarGet(RIVAL_STARTER_SPECIES);
    Then I'd do a switch on rivalspecies and have a different party roster for each case. I get an error that 'RIVAL_STARTER_SPECIES' is undeclared here, so I can only assume I'm doing something wrong.
    1) You can't write meaningful code inside src/data/trainer_parties.h. That file contains arrays with data that are read by a field in the gTrainers array located at src/data/trainers.h, which is then read in different functions of code inside the files located in the src folder.

    2) RIVAL_STARTER_SPECIES is, like I said, a local label. Local in this context refers to the scope of the variable and serves to describe a variable that can only be used inside the file where it's defined and nowhere else. In this case, that's data/maps/PalletTown_ProfessorOaksLab/scripts.inc.
    You can totally use VarGet(VAR_TEMP_3) though. VAR_TEMP_3 is a constant label defined at include/constants/vars.h usable wherever you want in the codebase.

    It's gonna be hard to say anything about the code you wrote without actually looking at it.
     
    ho
    1) You can't write meaningful code inside src/data/trainer_parties.h. That file contains arrays with data that are read by a field in the gTrainers array located at src/data/trainers.h, which is then read in different functions of code inside the files located in the src folder.

    2) RIVAL_STARTER_SPECIES is, like I said, a local label. Local in this context refers to the scope of the variable and serves to describe a variable that can only be used inside the file where it's defined and nowhere else. In this case, that's data/maps/PalletTown_ProfessorOaksLab/scripts.inc.
    You can totally use VarGet(VAR_TEMP_3) though. VAR_TEMP_3 is a constant label defined at include/constants/vars.h usable wherever you want in the codebase.

    It's gonna be hard to say anything about the code you wrote without actually looking at it.
    See, here I was thinking that VAR_TEMP_3 was the local variable, thinking "oh, temp? That sounds like something only used in one place!"

    So, I can't change the party array to directly reference VAR_TEMP_3 somehow though, to change the starter in his party?
    ie
    Code:
    struct TrainerMonNoItemDefaultMoves sParty_RivalOaksLabCharmander[] = {
        {
            .iv = 0,
            .lvl = 5,
            .species = VarGet(VAR_TEMP_3),
        },
    };
     
    Last edited:
    Back
    Top