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

[Other] Rival Fight- Help

  • 8
    Posts
    10
    Years
    • Seen May 6, 2015
    Up to my first gym and i'm thinking of a rival fight just before you go in. I know how to make basic trainers and stuff like that. The only bit i'm having trouble with is scripting the battle event so it keeps happening when we lose but does not if we win.

    PS. I really need to get to grips with this stuff ~_~
     
    There are a few ways to do this. You can have the script with the battle trigger when you step on a script tile, or when you talk to your rival. If you go with the script tile, you'll need to use a setvar command in your script, but it has to be after the battle is completed, otherwise the script won't trigger the next time you step on the tile. You'll also need a flag to control the visibility of your rival so he's no longer on screen after the script. If you're using FireRed, flag 0x2C works because it's set when the game first starts, so he'll begin invisible before you step on the tile, and you won't need to waste another flag to make him stay gone. You should also make sure the rival's sprite is set somewhere the player won't be able to see when they step on the tile, otherwise it would look like he's appearing our of thin air. For what you're doing, the best location to put the script tile is likely the tile directly in front of the gym's doors, so that the player will have no choice but to step on it and trigger the script. If you want to talk to your rival to start the battle, you'll need to use a flag to control the visibility of your rival, but, again, the setflag will have to come after the trainer battle. Again, a good place to set your rival to trigger this script is likely directly in front of the gym's doors.

    Script Tile:

    Code:
    #dynamic 0x800000
    
    #org @main
    lock
    showsprite 0x(hex value of rival's sprite in Advance Map)
    applymovement 0x(hex value of rival's sprite in Advance Map) @toPlayer
    applymovement 0xFF @faceRival
    waitmovement 0x0
    trainerbattle 0x1 0x(hex byte for the trainer in Advance Map) 0x0 @hey @lost @continue
    end
    
    #org @continue
    setvar 0x(var number for the tile  in Advance Map) 0x(var value for the tile  in Advance Map)
    msgbox @darn 0x6
    applymovement 0x(hex value of rival's sprite in Advance Map) @leave
    waitmovement 0x0
    hidesprite 0x(hex value of rival's sprite in Advance Map)
    release
    end
    
    #org @toPlayer
    movement data so the rival walks to the player
    #raw 0xFE
    
    #org @faceRival
    movement data so the player will be facing the rival
    #raw 0xFE
    
    #org @hey
    = [rival]: Hey, [player]! Let's battle!
    
    #org @lost
    = Aww, I lost!
    
    #org @darn
    = [rival]: Darn, I'll get you next time, [player]!
    
    #org @leave
    movement data so the rival walks off screen
    #raw 0xFE
    Talk to Rival:

    Code:
    #dynamic 0x800000
    
    #org @main
    lock
    faceplayer
    trainerbattle 0x1 0x(hex byte for the trainer) 0x0 @hey @lost @continue
    end
    
    #org @continue
    msgbox @darn 0x6
    applymovement 0x(hex value of rival's sprite in Advance Map) @leave
    waitmovement 0x0
    hidesprite 0x(hex value of rival's sprite in Advance Map)
    setflag 0x(flag number for your rival's sprite in Advance Map)
    release
    end
    
    #org @hey
    = [rival]: Hey, [player]! Let's battle!
    
    #org @lost
    = Aww, I lost!
    
    #org @darn
    = [rival]: Darn, I'll get you next time, [player]!
    
    #org @leave
    movement data so the rival walks off screen
    #raw 0xFE
     
    Last edited:
    Back
    Top