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

Double Battle script

  • 22
    Posts
    7
    Years
    • Seen Feb 13, 2023
    Hello
    Anyone know how to script trainer double battle?
    When I script it as normal trainer battle and I have only 1 pokemon game copy that pkmn and I have 2 same pokemon.
    What can I do if I want to dont do battles when I have only 1 pokemon?
     
    Why not check out some of the scripts in fire red/emerald to see how they look like?
     
    If you make a trainer have more than one pokemon in any trainer editing tool and try to script a battle while having one pokemon yourself, the game will initiate the battle and duplicate your pokemon while battling the trainer. The original games avoided this happening by not letting you battle these trainers unless you have 2 or more pokemon.

    To script this properly you can do something like this:

    #org @start
    lock
    faceplayer
    countpokemon '--------------- This command counts the number of pokemon in your party
    compare LASTRESULT 0x2 '--------------- Here we are checking the number of pokemon (in this case checking for at least 2)
    if 0x0 goto @NotEnoughPokemon '--------------- If you don't have any, trainer skips the battle and tells you to get more pokemon
    trainerbattle 0x0 0x1 0x0 @Challenge @Defeat '--------------- If you do have at least 2 pokemon, the battle starts
    msgbox @After 0x6
    release
    end

    #org @NotEnoughPokemon '--------------- Here is the part of the code which executes if you don't have enough pokemon
    msgbox @ComeBackLater
    release
    end

    '----------------------------------------

    #org @Challenge
    = It's time to battle!

    #org @Defeat
    = I lost...

    #org @After
    = Cool team!

    #org @ComeBackLater
    = Sorry, but you cannot battle me if you don't have more than one pokemon.
     
    If you make a trainer have more than one pokemon in any trainer editing tool and try to script a battle while having one pokemon yourself, the game will initiate the battle and duplicate your pokemon while battling the trainer. The original games avoided this happening by not letting you battle these trainers unless you have 2 or more pokemon.

    To script this properly you can do something like this:

    #org @start
    lock
    faceplayer
    countpokemon '--------------- This command counts the number of pokemon in your party
    compare LASTRESULT 0x2 '--------------- Here we are checking the number of pokemon (in this case checking for at least 2)
    if 0x0 goto @NotEnoughPokemon '--------------- If you don't have any, trainer skips the battle and tells you to get more pokemon
    trainerbattle 0x0 0x1 0x0 @Challenge @Defeat '--------------- If you do have at least 2 pokemon, the battle starts
    msgbox @After 0x6
    release
    end

    #org @NotEnoughPokemon '--------------- Here is the part of the code which executes if you don't have enough pokemon
    msgbox @ComeBackLater
    release
    end

    '----------------------------------------

    #org @Challenge
    = It's time to battle!

    #org @Defeat
    = I lost...

    #org @After
    = Cool team!

    #org @ComeBackLater
    = Sorry, but you cannot battle me if you don't have more than one pokemon.

    Me too was looking for this, so you also helped me😊
    And is there any problem if I add you in credits of my in development ROM hack and if I make more, there also ?because you helped me a lot.
     
    Back
    Top