• 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!
  • Scottie, Todd, Serena, Kris - 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.

Preventing enemy trainers from switching pokemon

  • 8
    Posts
    9
    Years
    • Seen Sep 8, 2015
    How can I prevent, that the enemy is swiching out pokemon in a battle? Somewhere in the script, I guess.
     
    In PokeBattle_AI, search for
    Code:
    def pbEnemyShouldWithdraw?(index)

    Right below it, add
    Code:
    return false
    .

    The opponent won't switch out unless it's a side effect of the move it chose to use against you.
     
    Enemy not allowed to switch out pokemon

    Enemy should not be allowed to switch pokemon in battle except with an effect like u-turn.
     
    In PokeBattle_AI, search for
    Code:
    def pbEnemyShouldWithdraw?(index)
    Right below it, add
    Code:
    return false
    .

    The opponent won't switch out unless it's a side effect of the move it chose to use against you.

    Have I delete something like " end" or the def-line, but otherwise its not working.
     
    Back
    Top