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

[Error] Checking the type of the entire party

  • 3
    Posts
    2
    Years
    • Seen Sep 6, 2023
    Hi there!

    I'm developing a game in which I'd like to be able to detect the type of each party member. I've been searching for a solution but each one has caused the game to crash.

    This is what I've tried so far:

    Conditional Branch: Script: $pbHasType?(:FIRE)
    Conditional Branch: Script: $player.has_pokemon_of_type??(:FIRE)
    Conditional Branch: Script: $player.party[1].hasType?(:FIRE)

    Does anyone know the correct syntax for checking these parameters?
     
    The last one you said is correct.
    $player.party[0].hasType?(:FIRE)
    Will check the first pokemon in the party and see if it has fire as one of its types.
    The likely reason for the crash, is the game needs to know how many pokemon there are in the party.
    if it tries to check a pokemon that doesnt exist (looks at the 3rd pokemon in a 2 pokemon party), it wont be able to do it and will crash.
    I am sure there is a loop you can do to make it easier. but I do it

    Conditional branch - $player.able_pokemon_count == 1
    - Conditional branch - $player.party[0].hasType?(:FIRE)
    Else
    Conditional branch - $player.able_pokemon_count == 2
    - Conditional branch - $player.party[0].hasType?(:FIRE)
    - Conditional branch - $player.party[1].hasType?(:FIRE)

    So on.
    so it goes. do you have 1 pokemon, yes then check the first slot. if not do you have 2 pokemon, yes check both slots, if not do you have 3 pokemon... all the way through. doesnt take too long.
    Sorry if Ive over explained.
    I saved it as a common event then have the event just call the common. to save the event itself being huge lol
     
    Back
    Top