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

[Custom Feature Question] Let AI choose which Pokemon to send out for player upon fainting?

  • 2
    Posts
    8
    Years
    • Seen Jun 16, 2020
    Hi everyone.

    I'm working with 17.2 essentials and am trying to figure out a way to have the built in AI that's used for the opponent also automatically choose and send out the player's next Pokemon when it faints. I've been reading through scripts and other posts the last few days but I can't seem to find exactly what I'm looking for.

    If anyone knows a way of achieving this or at least specific script sections I should be looking at I'll be eternally thankful.
     
    Is it this function in PokeBattle_Battle?
    Code:
      def pbSwitchPlayer(index,lax,cancancel)
        if @debug
          return @scene.pbChooseNewEnemy(index,pbParty(index))
        else
          return @scene.pbSwitch(index,lax,cancancel)
        end
      end
    It even looks like all you have to do is replace "@debug" with "true", but I haven't tried.
     
    I finally figured it out thank you!!!

    What I actually ended up doing was following the method calls back to pbSwitchInBetween and where it makes the decision if the player is not the owner 'if !pbOwnedByPlayer?(index)' I simply added a switch that will always make it true. It never actually calls pbSwitchPlayer now, instead it always runs pbChooseNewEnemy but with the index belonging to the player, which uses the players party to make all decisions as if it was an opponent or NPC partner.

    Funny how much work I put into changing just one line lol. Thank you for the help again :)
     
    Back
    Top