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

[Script] Can't Rebattle Scripted Trainer

  • 73
    Posts
    9
    Years
    • Seen Jul 18, 2024
    So in my hack I have a trainer where he will walk up to you and battle you when you step on the tile. If you beat him, he disappears and the roadblock I set up disappears as well which is what I want. However, if you lose to him, you can't rechallenge him and the roadblock can't move. How can I fix this?
     
    So in my hack I have a trainer where he will walk up to you and battle you when you step on the tile. If you beat him, he disappears and the roadblock I set up disappears as well which is what I want. However, if you lose to him, you can't rechallenge him and the roadblock can't move. How can I fix this?

    You should clear his trainer flag.
     
    So in my hack I have a trainer where he will walk up to you and battle you when you step on the tile. If you beat him, he disappears and the roadblock I set up disappears as well which is what I want. However, if you lose to him, you can't rechallenge him and the roadblock can't move. How can I fix this?

    Paste the script here.
     
    '---------------

    #org 0x80377D

    msgbox 0x88037F2 MSG_NORMAL '"Good. That makes two. Soon Jirachi..."

    msgbox 0x880383A MSG_NORMAL '"[blue_fr]I think someone is here."

    msgbox 0x8803876 MSG_NORMAL '"Seems we have a guest.\pTake care ..."

    applymovement 0x2 0x8803873

    waitmovement 0x2

    applymovement MOVE_PLAYER 0x88038A9

    waitmovement 0xFF

    applymovement 0x2 0x88038AE

    waitmovement 0x2

    applymovement 0x1 0x88038BA

    waitmovement 0x1

    hidesprite 0x2

    setvar 0x4046 0x4

    setflag 0x1246

    trainerbattle 0x2 0x8 0x0 0x88038C2 0x88038E2 0x88037DD

    release

    end



    '---------------

    #org 0x8037DD

    msgbox 0x88038F7 MSG_NORMAL '"[blue_fr]Hm. I'll have to tell the..."

    fadescreen 0x1

    setflag 0x1248

    hidesprite 0x1

    fadescreen 0x0

    release

    end





    '---------

    ' Strings

    '---------

    #org 0x8037F2

    = Good. That makes two. Soon Jirachi\nwill come straight to us.



    #org 0x80383A

    = [blue_fr]I think someone is here.



    #org 0x803876

    = Seems we have a guest.\pTake care of that for me.



    #org 0x8038C2

    = [blue_fr]Just following orders.



    #org 0x8038E2

    = This is a problem.



    #org 0x8038F7

    = [blue_fr]Hm. I'll have to tell the\nothers.





    '-----------

    ' Movements

    '-----------

    #org 0x803873

    #raw 0x0 'Face Down

    #raw 0xFE 'End of Movements



    #org 0x8038A9

    #raw 0x1D 'Step Down (Fast)

    #raw 0x1D 'Step Down (Fast)

    #raw 0x1F 'Step Left (Fast)

    #raw 0x3 'Face Right

    #raw 0xFE 'End of Movements



    #org 0x8038AE

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x13 'Step Right (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0xFE 'End of Movements



    #org 0x8038BA

    #raw 0x13 'Step Right (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x2 'Face Left

    #raw 0xFE 'End of Movements
     
    '---------------

    #org 0x80377D

    msgbox 0x88037F2 MSG_NORMAL '"Good. That makes two. Soon Jirachi..."

    msgbox 0x880383A MSG_NORMAL '"[blue_fr]I think someone is here."

    msgbox 0x8803876 MSG_NORMAL '"Seems we have a guest.\pTake care ..."

    applymovement 0x2 0x8803873

    waitmovement 0x2

    applymovement MOVE_PLAYER 0x88038A9

    waitmovement 0xFF

    applymovement 0x2 0x88038AE

    waitmovement 0x2

    applymovement 0x1 0x88038BA

    waitmovement 0x1

    hidesprite 0x2

    setvar 0x4046 0x4

    setflag 0x1246

    trainerbattle 0x2 0x8 0x0 0x88038C2 0x88038E2 0x88037DD

    release

    end



    '---------------

    #org 0x8037DD

    msgbox 0x88038F7 MSG_NORMAL '"[blue_fr]Hm. I'll have to tell the..."

    fadescreen 0x1

    setflag 0x1248

    hidesprite 0x1

    fadescreen 0x0

    release

    end





    '---------

    ' Strings

    '---------

    #org 0x8037F2

    = Good. That makes two. Soon Jirachi\nwill come straight to us.



    #org 0x80383A

    = [blue_fr]I think someone is here.



    #org 0x803876

    = Seems we have a guest.\pTake care of that for me.



    #org 0x8038C2

    = [blue_fr]Just following orders.



    #org 0x8038E2

    = This is a problem.



    #org 0x8038F7

    = [blue_fr]Hm. I'll have to tell the\nothers.





    '-----------

    ' Movements

    '-----------

    #org 0x803873

    #raw 0x0 'Face Down

    #raw 0xFE 'End of Movements



    #org 0x8038A9

    #raw 0x1D 'Step Down (Fast)

    #raw 0x1D 'Step Down (Fast)

    #raw 0x1F 'Step Left (Fast)

    #raw 0x3 'Face Right

    #raw 0xFE 'End of Movements



    #org 0x8038AE

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x13 'Step Right (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0xFE 'End of Movements



    #org 0x8038BA

    #raw 0x13 'Step Right (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x10 'Step Down (Normal)

    #raw 0x2 'Face Left

    #raw 0xFE 'End of Movements

    Instead of using "trainerbattle 0x2", use "trainerbattle 0x3".
     
    Last edited:
    I may have to rewrite it because it's giving me a too many parameters error when I change it to 0x9 but not if I leave it at 0x2. I'll rewrite it and try what you said. Would I be having it call the same flag as the script or a different flag to signal the blockade to disappear?
     
    I may have to rewrite it because it's giving me a too many parameters error when I change it to 0x9 but not if I leave it at 0x2. I'll rewrite it and try what you said. Would I be having it call the same flag as the script or a different flag to signal the blockade to disappear?

    Oh man... I feel generous right now. You can do something else and I will rewrite it correctly some time later and send it.
     
    I did rewrite it and it still doesn't let me rematch him but the roadblock does move and he does vanish if I lose. I'm half considering leaving this in and it just be a match that if you lose, you lose. I tried comparing it to something like Gary in Silph Co. or on SS Anne and I may just have to settle.

    If you did do that for me though, that would be incredible and I would be so grateful.
     
    I did rewrite it and it still doesn't let me rematch him but the roadblock does move and he does vanish if I lose. I'm half considering leaving this in and it just be a match that if you lose, you lose. I tried comparing it to something like Gary in Silph Co. or on SS Anne and I may just have to settle.

    If you did do that for me though, that would be incredible and I would be so grateful.

    So you want to be able to re-battle him? After whiting out?
     

    Here you go:
    Code:
    #dynamic 0x(Your Offset)
    
    #org @start
    lock
    msgbox @msg1 0x2 
    msgbox @msg2 0x2
    msgbox @msg3 0x2
    waitmsg 
    applymovement 0x2 @move1
    waitmovement 0x0
    applymovement 0xFF @move2
    waitmovement 0x0
    applymovement 0x2 @move3
    waitmovement 0x0
    applymovement 0x1 @move4
    waitmovement 0x0
    hidesprite 0x2
    msgbox @ext 0x2
    trainerbattle 0x3 0x148 0x0 @after
    msgbox @msg5 0x2
    fadescreen 0x1
    setflag 0x1248
    hidesprite 0x1
    fadescreen 0x0
    setvar 0x4046 0x4
    setflag 0x1246
    release
    end
    
    '---------
    ' Strings
    '---------
    
    #org @msg1
    = Good. That makes two. Soon Jirachi\nwill come straight to us.
    
    #org @msg2
    = [blue_fr]I think someone is here.
    
    #org @msg3
    = Seems we have a guest.\pTake care of that for me.
    
    #org @ext
    = [blue_fr]Just following orders.
    
    #org @after
    = This is a problem.
    
    #org @msg5
    = [blue_fr]Hm. I'll have to tell the\nothers.
    
    '-----------
    ' Movements
    '-----------
    
    #org @move1
    #raw 0x0 'Face Down
    #raw 0xFE 'End of Movements
    
    #org @move2
    #raw 0x1D 'Step Down (Fast)
    #raw 0x1D 'Step Down (Fast)
    #raw 0x1F 'Step Left (Fast)
    #raw 0x3 'Face Right
    #raw 0xFE 'End of Movements
    
    #org @move3
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x13 'Step Right (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0xFE 'End of Movements
    
    #org @move4
    #raw 0x13 'Step Right (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x2 'Face Left
    #raw 0xFE 'End of Movements

    Remember, "trainerbattle 0x3" checks this type of scenario. Oh, and I changed the battle to my fitting. I forgot to correct it. Sorry!
    Hope this clears things up!
     
    Last edited:
    It definitely works! Thank you so much! Unfortunately the dialogue remains with the hidesprites still in effect but I can work around that to make it fit. You've definitely helped me with figuring it out for future scripts as well. Thanks again!
     
    It definitely works! Thank you so much! Unfortunately the dialogue remains with the hidesprites still in effect but I can work around that to make it fit. You've definitely helped me with figuring it out for future scripts as well. Thanks again!

    Oh, for that, you just need to assign a value to the person event and after using "hidesprite", you set the flag of the same number as the value of the Person ID.
     
    So that would have the NPC I battle standing in the spot he walked to when I return?
     
    So that would have the NPC I battle standing in the spot he walked to when I return?


    Like this:
    Code:
    #dynamic 0x(Your Offset)
    
    #org @start
    lock
    msgbox @msg1 0x2 
    msgbox @msg2 0x2
    msgbox @msg3 0x2
    waitmsg 
    applymovement 0x2 @move1
    waitmovement 0x0
    applymovement 0xFF @move2
    waitmovement 0x0
    applymovement 0x2 @move3
    waitmovement 0x0
    applymovement 0x1 @move4
    waitmovement 0x0
    hidesprite 0x2
    [B]setflag 0x(whatever Person ID the "0x2" person event has)[/B]
    msgbox @ext 0x2
    trainerbattle 0x3 0x148 0x0 @after
    msgbox @msg5 0x2
    fadescreen 0x1
    setflag 0x1248
    hidesprite 0x1
    [B]setflag 0x(whatever Person ID the "0x1" person event has)[/B]
    fadescreen 0x0
    setvar 0x4046 0x4
    setflag 0x1246
    release
    end
    
    '---------
    ' Strings
    '---------
    
    #org @msg1
    = Good. That makes two. Soon Jirachi\nwill come straight to us.
    
    #org @msg2
    = [blue_fr]I think someone is here.
    
    #org @msg3
    = Seems we have a guest.\pTake care of that for me.
    
    #org @ext
    = [blue_fr]Just following orders.
    
    #org @after
    = This is a problem.
    
    #org @msg5
    = [blue_fr]Hm. I'll have to tell the\nothers.
    
    '-----------
    ' Movements
    '-----------
    
    #org @move1
    #raw 0x0 'Face Down
    #raw 0xFE 'End of Movements
    
    #org @move2
    #raw 0x1D 'Step Down (Fast)
    #raw 0x1D 'Step Down (Fast)
    #raw 0x1F 'Step Left (Fast)
    #raw 0x3 'Face Right
    #raw 0xFE 'End of Movements
    
    #org @move3
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x13 'Step Right (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0xFE 'End of Movements
    
    #org @move4
    #raw 0x13 'Step Right (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x10 'Step Down (Normal)
    #raw 0x2 'Face Left
    #raw 0xFE 'End of Movements
     
    The dialogue still seems to plays out no matter what I try. I really do appreciate your help but you don't have to keep trying. I'll try and figure a way out to make it work.
     
    Back
    Top