• 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!
  • 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] How to rematch trainers (script)

  • 4
    Posts
    9
    Years
    • Seen Mar 30, 2016
    I am working on a hack and i would like to have a trainer you can battle in each town for grinding purposes...
    Right now i know how to create a normal battle but i cant figure out how to make in whwre you can rebattle them immediately. I know it has something to do with flags but i just cant figure how to set them. If anyone can help me with this it would be greatly appreciated!!
     
    A trainer's "defeated" flag can be reset by using the command "settrainerflag" (which was named incorrectly).

    For example:
    Code:
    #dynamic 0x800000
    // Just replace <id> with the trainer's id.
    
    #org @trainer
    // This is the initial battle
    trainerbattle 0x0 <id> 0x0 @intro @loss
    // Ask if they want another battle
    msgbox @m1 MSG_YESNO
    compare LASTRESULT 0x1
    if 0x0 goto @nope
    // And this will allow unlimited rematches
    settrainerflag <id>
    trainerbattle 0x0 <id> 0x0 @intro @loss
    end
    
    #org @nope
    // If they refused...
    msgbox @m2 MSG_NORMAL
    end
    
    #org @intro
    = Say something when introduced.
    
    #org @loss
    = Say something on loss.
    
    #org @m1
    = Do you want to battle again?
    
    #org @m2
    = Something to say if you refuse.

    I'm pretty sure that works, though there are probably more elegant solutions as well.
     
    You could do either Lost Heart's method or this method:

    Code:
    #dynamic 0xYOUROFFSET
    
    #org @event
    trainerbattle 0x0 0xID 0x0 @initialmeetmsg @defeat
    special2 0x800D 0x39
    compare 0x800D 0x1
    if 0x1 goto @battle
    msgbox @after 0x6
    release
    end
    
    #org @battle
    trainerbattle 0x5 0xID 0x0 @meetagain @defeat
    msgbox @after 0x6
    release
    end
    
    #org @initialmeetmsg
    = Hello, let's battle!
    
    #org @defeat
    = You beat me!
    
    #org @meetagain
    = Yeah, let's battle again!
    
    #org @after
    = Man, you're tough! Let's battle again some time.
     
    I entered this script exactly correct and there is no Yes/No box that pops up. The script just runs into the battle as if for the first time.
     
    Maybe, try to use the trainerbattle2, like this :

    Code:
    #dynamic 0x800000
    // Just replace <id> with the trainer's id.
    
    #org @trainer
    // This is the initial battle
    trainerbattle 0x2 <id> 0x0 @intro @loss @next
    msgbox @other
    end
    
    #org @next
    // Ask if you want another battle
    msgbox @m1 MSG_YESNO
    compare LASTRESULT 0x1
    if 0x0 goto @nope
    // And this will allow unlimited rematches
    settrainerflag <id>
    goto @trainer
    
    #org @nope
    // If you refused...
    msgbox @m2 MSG_NORMAL
    end
    
    #org @intro
    = Say something when introduced.
    
    #org @loss
    = Say something on loss.
    
    #org @m1
    = Do you want to battle again?
    
    #org @m2
    = Something to say if you refuse.
    
    #org @other
    = Something to say if you defeated the trainer and talk to him later
     
    Back
    Top