• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Cyndy, May, Hero (Conquest), or Wes - 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.

Running a check on the number of Pokémon in your party

KurisuSan

Lord of Reality
  • 45
    Posts
    10
    Years
    Alright, so my question here is, if it's possible to use a script command similar to the way the PokéCenter checks how many Pokémon are in your party, to determine how many Pokémon a gym leader will use.

    The goal is to create a more realistic gym where the leader matches how many Pokémon you have, i.e. you have 2 Pokémon he will use 2, you have 5 he will use 5, etc.

    I know I will have to create 6 different versions of the same Gym Leader and probably run a really long and repetitive events or multiple event pages but I was wondering if it would be possible to do this and possibly how? I have a basic understanding of scripting and working with events, but I'm not the best at it.
     
    Last edited by a moderator:
    Code:
    pbTrainerBattle(PBTrainers::RIVAL1,"Blue",_I("Not too shabby."),false,[COLOR="Red"]$Trainer.ablePokemonCount[/COLOR])

    You can take advantage of how you call normal battles here. The last argument there is used to determine which version of the trainer to use.
    So you can coordinate different versions of your trainer with what party they should have.

    As defined in your trainers.txt
    Code:
    RIVAL1
    Blue,[COLOR="Red"]1[/COLOR]
    3
    PIDGEOTTO,17
    RATTATA,15
    CHARMANDER,18
    #-------------------
    RIVAL1
    Blue,[COLOR="red"]2[/COLOR]
    3
    PIDGEOTTO,17
    RATTATA,15
    SQUIRTLE,18

    In this case here, if I had one pokemon that can battle, I'd get this first trainer. If I had two, I'd get the second, etc. Make sure you define each possibility (1-6)
     
    Last edited:
    Make 6 versions of the gym leader.
    Create an event with:

    Conditional branch->script->$Trainer.ablePokemonCount==6
    battle Vs gym leader with 6 mons
    exit event processing
    end branch
    Conditional branch->script->$Trainer.ablePokemonCount==5
    battle Vs gym leader with 5 mons
    exit event processing
    end branch
    Conditional branch->script->$Trainer.ablePokemonCount==4
    battle Vs gym leader with 4 mons
    exit event processing
    end branch
    Conditional branch->script->$Trainer.ablePokemonCount==3
    battle Vs gym leader with 3 mons
    exit event processing
    end branch
    Conditional branch->script->$Trainer.ablePokemonCount==2
    battle Vs gym leader with 2 mons
    exit event processing
    end branch
    Conditional branch->script->$Trainer.ablePokemonCount==1
    battle Vs gym leader with 1 mon
    exit event processing
    end branch

    I mean, you get the gist of it, here's your bible: https://pokemonessentials.wikia.com/wiki/Party
     
    I'll add that using $Trainer.ablePokemonCount will use the number of unfainted pokemon in the player's party. If you just want the number of pokemon in their party (basically all non-egg pokemon, regardless of if they're fainted or not) use $Trainer.pokemonCount.

    Using ablePokemonCount means the player could conceivably faint all of their pokemon except one and go into battle vs a single pokemon, and possibly revive their fainted pokemon to use later on (not that that would be an efficient use of their battle turns, but if someone wants to cheat the system, it's doable). But using ablePokemonCount also could mean the player could faint their HM slaves and have them not count against them in gym battles, which might be a plus.
     
    Oooohhhh I see now, I can't believe I missed that, thanks a lot guys, definitely cleared this up, can't wait to put it to use and test it!
     
    Back
    Top