• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

[Battle] FireRed: Script a Battle Between 2 NPCs

476
Posts
6
Years
    • Seen Feb 26, 2020
    Script an event that involves 2 NPCs talking to te player, then trigger a double battle. Kind of simple
     
    88
    Posts
    7
    Years
    • Seen Jan 16, 2020
    If the player controls the NPC that would work

    In this case you can do something like the following (in a script)
    1. save the player's pokemon data somewhere (free ram, see FBI's portable storage system for example)
    2. give the player the NPC's pokemon (givepokemon should work)
    3. swap the player's battle backsprite with the NPCs (use JPANs engine or this routine)
    4. initiate the trainer battle
    5. after the battle, delete the given pokemon (JPANs engine special or see this thread)
    6. get the player's original pokemon back (eg. the portable storage system again)

    You will probably want to allow the game to continue in the event the player loses the trainer battle, which means using Oak's tutorial battle (you can toggle the tutorial text with this or just allow continuation via a flag)

    This might look like a lot but you'll learn a lot by getting it all to work. Good luck!
     
    36
    Posts
    5
    Years
  • In this case you can do something like the following (in a script)
    1. save the player's pokemon data somewhere (free ram, see FBI's portable storage system for example)
    2. give the player the NPC's pokemon (givepokemon should work)
    3. swap the player's battle backsprite with the NPCs (use JPANs engine or this routine)
    4. initiate the trainer battle
    5. after the battle, delete the given pokemon (JPANs engine special or see this thread)
    6. get the player's original pokemon back (eg. the portable storage system again)

    You will probably want to allow the game to continue in the event the player loses the trainer battle, which means using Oak's tutorial battle (you can toggle the tutorial text with this or just allow continuation via a flag)

    This might look like a lot but you'll learn a lot by getting it all to work. Good luck!

    Thank you!
     
    Back
    Top