• 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!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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