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

[Other] How to rematch trainers (script)

4
Posts
8
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!!
     
    3,830
    Posts
    14
    Years
    • Age 27
    • OH
    • Seen Feb 26, 2024
    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.
     

    Le pug

    Creator of Pokémon: Discovery / Fat Kid
    870
    Posts
    10
    Years
  • 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.
     
    2
    Posts
    7
    Years
    • Seen Oct 24, 2018
    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.
     
    88
    Posts
    13
    Years
    • Seen Jun 18, 2020
    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