• 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!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - 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.

[Script] [Fire Red] Is there a way to continue an event script after a trainer battle?

  • 19
    Posts
    5
    Years
    • Seen Jan 9, 2022
    Hey all, glad you stopped by! Title is explanatory enough; I want to have an event script continue running after a trainer battle. I've tried everything I can think of to no avail. I then reverse-engineered a script from the base game where the player battles his rival. The only thing different I could see was that the script called the trainer battle and then returned to the main body. I tried that, and the script still ends. I also tried changing the trainer battle type from the usual 0x0 to the rival's 0x9 just to see what it would do, and nothing changed. Here's my code:

    Spoiler:


    TL;DR of that code: an NPC is startled by the player, grabs some fossils (the hidesprite commands), battles the player, gives the player the Helix Fossil, and runs off.

    Anyone have any past experience with this, or maybe some experimental ideas? I'm stumped. Thanks all for reading <3
     
    It's based on trainer battle types. There are two trainer battle types (iirc) that can continue the script after the player wins.
    The first is trainer battle 0x1. You can use that like this:
    trainerbattle 0x1 0x01 0x0 @Challenge @Defeat @Victory
    With @Victory leading to the script that runs after you win. This is mostly used for gym leaders in the original game.

    The second is trainer battle 0x3, which isn't something I've personally tested so I'd probably recommend you use the first one. From what I've been told, however, this command doesn't stop the current script.
    trainerbattle 0x3 0x01 0x0 @Defeat
    ...

    The ellipses can just be replaced with the rest of the script you're running after you win, so you never jump to a different pointer. Again, not sure if this one has any problems though. 0x1 should do the trick without a hitch.
    EDIT: Actually, the 0x9 you're using should also have this second functionality now that I think about it...
    Try using a goto @Victory right after your trainerbattle if you'd prefer to use 0x9
     
    Last edited:
    Back
    Top